You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruff, the tool Hatch uses under the hood, has an extensive list of rules:
https://docs.astral.sh/ruff/rules/
Although most of them have a reasonable motivation, we might not agree with all of them
for certain reasons. For example:
https://docs.astral.sh/ruff/rules/magic-value-comparison/
would not permit comparing a certain input with a fixed value without first declaring
a constant variable. That would not be sustainable in our code, leading to a lot of
constant variable and making the code harder to understand.
Here we add a set of rules to the Ruff ignore list, and document the motivation in the
template developer docs.
| `TRY003` | [raise-vanilla-args](https://docs.astral.sh/ruff/rules/raise-vanilla-args/) | Formatting warning/exception messages beforehand makes the code less readable, for a minor benefit in readability of the exception. |
42
+
| `EM101` | [raw-string-in-exception](https://docs.astral.sh/ruff/rules/raw-string-in-exception/) | Same as `TRY003` |
43
+
| `EM102` | [f-string-in-exception](https://docs.astral.sh/ruff/rules/f-string-in-exception/) | Same as `TRY003` |
44
+
| `PLR2004` | [magic-value-comparison](https://docs.astral.sh/ruff/rules/magic-value-comparison/) | We have a lot of “magic values” to compare with in scientific code; naming them all would reduce readability for little benefit. |
45
+
| `FBT002` | [boolean-default-value-positional-argument](https://docs.astral.sh/ruff/rules/boolean-default-value-positional-argument/) | We understand the concept, but adhering to this rule is not a small change in syntax; disable for now. |
46
+
| `TID252` | [relative-imports](https://docs.astral.sh/ruff/rules/relative-imports/) | We don’t mind relative imports; as long as you don’t go up a level, they’re more readable (less verbose). |
0 commit comments