From 15910df1724795368616d8ff1fd909328f55ce63 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 13:47:41 +0000 Subject: [PATCH 1/9] Add renovate.json --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..39a2b6e --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ] +} From 2a0dbc6ac0a97b4f5f9c32551bd4b67df5a2b795 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 13:48:39 +0000 Subject: [PATCH 2/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/typecheck.yaml | 58 ++++---- .pre-commit-config.yaml | 6 +- Dolphin scripts/pyproject.toml | 199 ++++++++++++---------------- Dolphin scripts/typings/dolphin.pyi | 6 +- 4 files changed, 122 insertions(+), 147 deletions(-) diff --git a/.github/workflows/typecheck.yaml b/.github/workflows/typecheck.yaml index ea1404f..8183af0 100644 --- a/.github/workflows/typecheck.yaml +++ b/.github/workflows/typecheck.yaml @@ -1,42 +1,42 @@ name: Typecheck on: - workflow_dispatch: # Allows manual triggers - push: - branches: - - main - paths: - - "**.py" - - "**.pyi" - - "**/requirements*.txt" - - "**/pyproject.toml" - - ".github/workflows/typecheck.yaml" - pull_request: - branches: - - main - paths: - - "**.py" - - "**.pyi" - - "**/requirements*.txt" - - "**/pyproject.toml" - - ".github/workflows/typecheck.yaml" + workflow_dispatch: # Allows manual triggers + push: + branches: + - main + paths: + - "**.py" + - "**.pyi" + - "**/requirements*.txt" + - "**/pyproject.toml" + - ".github/workflows/typecheck.yaml" + pull_request: + branches: + - main + paths: + - "**.py" + - "**.pyi" + - "**/requirements*.txt" + - "**/pyproject.toml" + - ".github/workflows/typecheck.yaml" env: - PIP_DISABLE_PIP_VERSION_CHECK: 1 - FORCE_COLOR: 1 + PIP_DISABLE_PIP_VERSION_CHECK: 1 + FORCE_COLOR: 1 jobs: - pyright: - name: Run pyright - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + pyright: + name: Run pyright + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 # - uses: actions/setup-python@v4 # with: # python-version: "3.8" # cache: pip # cache-dependency-path: "**/requirements*.txt" # - run: pip install -r requirements.txt - - uses: jakebailey/pyright-action@v1 - with: - project: ./Dolphin scripts/pyproject.toml + - uses: jakebailey/pyright-action@v1 + with: + project: ./Dolphin scripts/pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46567b0..1a9c692 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,6 +47,6 @@ repos: - id: pyright args: [--project, Dolphin scripts/pyproject.toml] ci: - skip: - - dprint # https://github.com/adamchainz/pre-commit-dprint/issues/4 - - pyright # https://github.com/RobertCraigie/pyright-python/issues/164 + skip: + - dprint # https://github.com/adamchainz/pre-commit-dprint/issues/4 + - pyright # https://github.com/RobertCraigie/pyright-python/issues/164 diff --git a/Dolphin scripts/pyproject.toml b/Dolphin scripts/pyproject.toml index 7ea687d..b03a54d 100644 --- a/Dolphin scripts/pyproject.toml +++ b/Dolphin scripts/pyproject.toml @@ -1,59 +1,73 @@ # https://beta.ruff.rs/docs/configuration + +# https://github.com/hhatto/autopep8#usage +# https://github.com/hhatto/autopep8#more-advanced-usage +[tool.autopep8] +aggressive = 3 +ignore = [ + # TODO Suggest "multi-line method invocation style" to Ruff. and/or change to Black + # https://github.com/charliermarsh/ruff/issues/3713 + "E124", # Closing bracket may not match multi-line method invocation style (enforced by add-trailing-comma) + "E402", # Allow imports at the bottom of file + "E70", # Allow ... on same line as def + "W503" # Linebreak before binary operator +] +max_line_length = 120 +per_file_ignores = ["*.pyi: E302"] +recursive = true + +# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file +[tool.pyright] +# Use `pyright: ignore`, not `type: ignore` +enableTypeIgnoreComments = false +# Minimal python version supported +pythonVersion = "3.8.5" +# Extra strict +reportCallInDefaultInitializer = "error" +reportImplicitStringConcatenation = "error" +# False positives with TYPE_CHECKING +reportImportCycles = "information" +# Too strict +reportMissingSuperCall = "none" +# External type stubs may not be completable +reportMissingTypeStubs = "warning" +reportPropertyTypeMismatch = "error" +reportShadowedImports = "error" +reportUninitializedInstanceVariable = "error" +# Extra runtime safety +reportUnnecessaryComparison = "warning" +reportUnnecessaryTypeIgnoreComment = "error" +reportUnusedCallResult = "none" +typeCheckingMode = "strict" + [tool.ruff] -line-length = 120 -select = ["ALL"] -target-version = "py38" # https://beta.ruff.rs/docs/rules ignore = [ - ### + # ## # Not needed or wanted - ### - "D1", # pydocstyle Missing doctring - "D401", # pydocstyle: non-imperative-mood - "EM", # flake8-errmsg - "FBT", # flake8-boolean-trap - "INP", # flake8-no-pep420 - "ISC003", # flake8-implicit-str-concat: explicit-string-concatenation + # ## + "D1", # pydocstyle Missing doctring + "D401", # pydocstyle: non-imperative-mood + "EM", # flake8-errmsg + "FBT", # flake8-boolean-trap + "INP", # flake8-no-pep420 + "ISC003", # flake8-implicit-str-concat: explicit-string-concatenation # Short messages are still considered "long" messages - "TRY003", # tryceratops : raise-vanilla-args + "TRY003", # tryceratops : raise-vanilla-args # Don't remove commented code, also too inconsistant - "ERA001", # eradicate: commented-out-code + "ERA001", # eradicate: commented-out-code # contextlib.suppress is roughly 3x slower than try/except - "SIM105", # flake8-simplify: use-contextlib-suppress + "SIM105", # flake8-simplify: use-contextlib-suppress # Checked by type-checker (pyright) - "ANN", # flake-annotations - "TCH", # flake8-type-checking + "ANN", # flake-annotations + "TCH", # flake8-type-checking # We want D213: multi-line-summary-second-line and D211: no-blank-line-before-class - "D203", # pydocstyle: one-blank-line-before-class - "D212", # pydocstyle: multi-line-summary-first-line -] - -### -# Project(s)-specifics -### -[tool.ruff.per-file-ignores] -"*.pyi" = [ - "I002", # Stubs don't need from __future__ import annotations - "PLC0414", # https://github.com/charliermarsh/ruff/issues/3734 -] -"Entrance Randomizer/**.py" = [ - # Print are used as debug logs - "T20", # flake8-print - # Project is too simple to create our own errors - "TRY002", # raise-vanilla-class - # We don't do cryptography in this project - "S311", # suspicious-non-cryptographic-random-usage -] -"Entrance Randomizer/__main__.py" = [ - "E402", # Python path must first be set in __main__ - "F405", # Allow * import from constants since we use a lot, but not all - "PLW0603", # Using globals due to the nature of this script -] -"typings/dolphin-stubs/*.pyi" = [ - "D205", # External stubs, allow docstring w/o summary line - "E501", # External stubs, ignore line-length - "PYI021", # No source, keep docstrings + "D203", # pydocstyle: one-blank-line-before-class + "D212" # pydocstyle: multi-line-summary-first-line ] +line-length = 120 +select = ["ALL"] +target-version = "py38" # https://beta.ruff.rs/docs/settings/#flake8-implicit-str-concat [tool.ruff.flake8-implicit-str-concat] @@ -62,82 +76,43 @@ allow-multiline = false # https://beta.ruff.rs/docs/settings/#isort [tool.ruff.isort] combine-as-imports = true -required-imports = ["from __future__ import annotations"] # Safer with Python 3.8 and 3.9 +required-imports = ["from __future__ import annotations"] # Safer with Python 3.8 and 3.9 split-on-trailing-comma = false # https://beta.ruff.rs/docs/settings/#mccabe [tool.ruff.mccabe] # Hard limit, arbitrary to 4 bytes max-complexity = 31 -# Arbitrary to 2 bytes, same as SonarLint -# max-complexity = 15 + +# ## +# Project(s)-specifics +# ## +[tool.ruff.per-file-ignores] +"*.pyi" = [ + "I002", # Stubs don't need from __future__ import annotations + "PLC0414" # https://github.com/charliermarsh/ruff/issues/3734 +] +"Entrance Randomizer/**.py" = [ + # Print are used as debug logs + "T20", # flake8-print + # Project is too simple to create our own errors + "TRY002", # raise-vanilla-class + # We don't do cryptography in this project + "S311" # suspicious-non-cryptographic-random-usage +] +"Entrance Randomizer/__main__.py" = [ + "E402", # Python path must first be set in __main__ + "F405", # Allow * import from constants since we use a lot, but not all + "PLW0603" # Using globals due to the nature of this script +] +"typings/dolphin-stubs/*.pyi" = [ + "D205", # External stubs, allow docstring w/o summary line + "E501", # External stubs, ignore line-length + "PYI021" # No source, keep docstrings +] [tool.ruff.pylint] # Arbitrary to 1 byte, same as SonarLint max-args = 7 # At least same as max-complexity max-branches = 15 - -### Possible future ruff.pylint configurations -# https://github.com/charliermarsh/ruff/issues/970 -# # Dynamic/Generated members from SQLAlchemy -# ignored-classes = ["scoped_session"] -# # Arbitrary to 2 bytes -# max-attributes = 15 -# max-locals = 15 -# disable = [ -# # No need to mention the fixmes -# "fixme", -# "missing-docstring", -# # Already taken care of and grayed out. Also conflicts with Pylance reportIncompatibleMethodOverride -# "unused-argument", -# # Only reports a single instance. Pyright does a better job anyway -# "cyclic-import", -# # Strings are ok. Pylance also doesn't seem to see our overriden Exception classes (TODO: Make it better?) -# "invalid-sequence-index", -# # Happens too often with Flask, child classes should not be affected by this rule -# # See: https://github.com/PyCQA/pylint/issues/4352 -# "too-few-public-methods", -# # Similar lines in 2 files, doesn't really work -# "R0801", -# ] - -# https://github.com/hhatto/autopep8#usage -# https://github.com/hhatto/autopep8#more-advanced-usage -[tool.autopep8] -aggressive = 3 -ignore = [ - # TODO Suggest "multi-line method invocation style" to Ruff. and/or change to Black - # https://github.com/charliermarsh/ruff/issues/3713 - "E124", # Closing bracket may not match multi-line method invocation style (enforced by add-trailing-comma) - "E402", # Allow imports at the bottom of file - "E70", # Allow ... on same line as def - "W503", # Linebreak before binary operator -] -max_line_length = 120 -per_file_ignores = ["*.pyi: E302"] -recursive = true - -# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file -[tool.pyright] -# Minimal python version supported -pythonVersion = "3.8.5" -typeCheckingMode = "strict" -# Extra strict -reportCallInDefaultInitializer = "error" -reportImplicitStringConcatenation = "error" -reportPropertyTypeMismatch = "error" -reportShadowedImports = "error" -reportUninitializedInstanceVariable = "error" -reportUnnecessaryTypeIgnoreComment = "error" -# Use `pyright: ignore`, not `type: ignore` -enableTypeIgnoreComments = false -# External type stubs may not be completable -reportMissingTypeStubs = "warning" -# False positives with TYPE_CHECKING -reportImportCycles = "information" -# Extra runtime safety -reportUnnecessaryComparison = "warning" -# Too strict -reportMissingSuperCall = "none" -reportUnusedCallResult = "none" diff --git a/Dolphin scripts/typings/dolphin.pyi b/Dolphin scripts/typings/dolphin.pyi index 0f1fbab..927b067 100644 --- a/Dolphin scripts/typings/dolphin.pyi +++ b/Dolphin scripts/typings/dolphin.pyi @@ -5,7 +5,7 @@ intuitive way. For example, people can then do this: `from dolphin import event, memory` instead of: `import dolphin_event as event` - `import dolphin_memory as memory` + `import dolphin_memory as memory`. Valid: `import dolphin` @@ -16,11 +16,11 @@ Invalid: `import dolphin.event` `from dolphin.event import ...` """ +import dolphin_controller as controller import dolphin_event as event -import dolphin_memory as memory import dolphin_gui as gui +import dolphin_memory as memory import dolphin_savestate as savestate -import dolphin_controller as controller import dolphin_utils as utils __all__ = [ From 5e01d09d58cfcd495b748e9b5d72919127213e3b Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 12:57:59 -0400 Subject: [PATCH 3/9] Configure --- .github/renovate.json | 14 ++++++++++++++ Dolphin scripts/typings/dolphin.pyi | 4 ++-- renovate.json | 6 ------ 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .github/renovate.json delete mode 100644 renovate.json diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..6f76bf5 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "semanticCommits": "disabled", + "separateMajorMinor": false, + "suppressNotifications": [ + "prEditedNotification" + ], + "pre-commit": { + "enabled": true + } +} diff --git a/Dolphin scripts/typings/dolphin.pyi b/Dolphin scripts/typings/dolphin.pyi index e6d2894..140dfe0 100644 --- a/Dolphin scripts/typings/dolphin.pyi +++ b/Dolphin scripts/typings/dolphin.pyi @@ -5,7 +5,7 @@ intuitive way. For example, people can then do this: `from dolphin import event, memory` instead of: `import dolphin_event as event` - `import dolphin_memory as memory`. + `import dolphin_memory as memory` Valid: `import dolphin` @@ -15,7 +15,7 @@ Valid: Invalid: `import dolphin.event` `from dolphin.event import ...` -""" # Tries to add a . at the end of an import line +""" # noqa: D400,D415 # Tries to add a . at the end of an import line import dolphin_controller as controller import dolphin_event as event import dolphin_gui as gui diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 39a2b6e..0000000 --- a/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base" - ] -} From a9b761d874e01894476509ecd3fed60cf587fd16 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 13:04:40 -0400 Subject: [PATCH 4/9] More YAML changes --- .github/workflows/typecheck.yaml | 2 +- .pre-commit-config.yaml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/typecheck.yaml b/.github/workflows/typecheck.yaml index 3b944ff..7073996 100644 --- a/.github/workflows/typecheck.yaml +++ b/.github/workflows/typecheck.yaml @@ -1,7 +1,7 @@ name: Typecheck on: - workflow_dispatch: # Allows manual triggers + workflow_dispatch: # Allows manual triggers push: branches: - main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 045fbbc..30cc09c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,9 +12,8 @@ repos: - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks rev: v2.13.0 hooks: - # Moves entire sections, I don't like that >:( - # - id: pretty-format-toml - # args: [--autofix] + - id: pretty-format-toml + args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --nosort] - id: pretty-format-yaml args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes, --line-width, "100"] - id: pretty-format-ini From da90159a8bb3b5038cbe590bcf3503af698da0fd Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 13:09:38 -0400 Subject: [PATCH 5/9] Single PR --- .github/renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json b/.github/renovate.json index 6f76bf5..b4bf378 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -3,6 +3,7 @@ "extends": [ "config:recommended" ], + "groupName": "all", "semanticCommits": "disabled", "separateMajorMinor": false, "suppressNotifications": [ From 548e53e951d3e1eb7650eddd45b714d67d88aed4 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 13:11:35 -0400 Subject: [PATCH 6/9] typo --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30cc09c..a2fc04c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: rev: v2.13.0 hooks: - id: pretty-format-toml - args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --nosort] + args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort] - id: pretty-format-yaml args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes, --line-width, "100"] - id: pretty-format-ini From 5ec3c1ab54224a4cb98211dccb186bc3bf5e6c51 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 17:11:42 +0000 Subject: [PATCH 7/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 79 ++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 56c9427..73ef1a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,42 +3,19 @@ # 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 @@ -67,29 +44,44 @@ 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 - - ### 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): - # "", ] +# 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.per-file-ignores] "**/typings/**/*.pyi" = [ "F811", # Re-exports false positives @@ -110,10 +102,9 @@ ignore = [ # 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 @@ -133,12 +124,6 @@ ignore = [ "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] @@ -156,7 +141,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 From a7a46e17c3bb8b653828bbfca79938e7efe05e40 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 13:18:44 -0400 Subject: [PATCH 8/9] pretty-format-toml --- .pre-commit-config.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2fc04c..dbc844e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,8 +12,10 @@ repos: - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks rev: v2.13.0 hooks: - - id: pretty-format-toml - args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort] + # Moves entire sections, I don't like that >:( + # https://github.com/macisamuele/language-formatters-pre-commit-hooks/issues/231 + # - id: pretty-format-toml + # args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort] - id: pretty-format-yaml args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes, --line-width, "100"] - id: pretty-format-ini From ec25706b50f17f922bd002ca97139dce1ca4d886 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 1 Jun 2024 13:20:14 -0400 Subject: [PATCH 9/9] revert pyproject change --- pyproject.toml | 79 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 32 deletions(-) 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