Skip to content

Commit

Permalink
add ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Dec 1, 2023
1 parent 4cdbda5 commit 1367b47
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 29 deletions.
29 changes: 6 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand All @@ -23,27 +19,14 @@ repos:
args: ['--fix=lf']
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies: ["tomli"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bandit==4.1.1
- flake8-bugbear==23.11.28
- flake8-comprehensions==3.14.0
- flake8-debugger==4.1.2
- flake8-string-format==0.3.0
6 changes: 0 additions & 6 deletions {{cookiecutter.project_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ repos:
args: ['--assume-in-merge']
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
Expand All @@ -30,8 +29,3 @@ repos:
hooks:
- id: codespell
additional_dependencies: ["tomli"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
59 changes: 59 additions & 0 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,62 @@ files = ["src", "tests"]

[tool.codespell]
ignore-words-list = " "

[tool.ruff]
ignore = [
"S101", # assert
"PLR2004", # magic-value-comparison
"PLW2901", # redefined-loop-name
"ISC001", # single-line-implicit-string-concatenation
"SIM105", # suppressible-exception
"SIM108", # if-else-block-instead-of-if-exp
]
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe
"W", # pycodestyle - Warning
"E", # pycodestyle - Error
"F", # pyflakes
"I", # isort
"T10", # flake8-debugger
"S", # flake8-bandit
"PL", # pylint
"TCH", # flake8-type-checking
"UP", # pyupgrade
"N", # pep8-naming
"PIE", # flake8-pie
"ASYNC", # flake8-async
"EXE", # flake8-executable
"ISC", # flake8-implicit-str-concat
"SIM", # flake8-simplify
"ASYNC", # flake8-async
"INP", # flake8-no-pep420
"EXE", # flake8-executable
"PYI", # flake8-pyi
"RSE", # flake8-raise
"SLOT", # flake8-slots
"PGH", # pygrep hooks
"FLY", # flynt
"RUF", # ruff
"G", # flake8-logging-format
"A", # flake8-builtins
"TRY", # tryceratops
"DTZ", # flake8-datetimez
"RET", # flake8-return
"PT", # flake8-pytest-style
"ARG", # flake8-unused-arguments
"SLF", # flake8-self
"ICN", # flake8-import-conventions
]
show-source = true
show-fixes = true

[tool.ruff.per-file-ignores]
"tests/**" = ["S", "ARG001", "ARG002"]

[tool.ruff.lint.flake8-type-checking]
strict = true

[tool.ruff.lint.isort]
known-first-party = ["{{ cookiecutter.package_name }}"]

0 comments on commit 1367b47

Please sign in to comment.