← Back to issue list

[DISCUSS] Disable magic value linter for tests?

View original Github issue

Metadata

Project
starbase
Number
#148
Type
issue
State
closed
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Resolved. The PLR2004 magic value comparison rule will be disabled for test files. The private/protected method usage rule was also disabled for tests.

Suggested action:

No scores available.

Issue body

We fairly frequently compare to literals in tests, which means [PLR2004](https://docs.astral.sh/ruff/rules/magic-value-comparison/) linter complains a lot. Would anyone object to disabling this in tests? Example PR with a lot of this: https://github.com/canonical/craft-parts/pull/574/files

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Resolved. The PLR2004 magic value comparison rule will be disabled for test files. The private/protected method usage rule was also disabled for tests.
qwen/qwen3.6-35b-a3b Maintainers agreed to disable the magic value comparison linter rule for tests. Implementation was confirmed, also extending the configuration to suppress warnings for private and protected method usage in test files.
qwen3.6-35b-a3b-mtp-q6 Resolved after agreement to disable the PLR2004 magic value comparison linter rule for tests. The private/protected method access rule will also be disabled in test directories. Implementation planned.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#151 style(lint): disable magic value check in tests starbase merged Merged to disable the magic value lint check in tests, resolving issue #148. Approved by three reviewers, passed CI checks, and maintained 100% test coverage with a single line change.
71%
#351 linters: add PLR2004 to ruff ignore craft-parts merged Merged adding PLR2004 to the ruff ignore list to suppress false positives for magic value comparisons in tests. Approved, passed CI, and updated the configuration file with one line.
70%