executablebooks / rst-to-myst

Convert ReStructuredText to MyST Markdown
https://rst-to-myst.readthedocs.io
MIT License
59 stars 10 forks source link

🔧 flake8: fix pre-commit errors #51

Closed goxberry closed 1 year ago

goxberry commented 1 year ago

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

codecov[bot] commented 1 year ago

Codecov Report

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

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

Additional details and impacted files ```diff @@ 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](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/executablebooks/rst-to-myst/pull/51?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks) | Coverage Δ | | |---|---|---| | [rst\_to\_myst/states.py](https://codecov.io/gh/executablebooks/rst-to-myst/pull/51?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks#diff-cnN0X3RvX215c3Qvc3RhdGVzLnB5) | `88.70% <ø> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=executablebooks)

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

chrisjsewell commented 1 year ago

Always helpful when someone fixes their own PR 😄 thanks

welcome[bot] commented 1 year ago

Congrats on your first merged pull request in this project! :tada: congrats
Thank you for contributing, we are very proud of you! :heart: