diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfd2fd685..446ce236f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,20 +12,13 @@ repos: args: [--autofix] - id: pretty-format-yaml args: [--autofix, --indent, '2'] -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - repo: https://github.com/ambv/black rev: 23.7.0 hooks: - id: black args: [-l, '100', --target-version, py35] -- repo: https://github.com/pycqa/flake8 - rev: 6.1.0 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.286 hooks: - - id: flake8 - args: [--exclude, tests/exceptions/source] - additional_dependencies: - - flake8-bugbear==23.1.20 - - pep8-naming==0.13.3 + - id: ruff + args: [--fix, --exit-non-zero-on-fix] diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..53ff622d6 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,8 @@ +# Enforce pyflakes(F), pycodestyle(E, W), isort (I), bugbears (B), and pep8-naming (N) rules +select = ["F", "E", "W", "I", "B", "N"] +# Ignore these errors for now that are picked up by ruff but were not by flake8 +ignore = ["B904", "B033", "B028", "B018"] +line-length = 100 +exclude = ["tests/exceptions/source", "loguru/__init__.pyi"] +[pycodestyle] +max-doc-length = 100 diff --git a/tox.ini b/tox.ini index 896d816af..dd98199ad 100644 --- a/tox.ini +++ b/tox.ini @@ -23,21 +23,6 @@ description = Build the HTML documentation. commands = sphinx-build -a -b html -W --keep-going docs/ docs/build -[isort] -line_length = 100 -profile = black - -[flake8] -max_line_length = 100 -max_doc_length = 100 -ignore = - # Line break before binary operator (PEP8 now recommend to break after binary operator) - W503 - # Whitespace before ":" in slices - E203 -exclude = - tests/exceptions/source - [pytest] addopts = -l testpaths =