-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add black formatter check #569
Conversation
f3ad79d
to
d6b1487
Compare
OK, recapping some of the implementation choices here, after discussion with @conorsch:
I intend to re-organize this as follows:
Comments, clarifications or objections welcome, now or later. :) If there's an alternative to |
- Re-adds dev-requirements - Adds marke target - Generalizes and cleans up linter autodiscovery - Avoids use of docker when running targets locally
This was necessary because the auto-discovery method used missed some Python files that were classified as The changes above are now implemented, except for
In addition, I think this is ready for someone else to take a look. Leaving as draft PR until I add a formal test plan. |
Looking food to me, @eloquence. Confirming that files are currently clean:
and after intentionally breaking formatting in a file, the same check exits non-zero:
A bit more guidance around testing, particularly the git ignore refs logic mentioned in freedomofpress/securedrop-sdk#124, would be helpful. Otherwise, looks ready for final review to my eye! |
This is now also done, and I've added a detailed test plan. Calling this officially ready for review, thanks for taking a first pass @conorsch :-) |
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.
Looks great! Confirmed full test plan.
In order to run the blame checks on Debian Stable, I had to enable buster-backports to get a new enough version of git. Then it worked beautifully. Note that git config blame.ignoreRevsFile .git-blame-ignore-revs
(cribbed from freedomofpress/securedrop-sdk#124) will make the change stick around in the local repo config. I've added that to my ~/.gitconfig
, in an attempt to apply the change everywhere.
Resolves #568
black
formatter with 100 character line length per our coding conventionflake8
settings accordinglydev-requirements.in
anddev-requirements.txt
for managing these dependenciesvenv
Makefile target for convenience, following @rmol's example in Add black and isort securedrop-sdk#124Status
Ready for review
Test plan
Preparatory steps
make venv
and activate it usingsource .venv/bin/activate
git
version 2.23.x.flake8
andblack
targetsmake black
.echo $?
)make flake8
echo $?
).py
and introduce an issue that would be flagged by bothflake8
andblack
, e.g., an E251 violationscripts
directory) and introduce a similar issue.make flake8
andmake black
echo $?
) for both commands.I would recommend additional investigation of the auto-discovery logic introduced in
scripts/lint-all
. We want to make sure that it covers all Python files in this repository, including likely future additions.Excluding formatter revisions
git blame scripts/validate_config.py
git blame --ignore-revs-file .git-blame-ignore-revs scripts/validate_config.py