Skip to content

Commit

Permalink
Migrate flake8 to ruff (minimal)
Browse files Browse the repository at this point in the history
  • Loading branch information
LecrisUT committed Jun 28, 2024
1 parent 6df287a commit 46bbaba
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 46bbaba

Please sign in to comment.