diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b08cfe..4e1d995 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,8 +5,18 @@ on: - pull_request jobs: + pre-commit: + name: pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 test: runs-on: ${{ matrix.os }} + needs: [ pre-commit ] strategy: matrix: os: [ubuntu-latest, windows-latest] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..96212c6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.3 + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index c0829af..06b64c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,3 +54,58 @@ addopts = [ testpaths = [ "tests", ] + +[tool.ruff] +line-length = 90 + +[tool.ruff.lint] +select = [ + "F", # pyflakes + "W", # pycodestyle-warnings + "E", # pycodestyle-errors +# "I", # isort +# "N", # pep8-naming +# "D", # pydocstyle +# "UP", # pyupgrade +# "YTT", # flake8-2020 +# "ANN", # flake8-annotations +# "S", # flake8-banditF +# "FBT", # flake8-boolean-trap +# "B", # flake8-bugbear +# "A", # flake8-builtins +# "COM", # flake8-comma +# "C4", # flake8-comprehensions +# "EM", # flake8-errmsg +# "FA", # flake8-future-annotations + "ISC", # flake8-implicit-str-concat + "ICN", # flake8-import-conventions +# "G", # flake8-logging-format + "PIE", # flake8-pie +# "T20", # flake8-print +# "PYI", # flake8-pyi +# "PT", # flake8-pytest-style +# "Q", # flake8-quotes +# "RSE", # flake8-raise +# "RET", # flake8-return +# "SLF", # flake8-self +# "SIM", # flake8-simplify +# "TID", # flake8-tidy-imports +# "TCH", # flake8-type-checking +# "ARG", # flake8-unused-arguments +# "PTH", # flake8-use-pathlib +# "TD", # flake8-todos +# "ERA", # eradicate +# "PGH", # pygrep-hooks +# "PL", # pylint +# "TRY", # tryceratops +# "FLY", # flynt +# "PERF", # perflint +# "FURB", # refurb +# "RUF", # Ruff-specific +] +ignore = [ + "E203", "E266", "E402", "E731", "C901", +] + +[tool.ruff.lint.mccabe] +max-complexity = 18 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b4cd819..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -ignore = E203, E266, W503, E402, E731, C901 -max-line-length = 90 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 diff --git a/tox.ini b/tox.ini index 92b95cc..d64bff9 100644 --- a/tox.ini +++ b/tox.ini @@ -28,11 +28,6 @@ deps = commands = pytest --basetemp={envtmpdir} -[testenv:flake8] -basepython = python3.7 -deps = flake8 -commands = flake8 click_repl tests - [testenv:click7] basepython = python3.10 deps =