diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 00000000..80320a9c --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,59 @@ +target-version = "py310" +output-format = "concise" +line-length = 159 + +[lint] +select = ["ALL"] +pydocstyle.convention = "google" # docstring settings +ignore = [ + # Unrealistic for this code base + "PTH", # flake8-use-pathlib + "N", # naming conventions + "PLR0912", # Too many branches, + "PLR0913", # Too many arguments in function definition + "D102", # Missing docstring in public method + # Unwanted + "FBT", # Using boolean arguments + "ANN101", # Missing type annotation for `self` in method + "ANN102", # Missing type annotation for `cls` in classmethod + "ANN204", # Missing return type annotation for special (dunder) method + "B028", # No explicit `stacklevel` keyword argument found in warning + "S105", # Possible hardcoded password + "S311", # insecure random generators + "PT011", # pytest-raises-too-broad + "SIM108", # Use ternary operator + # Unwanted docstrings + "D100", # Missing module docstring + "D104", # Missing public package docstring + "D105", # Missing docstring in magic method + "D107", # Missing docstring in `__init__` +] + +# Autofix settings +fixable = ["ALL"] +unfixable = ["F401"] # unused imports (should not disappear while editing) +extend-safe-fixes = [ + "D415", # First line should end with a period, question mark, or exclamation point + "D300", # Use triple double quotes `"""` + "D200", # One-line docstring should fit on one line + "TCH", # Format type checking only imports + "ISC001", # Implicitly concatenated strings on a single line + "EM", # Exception message variables + "RUF013", # Implicit Optional + "B006", # Mutable default argument +] + +isort.known-first-party = ["deeprank2"] + +[lint.per-file-ignores] +"tests/*" = [ + "S101", # Use of `assert` detected + "PLR2004", # Magic value used in comparison + "D101", # Missing class docstring + "D102", # Missing docstring in public method + "D103", # Missing docstring in public function + "SLF001", # private member access +] +"docs/*" = ["ALL"] +"tests/perf/*" = ["T201"] # Use of print statements +"*.ipynb" = ["T201", "E402", "D103"] diff --git a/pyproject.toml b/pyproject.toml index 4172d7cf..881c670f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,63 +89,3 @@ include = ["deeprank2*"] [tool.pytest.ini_options] # pytest options: -ra: show summary info for all test outcomes addopts = "-ra" - -[tool.ruff] -output-format = "concise" -line-length = 159 - -[tool.ruff.lint] -select = ["ALL"] -pydocstyle.convention = "google" # docstring settings -ignore = [ - # Unrealistic for this code base - "PTH", # flake8-use-pathlib - "N", # naming conventions - "PLR0912", # Too many branches, - "PLR0913", # Too many arguments in function definition - "D102", # Missing docstring in public method - # Unwanted - "FBT", # Using boolean arguments - "ANN101", # Missing type annotation for `self` in method - "ANN102", # Missing type annotation for `cls` in classmethod - "ANN204", # Missing return type annotation for special (dunder) method - "B028", # No explicit `stacklevel` keyword argument found in warning - "S105", # Possible hardcoded password - "S311", # insecure random generators - "PT011", # pytest-raises-too-broad - "SIM108", # Use ternary operator - # Unwanted docstrings - "D100", # Missing module docstring - "D104", # Missing public package docstring - "D105", # Missing docstring in magic method - "D107", # Missing docstring in `__init__` -] - -# Autofix settings -fixable = ["ALL"] -unfixable = ["F401"] # unused imports (should not disappear while editing) -extend-safe-fixes = [ - "D415", # First line should end with a period, question mark, or exclamation point - "D300", # Use triple double quotes `"""` - "D200", # One-line docstring should fit on one line - "TCH", # Format type checking only imports - "ISC001", # Implicitly concatenated strings on a single line - "EM", # Exception message variables - "RUF013", # Implicit Optional - "B006", # Mutable default argument -] - -isort.known-first-party = ["deeprank2"] - -[tool.ruff.lint.per-file-ignores] -"tests/*" = [ - "S101", # Use of `assert` detected - "PLR2004", # Magic value used in comparison - "D101", # Missing class docstring - "D102", # Missing docstring in public method - "D103", # Missing docstring in public function - "SLF001", # private member access -] -"docs/*" = ["ALL"] -"tests/perf/*" = ["T201"] # Use of print statements -"*.ipynb" = ["T201", "E402", "D103"]