-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ruff
for linting and code formatting
#1019
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jkarasti for the work on this :-)
Here is some feedback:
- To me,
make check
conveys less meaning thanmake lint
, so we might maybe keep the last one. - We are currently using
isort
in addition to ruff, but ruff can do this for us. I think we should do this before merging.
Thanks a lot 👍 let me know when you need another review :-)
- Add new targets for checking and applying `ruff check` and `ruff format`. - Add targets `fix` and `check` for convenience. - Also use the new `check` target in CI.
c794c6e
to
41a6c59
Compare
My thinking was to have a complementary target for
I've enabled the isort rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for enabling the I
rules for isort, and for explaining your thinking.
Rather than having detailed targets, regrouping them behind the fix
and lint
targets seems to cut it while being self-explanatory. What do you think?
It's what the securedrop folks are doing, and having the same naming seems the right thing to do. Here's what's inside their makefile:
.PHONY: lint
lint:
@ruff check .
@ruff format --check .
.PHONY: fix
fix:
@ruff check . --fix
@ruff format .
Also, thanks for enabling the isort rule. The linter is currently failing with:
dangerzone/args.py:109: error: Unused "type: ignore" comment [unused-ignore]
Replace
black
andisort
withruff
for linting and code formatting and fixes everything found by ruffs default configuration. Also add onefix
to rule them all from freedomofpress/securedrop-tooling/issues/11 and a complementarycheck
target that runsruff check
,ruff format
andmypy
useful for CI. Note that this "reverts" #904.This is ready for merge as is but not complete as I'd I'd like to enable more lint rules.
Closes #254