Skip to content

Commit

Permalink
fea: use ruff 0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CompRhys committed Aug 20, 2024
1 parent 575af01 commit 9621cee
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 73 deletions.
45 changes: 5 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,9 @@ repos:
- id: trailing-whitespace
exclude: *exclude_files

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: black
name: Black Formating
exclude: *exclude_files

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports
exclude: *exclude_files

- repo: https://github.com/PyCQA/pylint
rev: pylint-2.5.2
hooks:
- id: pylint
language: system
args: [
'--disable=line-too-long',
'--disable=no-member',
'--disable=missing-module-docstring',
'--disable=missing-class-docstring',
'--disable=missing-function-docstring',
'--disable=too-many-arguments',
'--disable=too-many-locals',
'--disable=not-callable',
'--disable=logging-fstring-interpolation',
'--disable=logging-not-lazy',
'--disable=invalid-name',
'--disable=too-few-public-methods',
'--disable=too-many-instance-attributes',
'--disable=too-many-statements',
'--disable=too-many-branches',
'--disable=import-outside-toplevel',
'--disable=cell-var-from-loop',
'--disable=duplicate-code',
'--disable=use-dict-literal',
]
exclude: *exclude_files
- id: ruff
args: [ --fix]
- id: ruff-format
94 changes: 64 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,70 @@ requires = [
]
build-backend = "setuptools.build_meta"

# Make isort compatible with black
[tool.isort]
profile = "black"

# Pylint
[tool.pylint.'MESSAGES CONTROL']
disable = [
"line-too-long",
"no-member",
"missing-module-docstring",
"missing-class-docstring",
"missing-function-docstring",
"too-many-arguments",
"too-many-locals",
"not-callable",
"logging-fstring-interpolation",
"logging-not-lazy",
"invalid-name",
"too-few-public-methods",
"too-many-instance-attributes",
"too-many-statements",
"too-many-branches",
"import-outside-toplevel",
"cell-var-from-loop",
"duplicate-code",
"use-dict-literal",
]

[tool.pylint.MASTER]
ignore-paths = [
[tool.ruff]
target-version = "py37"
line-length = 120
exclude = [
"^mace/tools/torch_geometric/.*$",
"^mace/tools/scatter.py$",
]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Rule families
"ANN", # flake8-annotations (not ready, require types for ALL args)
"ARG", # Check for unused function arguments
"BLE", # General catch of Exception
"C90", # Check for functions with a high McCabe complexity
"COM", # flake8-commas (conflict with line wrapper)
"CPY", # Missing copyright notice at top of file (need preview mode)
"D", # pydocstyle
"EM", # Format nice error messages
"ERA", # Check for commented-out code
"FIX", # Check for FIXME, TODO and other developer notes
"FURB", # refurb (need preview mode, too many preview errors)
"G", # validate logging format strings
"INP", # Ban PEP-420 implicit namespace packages
"N", # pep8-naming (many var/arg names are intended)
"NPY", # NumPy-specific rules (TODO: enable this)
"PTH", # Prefer pathlib over os.path
"S", # flake8-bandit (TODO: enable this)
"SLF", # Access "private" class members
"T20", # Check for print/pprint
"TD", # TODO tags related

# Single rules
"B023", # Function definition does not bind loop variable
"B028", # No explicit stacklevel keyword argument found
"B904", # Within an except clause, raise exceptions with ...
"C408", # unnecessary-collection-call
"D105", # Missing docstring in magic method
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"DTZ003", # TODO: fix this (issue #3791)
"E501", # Line too long
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function
"ISC001", # Ignore for purpose of auto formatting
"N801", # Invalid Name
"PD901", # pandas-df-variable-name
"PERF203", # try-except-in-loop
"PERF401", # manual-list-comprehension
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR2004", # magic values in comparison
"PLW2901", # Outer for loop variable overwritten by inner assignment target
"PT013", # pytest-incorrect-pytest-import
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
"RET505", # Unnecessary `else` after `return` statement
"SIM105", # Use contextlib.suppress() instead of try-except-pass
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Checks for return statements in try blocks
"TRY301", # Checks for raise statements within try blocks
]
pydocstyle.convention = "google"
isort.split-on-trailing-comma = false
isort.required-imports = ["from __future__ import annotations"]
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ console_scripts =
[options.extras_require]
wandb = wandb
dev =
black
isort
ruff
mypy
pre-commit
pytest
pylint
schedulefree = schedulefree

0 comments on commit 9621cee

Please sign in to comment.