Skip to content

Commit

Permalink
[MNT] Move linting to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
airookie17 committed Oct 5, 2024
1 parent 53a1c41 commit e381f65
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 57 deletions.
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-ast
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
- id: ruff
args: [--fix]
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
Expand All @@ -24,6 +21,5 @@ repos:
rev: 1.8.7
hooks:
- id: nbqa-black
- id: nbqa-isort
- id: nbqa-flake8
- id: nbqa-ruff
- id: nbqa-check-ast
42 changes: 39 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
[tool.ruff]
line-length = 120
exclude = [
"docs/build/",
"node_modules/",
".eggs/",
"versioneer.py",
"venv/",
".venv/",
".git/",
".history/",
]

[tool.ruff.lint]
select = ["E", "F", "W", "C4", "S"]
extend-ignore = [
"E203",
"E402",
"E731",
"E741",
"C406",
"C408",
"C409",
"C416",
"C419",
"S101",
"S301",
"S310",
"S101",
"F401",
]

[tool.ruff.lint.isort]
known-first-party = ["pytorch_forecasting"]
combine-as-imports = true
force-sort-within-sections = true

[tool.black]
line-length = 120
include = '\.pyi?$'
Expand All @@ -23,7 +60,7 @@ exclude = '''
'''

[tool.nbqa.mutate]
isort = 1
ruff = 1
black = 1

[project]
Expand Down Expand Up @@ -107,10 +144,9 @@ dev = [
# checks and make tools
"pre-commit >=3.2.0,<4.0.0",
"invoke",
"flake8",
"mypy",
"pylint",
"isort",
"ruff",
# pytest
"pytest",
"pytest-xdist",
Expand Down
45 changes: 0 additions & 45 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
[flake8]
max-line-length = 120
show-source = true
ignore =
# space before : (needed for how black formats slicing)
E203,
# line break before binary operator
W503,
# line break after binary operator
W504,
# module level import not at top of file
E402,
# do not assign a lambda expression, use a def
E731,
# ignore not easy to read variables like i l I etc.
E741,
# Unnecessary list literal - rewrite as a dict literal.
C406,
# Unnecessary dict call - rewrite as a literal.
C408,
# Unnecessary list passed to tuple() - rewrite as a tuple literal.
C409,
# found modulo formatter (incorrect picks up mod operations)
S001,
# unused imports
F401

exclude = docs/build/*.py,
node_modules/*.py,
.eggs/*.py,
versioneer.py,
venv/*,
.venv/*,
.git/*
.history/*

[isort]
profile = black
honor_noqa = true
line_length = 120
combine_as_imports = true
force_sort_within_sections = true
known_first_party = pytorch_forecasting


[coverage:report]
ignore_errors = False
show_missing = true
Expand Down

0 comments on commit e381f65

Please sign in to comment.