Skip to content

lints: new black complains #1811

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

Closed
jku opened this issue Jan 31, 2022 · 3 comments · Fixed by #1814
Closed

lints: new black complains #1811

jku opened this issue Jan 31, 2022 · 3 comments · Fixed by #1814
Assignees
Labels
1.0.0 blockers To be addressed before 1.0.0 release

Comments

@jku
Copy link
Member

jku commented Jan 31, 2022

Lint fails on CI currently

lint run-test: commands[0] | black --check --diff tuf/api tuf/ngclient examples tests
--- examples/repo_example/hashed_bin_delegation.py	2022-01-31 12:38:07.681056 +0000
+++ examples/repo_example/hashed_bin_delegation.py	2022-01-31 12:38:35.919966 +0000
@@ -72,11 +72,11 @@
 PREFIX_LEN = len(f"{(NUMBER_OF_BINS - 1):x}")  # ... 2.
 #
 # Compared to decimal, hexadecimal numbers can express higher numbers with
 # fewer digits and thus further decrease metadata sizes. With the above prefix
 # length of 2 we can represent at most ...
-NUMBER_OF_PREFIXES = 16 ** PREFIX_LEN  # ... 256 prefixes, i.e. 00, 01, ..., ff.
+NUMBER_OF_PREFIXES = 16**PREFIX_LEN  # ... 256 prefixes, i.e. 00, 01, ..., ff.
 #
 # If the number of bins is a power of two, hash prefixes are evenly distributed
 # over all bins, which allows to calculate the uniform size of ...
 BIN_SIZE = NUMBER_OF_PREFIXES // NUMBER_OF_BINS  # ... 8, where each bin is
 # responsible for a range of 8 prefixes, i.e. 00-07, 08-0f, ..., f8-ff.
would reformat examples/repo_example/hashed_bin_delegation.py

Oh no! 💥 💔 💥
1 file would be reformatted, 31 files would be left unchanged.
ERROR: InvocationError for command /home/runner/work/python-tuf/python-tuf/.tox/lint/bin/black --check --diff tuf/api tuf/ngclient examples tests (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   lint: commands failed
Error: Process completed with exit code 1.

Fixing this of course fails lint with older black but 🤷

@jku
Copy link
Member Author

jku commented Jan 31, 2022

as a side note: I think we'll have to start pinning -dev requirements as well -- CI failures should not depend on when the CI run happens

@jku jku added the 1.0.0 blockers To be addressed before 1.0.0 release label Feb 1, 2022
@MVrachev
Copy link
Collaborator

MVrachev commented Feb 1, 2022

From what I understand, fixing this will require following the new black recommendations and pinning the current black version (which at the time of writing this is 22.1.0) inside requirements-dev.txt. @jku am I correct?

If I am correct, then I can submit a pr for this today.

@jku
Copy link
Member Author

jku commented Feb 1, 2022

Thank you. No need to pin as part of this PR (developers will have to wipe local tox caches, but that's just how tox works). A fix for repo_example is appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.0 blockers To be addressed before 1.0.0 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants