Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNT] Move linting to ruff #1692

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
36 changes: 33 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
[tool.ruff]
line-length = 120
fkiraly marked this conversation as resolved.
Show resolved Hide resolved
exclude = [
"docs/build/",
"node_modules/",
".eggs/",
"versioneer.py",
"venv/",
".venv/",
".git/",
".history/",
]

[tool.ruff.lint]
select = ["E", "F", "W", "C4", "S"]
extend-ignore = [
"E203", # space before : (needed for how black formats slicing)
"E402", # module level import not at top of file
"E731", # do not assign a lambda expression, use a def
"E741", # ignore not easy to read variables like i l I etc.
"C406", # Unnecessary list literal - rewrite as a dict literal.
"C408", # Unnecessary dict call - rewrite as a literal.
"C409", # Unnecessary list passed to tuple() - rewrite as a tuple literal.
"F401", # unused imports
]

[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 +54,7 @@ exclude = '''
'''

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

[project]
Expand Down Expand Up @@ -107,10 +138,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
Loading