diff --git a/pyproject.toml b/pyproject.toml index 73ef1a6..56c9427 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,19 +3,42 @@ # Modifications to this file that are not project-specific should also be done upstream. # These configs were last updated for ruff==0.3.7 # https://docs.astral.sh/ruff/configuration/ - [tool.ruff] line-length = 100 preview = true target-version = "py38" # Change this to the oldest supported version by your application +# Exclude auto-generated files +# exclude = [""] + +# https://docs.astral.sh/ruff/settings/#flake8-implicit-str-concat +[tool.ruff.lint.flake8-implicit-str-concat] +allow-multiline = false + +# https://docs.astral.sh/ruff/settings/#isort +[tool.ruff.lint.isort] +combine-as-imports = true +split-on-trailing-comma = false + +# https://docs.astral.sh/ruff/settings/#mccabe +[tool.ruff.lint.mccabe] +# Hard limit, arbitrary to 4 bytes +# max-complexity = 31 +# Arbitrary to 2 bytes, same as SonarLint +max-complexity = 15 + +[tool.ruff.lint.pylint] +# Arbitrary to 1 byte, same as SonarLint +max-args = 7 +# At least same as max-complexity +max-branches = 15 [tool.ruff.lint] select = ["ALL"] # https://docs.astral.sh/ruff/rules/ ignore = [ - # ## + ### # Not needed or wanted - # ## + ### "D1", # pydocstyle Missing doctring "D401", # pydocstyle: non-imperative-mood "EM", # flake8-errmsg @@ -44,43 +67,28 @@ ignore = [ "D212", # pydocstyle: multi-line-summary-first-line # Allow differentiating between broken (FIXME) and to be done/added/completed (TODO) "TD001", # flake8-todos: invalid-todo-tag - # ## + + ### # These should be warnings (https://github.com/astral-sh/ruff/issues/1256 & https://github.com/astral-sh/ruff/issues/1774) - # ## + ### "FIX", # flake8-fixme # Not all TODOs are worth an issue, this would be better as a warning "TD003", # flake8-todos: missing-todo-link + # False-positives "TCH004", # https://github.com/astral-sh/ruff/issues/3821 - # ## + + ### # Specific to this project - # ## + ### "CPY001", # missing-copyright-notice: Assume license from root # This is a relatively small, low contributors project. Git blame suffice. "TD002", # missing-todo-author -] -# https://docs.astral.sh/ruff/settings/#flake8-implicit-str-concat -[tool.ruff.lint.flake8-implicit-str-concat] -allow-multiline = false - -# https://docs.astral.sh/ruff/settings/#isort -[tool.ruff.lint.isort] -combine-as-imports = true -split-on-trailing-comma = false - -# https://docs.astral.sh/ruff/settings/#mccabe -[tool.ruff.lint.mccabe] -# Hard limit, arbitrary to 4 bytes -# max-complexity = 31 -# Arbitrary to 2 bytes, same as SonarLint -max-complexity = 15 - -[tool.ruff.lint.pylint] -# Arbitrary to 1 byte, same as SonarLint -max-args = 7 -# At least same as max-complexity -max-branches = 15 + ### FIXME/TODO: I'd normally set them as temporarily warnings, but no warnings in Ruff yet: + ### https://github.com/astral-sh/ruff/issues/1256 & https://github.com/astral-sh/ruff/issues/1774): + # "", +] [tool.ruff.lint.per-file-ignores] "**/typings/**/*.pyi" = [ @@ -102,9 +110,10 @@ max-branches = 15 # Issues with using a star-imported name will be caught by type-checkers. "F405", # may be undefined, or defined from star imports ] -# ## + +### # Specific to this project -# ## +### "Dolphin scripts/Entrance Randomizer/**.py" = [ "F405", # Allow * import from constants since we use a lot, but not all "PLW0603", # Using globals due to the nature of this script @@ -124,6 +133,12 @@ max-branches = 15 "PYI021", # No source, keep docstrings ] +### Possible future ruff.pylint configurations +# https://github.com/charliermarsh/ruff/issues/970 +# # Arbitrary to 2 bytes +# max-attributes = 15 +# max-locals = 15 + # https://github.com/hhatto/autopep8#usage # https://github.com/hhatto/autopep8#more-advanced-usage [tool.autopep8] @@ -141,7 +156,7 @@ ignore = [ "E2", # Whitespace "E3", # Blank lines "E502", # Remove extraneous escape of newline - "E703", # useless-semicolon + "E703", # useless-semicolon "E71", # Statement (comparisons) "E731", # lambda-assignment "W29", # Whitespace warning