Skip to content
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

Inconsistent linting rules? [was Commit auto-reformatting from the linter] #94

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

handrews
Copy link
Contributor

When running the full set of tests using tox, flake8 makes these adjustments in place.

I encountered this while setting up tests for the other PR I'm about to submit, and figured it was best to submit the auto-formatting changes separate from my new change.

Tox runs cleanly after these changes:

---------- coverage: platform darwin, python 3.12.0-alpha-5 ----------
Name                                                             Stmts   Miss  Cover
------------------------------------------------------------------------------------
.tox/py312/lib/python3.12/site-packages/rfc3986/__init__.py         16      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/_mixin.py          112      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/abnf_regexp.py      63      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/api.py              15      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/builder.py          66      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/compat.py           10      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/exceptions.py       44      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/iri.py              50      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/misc.py             31      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/normalizers.py      80      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/parseresult.py     167      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/uri.py              30      0   100%
.tox/py312/lib/python3.12/site-packages/rfc3986/validators.py      128      0   100%
------------------------------------------------------------------------------------
TOTAL                                                              812      0   100%

Required test coverage of 100% reached. Total coverage: 100.00%
2848 passed, 4947 warnings in 3.24s
.pkg: _exit> python /Users/handrews/dev/.venv/lib/python3.8/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py312: OK ✔ in 4.2 seconds
lint: commands[0]> black -l 78 -t py37 src/rfc3986 tests/
All done! ✨ 🍰 ✨
25 files left unchanged.
lint: commands[1]> flake8 src/rfc3986
  py37: OK (4.24=setup[1.01]+cmd[3.23] seconds)
  py38: OK (4.06=setup[0.67]+cmd[3.39] seconds)
  py39: OK (4.72=setup[1.44]+cmd[3.28] seconds)
  py310: OK (3.94=setup[0.70]+cmd[3.24] seconds)
  py311: OK (4.13=setup[0.79]+cmd[3.34] seconds)
  py312: OK (4.20=setup[0.73]+cmd[3.47] seconds)
  lint: OK (0.73=setup[0.01]+cmd[0.26,0.47] seconds)
  congratulations :) (26.14 seconds)

@handrews
Copy link
Contributor Author

OK, this is confusing- in my local repo, running flake8 by way of tox causes the changes in this PR. But the pre-commit check run of flake8 by way of tox changes them back.

So I guess the problem here is one of configuration? I'm a little lost when it comes to debugging differences between local copies and github hooks, so if anyone has any idea how to resolve this, I would be happy to update the PR. Presumably flake8 is getting its config from two different places and one or the other needs to be changed?

@handrews handrews changed the title Commit auto-reformatting from the linter Inconsistent linting rules? [was Commit auto-reformatting from the linter] Feb 18, 2023
@sigmavirus24
Copy link
Collaborator

tox is using an unpinned version of black, while pre-commit is pinned to 23.1.0. If you upgrade that, it should fix the inconsistency.

.pre-commit-config.yaml passes --line-length=79 to black, while
tox.ini was passing -l 78, which left five files flipping back
and forth between local and github checks.

Those five files conform to a 79-character length, so change
the local check to match the GitHub check.
@handrews
Copy link
Contributor Author

@sigmavirus24 thanks! I had not been familiar with black. While pinning it did not work, digging around revealed that tox.ini was configuring a line length of 78, while .pre-commit-config.yaml was passing 79. Since the files as checked in are aligned with 79-character lines, I've updated this PR to change the tox.ini configuration.

Since there are other packages that are pinned in .pre-commit-config.yaml and not tox.ini, I opted to leave that alone for now.

@sigmavirus24 sigmavirus24 merged commit a58db4c into python-hyper:main Feb 22, 2023
@handrews handrews deleted the flake8 branch February 22, 2023 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants