fpgmaas / cookiecutter-poetry

A modern cookiecutter template for Python projects that use Poetry for dependency management
https://fpgmaas.github.io/cookiecutter-poetry/
MIT License
382 stars 62 forks source link

make check fails on Linting with ruff : Python 3.12.4 #115

Closed keiser1080 closed 4 months ago

keiser1080 commented 4 months ago

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. create a pyenv using python 3.12.4
  2. clone the repo
  3. make install
  4. make

Expected behavior Linting with ruff

Additional context

14:53:59 ❯ make check   
🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry check --lock
All set!
🚀 Linting code: Running pre-commit
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
prettier.................................................................Passed
🚀 Linting with ruff
error: Failed to parse `/home/nobody/GitHub/cookiecutter-poetry2/cookiecutter-poetry/pyproject.toml`: TOML parse error at line 82, column 12
   |
82 | [tool.ruff.lint]
   |            ^^^^
unknown field `lint`, expected one of `allowed-confusables`, `builtins`, `cache-dir`, `dummy-variable-rgx`, `exclude`, `extend`, `extend-exclude`, `extend-ignore`, `extend-select`, `external`, `fix`, `fix-only`, `fixable`, `format`, `force-exclude`, `ignore`, `ignore-init-module-imports`, `line-length`, `required-version`, `respect-gitignore`, `select`, `show-source`, `src`, `namespace-packages`, `target-version`, `task-tags`, `typing-modules`, `unfixable`, `update-check`, `flake8-annotations`, `flake8-bandit`, `flake8-bugbear`, `flake8-builtins`, `flake8-errmsg`, `flake8-quotes`, `flake8-tidy-imports`, `flake8-implicit-str-concat`, `flake8-import-conventions`, `flake8-pytest-style`, `flake8-unused-arguments`, `isort`, `mccabe`, `pep8-naming`, `pycodestyle`, `pydocstyle`, `pylint`, `pyupgrade`, `per-file-ignores`

make: *** [Makefile:44: check] Error 1
fpgmaas commented 4 months ago

Thanks for raising this! I see the issue; we have two different versions of ruff running simultaneously; one in the pre-commit hook and one through the virtual environment based upon the pyproject.toml. One of them is a bit older, so it does not recognize the new configuration with [tool.ruff.lint] yet.

We should remove one of the methods of using ruff, and make sure the one we keep uses the latest release of ruff. I dont have time to fix it now, but hopefully tomorrow :)

keiser1080 commented 4 months ago

thanks!

lastest ruff v 0.5.1 seems to work if you add the keyword "check"

https://github.com/fpgmaas/cookiecutter-poetry/blob/8134f27936e41e2e27bbca5415030d5834cb953e/pyproject.toml#L31 ruff = "^0.5.1" https://github.com/fpgmaas/cookiecutter-poetry/blob/8134f27936e41e2e27bbca5415030d5834cb953e/Makefile#L44 @poetry run ruff check hooks tests cookiecutter_poetry --config pyproject.toml

fpgmaas commented 4 months ago

Thanks again, should be solved now!

keiser1080 commented 4 months ago

Yes it work thanks