-
Notifications
You must be signed in to change notification settings - Fork 6
Fixes #57 runs black & isort for code formatting check #61
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.
Looks good to me, but Black requires Python >= 3.6, so we should probably update setup.py
to match. With a 3.5 virtualenv, pip won't be able to find Black.
Also, for some reason the Unicode flair is displayed as tofu in my Qubes development VM, though I tried several fonts and a couple of terminal emulators, some combinations of which definitely worked on regular Debian. Not a blocker. 🤷♂️
I am marking it as Python >= 3.7 as we are running and testing on 3.7 in Debian Buster. |
1fc38c4
to
09a81cd
Compare
Python version requirement looks good, but I realized something else: our Flake8 configuration uses a line length of 100. For now we should probably add a |
09a81cd
to
29d2047
Compare
@rmol I added Note: except |
Okay, CI is failing to build the package because pip/setuptools is using PEP 517 to build via
|
dacac59
to
98193e3
Compare
We agreed to hold off until this change for now until a cross-repo code style standardization conversation, which is scheduled for after the SecureDrop Workstation pilot launch. |
This is ready to be picked up again; note that we want to use 100 characters line length. We've also agreed that we want to use an ignoreRevsFile for any commits to enforce
|
To have latest black, we need updated typed-ast, for that we have to upgrade mypy too, and for mypy upgrade to work, we had to upgrade the mypy-extensions. It first runs isort to check if it passes, and then it runs black. Both uses 100 as line length. setup.py marks Python version as >= 3.7 as we are testing and running the code only on 3.7 on Debian Buster. Also contains the formatting change in proxy.py for black check to run sucessfully on CI.
It adds a configuration file to skip the previous commmit which has isort and black formatting changes. ``` git config blame.ignoreRevsFile .git-blame-ignore-revs ```` After one executes the above command, `git blame` does not show details for the formatting commit.
98193e3
to
32e6271
Compare
This is ready for review, the description has the new steps for testing. |
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.
👍
One thing I tripped over was that isort's list of third-party packages is derived from the active virtualenv, so developers will need to ensure their editor or IDE is using the project-specific virtualenv, or they might get unexpected results from isort.
Ready for review
Fixes #144.
Adds new lint targets for
black
andisort
tool.make lint
will now first check anyisort
change and thenblack
and then
flake8
. All 3 commands use line length of100
.The last commit also adds a
.git-blame-ignore-revs
file,so that we don't see the changes from the formatting commit in the
git blame
output.How to test manually?
git checkout f9bcbd3e8b49b737b2b85bf608f48349ddc68a4b
make black
make isort
make lint
All of the above make commands should fail as formatting change is required.
git checkout 787844dc339e090aa0e9ac2241895365522c4119
make black
make isort
make lint
All of the make commands should now pass. Please note down a few lines in the different files changed in this commit for the next test. Use
git blame
to get the details.git checkout 32e62719148d54d1c264e8b781056803fa46b24a
git config blame.ignoreRevsFile .git-blame-ignore-revs
run this command.git blame
should not my name in the lines changed in the last commit.extra notes
Here is one fail message from
black
.