square-psychiatrist-19087
01/14/2024, 3:40 PMpants lint
output:
https://github.com/pantsbuild/pants/pull/20358#pullrequestreview-1811878481
I was able to fix it, but the fix is kinda hacky: https://github.com/pantsbuild/pants/pull/20358/commits/ade03f80272895533d7ab5fae032b13b5726522bbitter-ability-32190
01/14/2024, 4:05 PMlint ::
and it checks all your linters and fixers and formatters).
Otherwise there's no easy way to have CI check if the files are formattedsquare-psychiatrist-19087
01/14/2024, 4:46 PMbitter-ability-32190
01/14/2024, 4:53 PMsquare-psychiatrist-19087
01/14/2024, 5:01 PMblack format
black format --check # lint
black fix
black fix --check # lint
bitter-ability-32190
01/14/2024, 5:01 PMsquare-psychiatrist-19087
01/14/2024, 5:01 PMsquare-psychiatrist-19087
01/14/2024, 5:02 PMbitter-ability-32190
01/14/2024, 5:02 PMbitter-ability-32190
01/14/2024, 5:02 PMsquare-psychiatrist-19087
01/14/2024, 5:02 PMbitter-ability-32190
01/14/2024, 5:02 PMsquare-psychiatrist-19087
01/14/2024, 5:03 PMbitter-ability-32190
01/14/2024, 5:03 PMsquare-psychiatrist-19087
01/14/2024, 5:03 PMbitter-ability-32190
01/14/2024, 5:04 PM--check
is a waste of energy since the result is "yes" or "no", and if the answer is "no" the solution is to rerun fmt or fix anywaysbitter-ability-32190
01/14/2024, 5:04 PMsquare-psychiatrist-19087
01/14/2024, 5:05 PMbitter-ability-32190
01/14/2024, 5:53 PMsquare-psychiatrist-19087
01/14/2024, 6:10 PMsquare-psychiatrist-19087
01/14/2024, 6:11 PMI noticednow runs 4 checkers instead of 2:pants lint
```ā ruff check succeeded.
ā ruff check --fix succeeded.
ā ruff format failed.
ā ruff format --check failed.```This is not what I want to see in the run, I only need to run
ruff format --check
and ruff check
bitter-ability-32190
01/14/2024, 7:16 PMruff format
be a fmt/fix rule, and ruff check
be a lint rule, no?square-psychiatrist-19087
01/14/2024, 8:01 PMbitter-ability-32190
01/14/2024, 8:27 PMbitter-ability-32190
01/14/2024, 8:28 PMruff format
and one for ruff check
?bitter-ability-32190
01/14/2024, 8:28 PMruff format
could be thought of as black
and ruff check
be thought of as flake8square-psychiatrist-19087
01/14/2024, 8:30 PMsquare-psychiatrist-19087
01/14/2024, 8:31 PMlint
if I only declare fmt rulebitter-ability-32190
01/14/2024, 8:33 PMlint
. Except when running lint, instead of modifying files in the build root, we just compare before/after and fail if they're different (and list the files which changed)square-psychiatrist-19087
01/14/2024, 8:33 PMruff check
fix ruff check --fix
lint ruff format --check
fmt ruff format
And when I run pants lint
I expect to see 2 of them, but I see 4.bitter-ability-32190
01/14/2024, 8:35 PMformat --check
. You don't need that since format
is already run in lint
and that inherently checks the formatting.
Right?square-psychiatrist-19087
01/14/2024, 8:35 PMsquare-psychiatrist-19087
01/14/2024, 8:37 PMruff format --check
and pants will automatically add lint rule that checks ruff format
haven't done any changes?bitter-ability-32190
01/14/2024, 8:37 PMcheck --fix
square-psychiatrist-19087
01/14/2024, 8:39 PMcheck
will run all ruff lint rules, check --fix
will fix everything it can fixsquare-psychiatrist-19087
01/14/2024, 8:41 PMcheck
might show errors that are not fixable by check --fix
bitter-ability-32190
01/14/2024, 8:42 PMcheck
only check for issues that aren't fixable?square-psychiatrist-19087
01/14/2024, 9:14 PMbitter-ability-32190
01/14/2024, 9:21 PMbitter-ability-32190
01/14/2024, 9:23 PMruff format
as a format rule
⢠ruff check --fix
as a fix rule, but opting out of the lint
goal
⢠ruff check
as a lint
rulebitter-ability-32190
01/14/2024, 9:23 PMruff
to have an easy toggle for "check anything not fixable"square-psychiatrist-19087
01/14/2024, 10:24 PMbitter-ability-32190
01/14/2024, 10:35 PMsquare-psychiatrist-19087
01/14/2024, 11:04 PMbitter-ability-32190
01/14/2024, 11:06 PMbitter-ability-32190
01/14/2024, 11:07 PMsquare-psychiatrist-19087
01/15/2024, 12:16 PMbitter-ability-32190
01/15/2024, 12:35 PMsquare-psychiatrist-19087
01/15/2024, 1:36 PMgorgeous-winter-99296
01/15/2024, 2:26 PMcargo clippy
vs cargo clippy --fix
... So I think this solves that use-case too. For some reason cargo clippy --fix
is terribly slow (and barely works!) in large codebases and so I opted out of even supporting it.
I'm not sure if the same is ever true for formatting, in any tool, so opting out there seems weird (which you've already concluded, upon closer reading!).bitter-ability-32190
01/15/2024, 3:10 PMsquare-psychiatrist-19087
01/15/2024, 3:22 PMpants lint
and see your tool there, you might think that it runs the linter and not the fix-compare-linter, and this might lead to missing linter messages, because you think you run the linter, but you don't. Looks like confusion potentialbitter-ability-32190
01/15/2024, 3:24 PMsquare-psychiatrist-19087
01/15/2024, 3:36 PMsquare-psychiatrist-19087
01/15/2024, 3:38 PMbitter-ability-32190
01/15/2024, 4:26 PMsquare-psychiatrist-19087
01/15/2024, 4:55 PMautoflake
, pyupgrade
, ruff
, cargo fix
all cannot fix all the issues the linter shows. This is a core property of any linter. If there is an issue in your code then it can be fixed either in 1 way or in many ways. If it can be only fixed in 1 way then it can be fixed by a fixer, and if it can be fixed in many ways then it can't be fixed by a fixer.bitter-ability-32190
01/15/2024, 4:55 PMsquare-psychiatrist-19087
01/15/2024, 4:56 PMbitter-ability-32190
01/15/2024, 5:11 PMsquare-psychiatrist-19087
01/15/2024, 5:13 PMbitter-ability-32190
01/15/2024, 5:24 PMbitter-ability-32190
01/15/2024, 5:24 PMsquare-psychiatrist-19087
01/15/2024, 5:28 PMsquare-psychiatrist-19087
01/15/2024, 5:29 PMbitter-ability-32190
01/15/2024, 5:29 PMbitter-ability-32190
01/15/2024, 5:30 PMsquare-psychiatrist-19087
01/15/2024, 5:30 PMbitter-ability-32190
01/18/2024, 3:52 PM