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

🔧 flake8: fix pre-commit errors #51

Conversation

goxberry
Copy link
Contributor

On Python 3.9.2 with the virtual environment

cachetools==5.2.1
certifi==2022.12.7
cfgv==3.3.1
chardet==5.1.0
charset-normalizer==3.0.1
colorama==0.4.6
distlib==0.3.6
docutils==0.19
filelock==3.9.0
flit==3.8.0
flit_core==3.8.0
identify==2.5.13
idna==3.4
nodeenv==1.7.0
packaging==23.0
pip==22.3.1
pkg_resources==0.0.0
platformdirs==2.6.2
pluggy==1.0.0
pre-commit==2.21.0
pyproject_api==1.4.0
PyYAML==6.0
requests==2.28.2
setuptools==65.7.0
tomli==2.0.1
tomli_w==1.0.0
tox==4.2.8
urllib3==1.26.14
virtualenv==20.17.1
wheel==0.38.4

running

pre-commit install --install-hooks
pre-commit run --all

in the project root results in the output

(.venv) goxberry@penguin:~/repos/github.com/executable-books/rst-to-myst$ pre-commit run --all
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
check yaml...............................................................Passed
check toml...............................................................Passed
check blanket noqa.......................................................Passed
isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

rst_to_myst/states.py:148:21: B028 'conversion' is manually surrounded by quotes, consider using the `!r` conversion flag.
rst_to_myst/states.py:163:17: B028 'type_name' is manually surrounded by quotes, consider using the `!r` conversion flag.
rst_to_myst/states.py:350:17: B028 'subname' is manually surrounded by quotes, consider using the `!r` conversion flag.

This commit remediates those errors by adding the !r conversion flag to the brace expressions in the f-strings of the lines referenced in the output above.

An alternative fix would be to add B028 to the extend-ignore setting in the [flake8] section of tox.ini in the project root directory.

It appears that this changeset (or the alternative discussed above) must be merged in order to be able to merge #50 without CI errors.

Signed-off-by: Geoffrey M Oxberry goxberry@gmail.com

On Python 3.9.2 with the virtual environment

```
cachetools==5.2.1
certifi==2022.12.7
cfgv==3.3.1
chardet==5.1.0
charset-normalizer==3.0.1
colorama==0.4.6
distlib==0.3.6
docutils==0.19
filelock==3.9.0
flit==3.8.0
flit_core==3.8.0
identify==2.5.13
idna==3.4
nodeenv==1.7.0
packaging==23.0
pip==22.3.1
pkg_resources==0.0.0
platformdirs==2.6.2
pluggy==1.0.0
pre-commit==2.21.0
pyproject_api==1.4.0
PyYAML==6.0
requests==2.28.2
setuptools==65.7.0
tomli==2.0.1
tomli_w==1.0.0
tox==4.2.8
urllib3==1.26.14
virtualenv==20.17.1
wheel==0.38.4
```

running
```shell
pre-commit install --install-hooks
pre-commit run --all
```

in the project root results in the output
```console
(.venv) goxberry@penguin:~/repos/github.com/executable-books/rst-to-myst$ pre-commit run --all
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
check yaml...............................................................Passed
check toml...............................................................Passed
check blanket noqa.......................................................Passed
isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

rst_to_myst/states.py:148:21: B028 'conversion' is manually surrounded by quotes, consider using the `!r` conversion flag.
rst_to_myst/states.py:163:17: B028 'type_name' is manually surrounded by quotes, consider using the `!r` conversion flag.
rst_to_myst/states.py:350:17: B028 'subname' is manually surrounded by quotes, consider using the `!r` conversion flag.
```

This commit remediates those errors by adding the `!r` conversion flag
to the brace expressions in the f-strings of the lines referenced in
the output above.

An alternative fix would be to add `B028` to the `extend-ignore`
setting in the `[flake8]` section of `tox.ini` in the project root
directory.

Signed-off-by: Geoffrey M Oxberry <goxberry@gmail.com>
@codecov
Copy link

codecov bot commented Jan 15, 2023

Codecov Report

Base: 84.48% // Head: 84.48% // No change to project coverage 👍

Coverage data is based on head (fca2d13) compared to base (328ba48).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage   84.48%   84.48%           
=======================================
  Files          10       10           
  Lines        1637     1637           
=======================================
  Hits         1383     1383           
  Misses        254      254           
Flag Coverage Δ
pytests 84.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rst_to_myst/states.py 88.70% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@chrisjsewell
Copy link
Member

Always helpful when someone fixes their own PR 😄 thanks

@chrisjsewell chrisjsewell changed the title flake8: fix errors when running pre-commit hooks 🔧 flake8: fix pre-commit errors Jan 15, 2023
@chrisjsewell chrisjsewell merged commit 8fb6f3d into executablebooks:main Jan 15, 2023
@welcome
Copy link

welcome bot commented Jan 15, 2023

Congrats on your first merged pull request in this project! 🎉
congrats

Thank you for contributing, we are very proud of you! ❤️

@goxberry goxberry deleted the goxberry/fixup-pre-commit-hook-failures branch January 15, 2023 08:55
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