From db3cf56e7606fe2cb2e8da95a484aa8e46c5f728 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 22 Jan 2026 11:37:58 +0000 Subject: [PATCH 01/32] add ruff action to pipeline --- .github/workflows/ruff-lint.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/workflows/ruff-lint.yaml diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml new file mode 100644 index 0000000..3a66f0e --- /dev/null +++ b/.github/workflows/ruff-lint.yaml @@ -0,0 +1,9 @@ +name: Ruff linter +on: + pull_request_target: + +jobs: + name: Run Ruff Linter + uses: astral-sh/ruff-action@v3 + with: + version: "Latest" From 7fc3348b521724c4cd618acab9db907d7bdde45d Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 22 Jan 2026 11:49:37 +0000 Subject: [PATCH 02/32] Convert pylint.rc to ruff.toml --- Utilities/pylint.rc | 235 -------------------------------------------- ruff.toml | 87 ++++++++++++++++ 2 files changed, 87 insertions(+), 235 deletions(-) delete mode 100644 Utilities/pylint.rc create mode 100644 ruff.toml diff --git a/Utilities/pylint.rc b/Utilities/pylint.rc deleted file mode 100644 index 14ac4d8..0000000 --- a/Utilities/pylint.rc +++ /dev/null @@ -1,235 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add to the black list. It should be a base name, not a -# path. You may set this option multiple times. -ignore=CVS - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time. -disable=R0201,R0401,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0923,F0401 - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Include message's id in output -include-ids=no - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (R0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (R0004). -comment=no - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching names used for dummy variables (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. -generated-members=REQUEST,acl_users,aq_parent - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__ - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..49df32d --- /dev/null +++ b/ruff.toml @@ -0,0 +1,87 @@ +# Ruff configuration file +# Converted from Utilities/pylint.rc + +# Line length +line-length = 80 + +# Exclude patterns +extend-exclude = ["CVS"] + +[lint] +# Enable all rules by default, then selectively disable +select = ["ALL"] + +# Disable rules equivalent to pylint disabled checks +ignore = [ + # R0201: Method could be a function (no-self-use) + "PLR6301", + # R0401: Cyclic import + "PLC0415", + # R0801: Similar lines in files (duplicate-code) + "PLC0414", + # R0901: Too many ancestors + "PLR0901", + # R0902: Too many instance attributes + "PLR0902", + # R0903: Too few public methods + "PLR0903", + # R0904: Too many public methods + "PLR0904", + # R0911: Too many return statements + "PLR0911", + # R0912: Too many branches + "PLR0912", + # R0913: Too many arguments + "PLR0913", + # R0914: Too many local variables + "PLR0914", + # R0915: Too many statements + "PLR0915", + # F0401: Unable to import + "F401", +] + +[lint.pylint] +# Design settings +max-args = 5 +max-locals = 15 +max-returns = 6 +max-branches = 12 +max-statements = 50 +max-parents = 7 +max-attributes = 7 +max-public-methods = 20 + +[lint.pep8-naming] +# Naming conventions (from BASIC section) +# Allow standard variable names +extend-ignore-names = ["i", "j", "k", "ex", "Run", "_"] + +[lint.flake8-builtins] +# Bad function names (equivalent to bad-functions in pylint) +builtins-ignorelist = ["map", "filter", "apply", "input", "id"] + +[lint.flake8-annotations] +# Allow untyped definitions (similar to pylint's less strict typing) +allow-star-arg-any = true + +[lint.flake8-import-conventions] +# Deprecated modules (from IMPORTS section) +banned-from = ["regsub", "string", "TERMIOS", "Bastion", "rexec"] + +[lint.flake8-todo] +# Note tags to detect (from MISCELLANEOUS section) +# Ruff detects TODO, FIXME, XXX by default with FIX rules + +[lint.pycodestyle] +# Maximum line length +max-line-length = 80 +max-doc-length = 80 + +[lint.pydocstyle] +# Documentation style +convention = "google" + +[lint.isort] +# Import sorting +known-first-party = [] From 1b9a48f42e37147e619ed14910e676cc66b2de9d Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:48:18 +0000 Subject: [PATCH 03/32] Update linting action --- .github/workflows/ruff-lint.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 3a66f0e..503dc38 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -3,7 +3,9 @@ on: pull_request_target: jobs: - name: Run Ruff Linter - uses: astral-sh/ruff-action@v3 - with: - version: "Latest" + runs-on: ubuntu-latest + steps: + name: Run Ruff Linter + uses: astral-sh/ruff-action@v3 + with: + version: latest From d342bc09a9e090858234082d99a054833f7c8e40 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:49:44 +0000 Subject: [PATCH 04/32] second attempt at updating linting action --- .github/workflows/ruff-lint.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 503dc38..a6952db 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -3,9 +3,10 @@ on: pull_request_target: jobs: - runs-on: ubuntu-latest - steps: - name: Run Ruff Linter - uses: astral-sh/ruff-action@v3 - with: - version: latest + lint: + runs-on: ubuntu-latest + steps: + - name: Run Ruff Linter + uses: astral-sh/ruff-action@v3 + with: + version: latest From d3a4cc68eb96fc3a0ef1efa077a606bc60c57105 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:51:12 +0000 Subject: [PATCH 05/32] third attempt at updating linting action --- .github/workflows/ruff-lint.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index a6952db..5f049c8 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -4,9 +4,8 @@ on: jobs: lint: - runs-on: ubuntu-latest steps: - name: Run Ruff Linter uses: astral-sh/ruff-action@v3 with: - version: latest + version: latest From 255040a34d1be0d1f4d2e6828641063cfd676f19 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:51:53 +0000 Subject: [PATCH 06/32] forth attempt at updating linting action --- .github/workflows/ruff-lint.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 5f049c8..41c6a57 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -1,10 +1,13 @@ name: Ruff linter on: - pull_request_target: + pull_request: jobs: lint: + runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Run Ruff Linter uses: astral-sh/ruff-action@v3 with: From 1f18322e7b51eb3dee1f9580b61ac0398c32ffc8 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:55:32 +0000 Subject: [PATCH 07/32] Add workflow dispatch --- .github/workflows/ruff-lint.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 41c6a57..56fa66c 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -1,6 +1,7 @@ name: Ruff linter on: pull_request: + workflow_dispatch: jobs: lint: From 0c5f78418cca5441f34c63f580e987cd52c63473 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:57:34 +0000 Subject: [PATCH 08/32] Add push trigger --- .github/workflows/ruff-lint.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 56fa66c..fd3b379 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -1,6 +1,7 @@ name: Ruff linter on: pull_request: + push: workflow_dispatch: jobs: From e4b4aff245a23768c4e03e4bba48dadb94ae540d Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:01:32 +0000 Subject: [PATCH 09/32] Update toml file --- ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index 49df32d..cdbefe4 100644 --- a/ruff.toml +++ b/ruff.toml @@ -69,7 +69,7 @@ allow-star-arg-any = true # Deprecated modules (from IMPORTS section) banned-from = ["regsub", "string", "TERMIOS", "Bastion", "rexec"] -[lint.flake8-todo] +[lint.flake8-todos] # Note tags to detect (from MISCELLANEOUS section) # Ruff detects TODO, FIXME, XXX by default with FIX rules From fabd2ff4ba5369e25ee309786f2965f49391a7d0 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:02:36 +0000 Subject: [PATCH 10/32] Remove flake8 todos --- ruff.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ruff.toml b/ruff.toml index cdbefe4..df28aa0 100644 --- a/ruff.toml +++ b/ruff.toml @@ -69,10 +69,6 @@ allow-star-arg-any = true # Deprecated modules (from IMPORTS section) banned-from = ["regsub", "string", "TERMIOS", "Bastion", "rexec"] -[lint.flake8-todos] -# Note tags to detect (from MISCELLANEOUS section) -# Ruff detects TODO, FIXME, XXX by default with FIX rules - [lint.pycodestyle] # Maximum line length max-line-length = 80 From 68368cda3fc7c2302fcf07d9f8aea29f8d91ee13 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:04:14 +0000 Subject: [PATCH 11/32] Remove redundant ruff rules --- ruff.toml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ruff.toml b/ruff.toml index df28aa0..62798ff 100644 --- a/ruff.toml +++ b/ruff.toml @@ -15,10 +15,8 @@ select = ["ALL"] ignore = [ # R0201: Method could be a function (no-self-use) "PLR6301", - # R0401: Cyclic import - "PLC0415", - # R0801: Similar lines in files (duplicate-code) - "PLC0414", + # R0401: Cyclic import - remove PLC0415, use import rules if needed + # R0801: Duplicate code - Ruff has no direct equivalent # R0901: Too many ancestors "PLR0901", # R0902: Too many instance attributes @@ -37,8 +35,8 @@ ignore = [ "PLR0914", # R0915: Too many statements "PLR0915", - # F0401: Unable to import - "F401", + # Unused imports (if you want to allow them) + # "F401", ] [lint.pylint] From 351f8d721c5f2c120e66b06feebcce77b7b62961 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:05:00 +0000 Subject: [PATCH 12/32] Remove more redundant ruff rules --- ruff.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ruff.toml b/ruff.toml index 62798ff..6b0eaa4 100644 --- a/ruff.toml +++ b/ruff.toml @@ -17,8 +17,6 @@ ignore = [ "PLR6301", # R0401: Cyclic import - remove PLC0415, use import rules if needed # R0801: Duplicate code - Ruff has no direct equivalent - # R0901: Too many ancestors - "PLR0901", # R0902: Too many instance attributes "PLR0902", # R0903: Too few public methods From 68d878ff0259f15a13dd9d102f9edf2276b8ea89 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:07:26 +0000 Subject: [PATCH 13/32] Refactor ruff.toml --- ruff.toml | 94 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 36 deletions(-) diff --git a/ruff.toml b/ruff.toml index 6b0eaa4..37dbadf 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,44 +1,68 @@ # Ruff configuration file -# Converted from Utilities/pylint.rc +# Converted (and cleaned) from Utilities/pylint.rc -# Line length +# Line length (applies to formatter and some linters) line-length = 80 # Exclude patterns extend-exclude = ["CVS"] [lint] -# Enable all rules by default, then selectively disable -select = ["ALL"] +# Enable common rule families explicitly, rather than "ALL" +# E,F,W: pycodestyle/pyflakes; I: isort; N: naming; D: pydocstyle +# UP: pyupgrade; B: bugbear; A: builtins; COM: commas; C4: comprehensions +# SIM: simplify; PL: pylint-like checks; PTH: pathlib; RUF: ruff-specific +select = [ + "E", "F", "W", "I", "N", "D", + "UP", "B", "A", "COM", "C4", "SIM", + "PL", "PTH", "RUF", +] -# Disable rules equivalent to pylint disabled checks +# Disable rules equivalent to the previously disabled pylint checks +# (Only those actually supported by Ruff.) ignore = [ - # R0201: Method could be a function (no-self-use) - "PLR6301", - # R0401: Cyclic import - remove PLC0415, use import rules if needed - # R0801: Duplicate code - Ruff has no direct equivalent - # R0902: Too many instance attributes - "PLR0902", - # R0903: Too few public methods - "PLR0903", - # R0904: Too many public methods - "PLR0904", - # R0911: Too many return statements - "PLR0911", - # R0912: Too many branches - "PLR0912", - # R0913: Too many arguments - "PLR0913", - # R0914: Too many local variables - "PLR0914", - # R0915: Too many statements - "PLR0915", - # Unused imports (if you want to allow them) - # "F401", + # R0201: Method could be a function (no-self-use) + "PLR6301", + + # NOTE: Pylint's R0401 (cyclic-import) is NOT implemented by Ruff. + # No ignore needed; leaving a comment for awareness. + + # NOTE: Pylint's R0801 (duplicate-code) is NOT implemented by Ruff. + # No ignore needed. + + # R0901: Too many ancestors + "PLR0901", + # R0902: Too many instance attributes + "PLR0902", + # R0903: Too few public methods + "PLR0903", + # R0904: Too many public methods + "PLR0904", + # R0911: Too many return statements + "PLR0911", + # R0912: Too many branches + "PLR0912", + # R0913: Too many arguments + "PLR0913", + # R0914: Too many local variables + "PLR0914", + # R0915: Too many statements + "PLR0915", + + # F401: Unused import (comment fixed; this is *unused*, not "unable to import") + "F401", + + # NOTE: The earlier "PLC0415" / "PLC0414" likely referred to + # Pylint C0415 (import-outside-toplevel) / C0414 (useless-import-alias), + # which map to Ruff rules: + # - C0415 -> "PLC0415" (supported) + # - C0414 -> handled by Ruff's `E`/`I`/`RUF` in different ways. + # If you still want to ignore import-outside-toplevel, uncomment below: + # "PLC0415", ] [lint.pylint] -# Design settings +# Design settings (Pylint-style thresholds) max-args = 5 max-locals = 15 max-returns = 6 @@ -49,24 +73,22 @@ max-attributes = 7 max-public-methods = 20 [lint.pep8-naming] -# Naming conventions (from BASIC section) -# Allow standard variable names +# Naming conventions (allow common short names) extend-ignore-names = ["i", "j", "k", "ex", "Run", "_"] [lint.flake8-builtins] -# Bad function names (equivalent to bad-functions in pylint) +# Avoid shadowing builtins; ignore these names if used builtins-ignorelist = ["map", "filter", "apply", "input", "id"] [lint.flake8-annotations] -# Allow untyped definitions (similar to pylint's less strict typing) +# Allow *args/**kwargs to be any-typed allow-star-arg-any = true -[lint.flake8-import-conventions] -# Deprecated modules (from IMPORTS section) -banned-from = ["regsub", "string", "TERMIOS", "Bastion", "rexec"] +# NOTE: Ruff does not support flake8-import-conventions' "banned-from" option. +# If you want to ban modules, consider flake8-tidy-imports (TID) rules in Ruff instead. [lint.pycodestyle] -# Maximum line length +# Maximum line/doc length (pycodestyle & pydocstyle) max-line-length = 80 max-doc-length = 80 From 6ae3afe4b0f648c3f9ca1046fdbd690bb6bc601f Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Fri, 6 Mar 2026 09:42:41 +0000 Subject: [PATCH 14/32] Implement working ruff skeleton with no rules. --- .github/workflows/ruff-lint.yaml | 2 - ruff.toml | 102 +------------------------------ 2 files changed, 2 insertions(+), 102 deletions(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index fd3b379..41c6a57 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -1,8 +1,6 @@ name: Ruff linter on: pull_request: - push: - workflow_dispatch: jobs: lint: diff --git a/ruff.toml b/ruff.toml index 37dbadf..0665b93 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,101 +1,3 @@ -# Ruff configuration file -# Converted (and cleaned) from Utilities/pylint.rc - -# Line length (applies to formatter and some linters) -line-length = 80 - -# Exclude patterns -extend-exclude = ["CVS"] - [lint] -# Enable common rule families explicitly, rather than "ALL" -# E,F,W: pycodestyle/pyflakes; I: isort; N: naming; D: pydocstyle -# UP: pyupgrade; B: bugbear; A: builtins; COM: commas; C4: comprehensions -# SIM: simplify; PL: pylint-like checks; PTH: pathlib; RUF: ruff-specific -select = [ - "E", "F", "W", "I", "N", "D", - "UP", "B", "A", "COM", "C4", "SIM", - "PL", "PTH", "RUF", -] - -# Disable rules equivalent to the previously disabled pylint checks -# (Only those actually supported by Ruff.) -ignore = [ - # R0201: Method could be a function (no-self-use) - "PLR6301", - - # NOTE: Pylint's R0401 (cyclic-import) is NOT implemented by Ruff. - # No ignore needed; leaving a comment for awareness. - - # NOTE: Pylint's R0801 (duplicate-code) is NOT implemented by Ruff. - # No ignore needed. - - # R0901: Too many ancestors - "PLR0901", - # R0902: Too many instance attributes - "PLR0902", - # R0903: Too few public methods - "PLR0903", - # R0904: Too many public methods - "PLR0904", - # R0911: Too many return statements - "PLR0911", - # R0912: Too many branches - "PLR0912", - # R0913: Too many arguments - "PLR0913", - # R0914: Too many local variables - "PLR0914", - # R0915: Too many statements - "PLR0915", - - # F401: Unused import (comment fixed; this is *unused*, not "unable to import") - "F401", - - # NOTE: The earlier "PLC0415" / "PLC0414" likely referred to - # Pylint C0415 (import-outside-toplevel) / C0414 (useless-import-alias), - # which map to Ruff rules: - # - C0415 -> "PLC0415" (supported) - # - C0414 -> handled by Ruff's `E`/`I`/`RUF` in different ways. - # If you still want to ignore import-outside-toplevel, uncomment below: - # "PLC0415", -] - -[lint.pylint] -# Design settings (Pylint-style thresholds) -max-args = 5 -max-locals = 15 -max-returns = 6 -max-branches = 12 -max-statements = 50 -max-parents = 7 -max-attributes = 7 -max-public-methods = 20 - -[lint.pep8-naming] -# Naming conventions (allow common short names) -extend-ignore-names = ["i", "j", "k", "ex", "Run", "_"] - -[lint.flake8-builtins] -# Avoid shadowing builtins; ignore these names if used -builtins-ignorelist = ["map", "filter", "apply", "input", "id"] - -[lint.flake8-annotations] -# Allow *args/**kwargs to be any-typed -allow-star-arg-any = true - -# NOTE: Ruff does not support flake8-import-conventions' "banned-from" option. -# If you want to ban modules, consider flake8-tidy-imports (TID) rules in Ruff instead. - -[lint.pycodestyle] -# Maximum line/doc length (pycodestyle & pydocstyle) -max-line-length = 80 -max-doc-length = 80 - -[lint.pydocstyle] -# Documentation style -convention = "google" - -[lint.isort] -# Import sorting -known-first-party = [] +select=[] +ignore=[] From 11b8946cc07f7ff74f5ff5ec5c7f67461c4380ab Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 7 May 2026 16:08:54 +0100 Subject: [PATCH 15/32] Add ruff toml file --- .github/linters/.ruff.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/linters/.ruff.toml diff --git a/.github/linters/.ruff.toml b/.github/linters/.ruff.toml new file mode 100644 index 0000000..9cb5f66 --- /dev/null +++ b/.github/linters/.ruff.toml @@ -0,0 +1,16 @@ +cache-dir = "/tmp/.ruff_cache" +line-length = 88 +output-format = "grouped" + +[lint] +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +# undefined-local-with-import-star-usage +ignore = ["F405"] + +[format] +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" +quote-style = "double" +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false From 1c5c08782d2e78f0cc6fea33f6ab23ddbe34f19e Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:57:01 +0100 Subject: [PATCH 16/32] Add basic line formatting to ruff.toml --- ruff.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ruff.toml b/ruff.toml index 0665b93..23b1f7c 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,3 +1,12 @@ +line-length = 80 +indent-width = 4 + [lint] select=[] ignore=[] + +[format] +quote-style = "double" +indent-style = "space" +line-ending = "auto" +docstring-code-format = false From 0fc9ebe203f2f4c350be231a238c085d6bfe69ff Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 23 Jun 2026 15:03:01 +0100 Subject: [PATCH 17/32] Adding rulesets to mitigate previous development errors I've made --- ruff.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruff.toml b/ruff.toml index 23b1f7c..91e0dab 100644 --- a/ruff.toml +++ b/ruff.toml @@ -2,11 +2,11 @@ line-length = 80 indent-width = 4 [lint] -select=[] +select=["A","CPY"] ignore=[] [format] quote-style = "double" indent-style = "space" line-ending = "auto" -docstring-code-format = false +docstring-code-format = false From 6f5354ae82d6755e87d578c78a287f4f63637dc8 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Wed, 24 Jun 2026 09:03:41 +0100 Subject: [PATCH 18/32] remove line ending ruleset --- ruff.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index 91e0dab..8db92a0 100644 --- a/ruff.toml +++ b/ruff.toml @@ -8,5 +8,4 @@ ignore=[] [format] quote-style = "double" indent-style = "space" -line-ending = "auto" docstring-code-format = false From 2033d07a57d309e1e0d2dccfb5936e04b06f3e30 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Wed, 24 Jun 2026 09:10:24 +0100 Subject: [PATCH 19/32] change ruff linter version --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 41c6a57..a43a98c 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: astral-sh/ruff-action@v3 + uses: astral-sh/ruff-action@v4 with: version: latest From f1d2595200ccbee216d93aa2d8ca96a8f9c2ff38 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Wed, 24 Jun 2026 09:21:57 +0100 Subject: [PATCH 20/32] Switch to growss linting action --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index a43a98c..d1ca1e9 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: astral-sh/ruff-action@v4 + uses: MetOffice/growss/.github/workflows/python-lint.yaml@main with: version: latest From 9509b0282ea9170c169ec5c0d78af940119a6f06 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Wed, 24 Jun 2026 10:16:43 +0100 Subject: [PATCH 21/32] Add pylinting checks --- .github/linters/.ruff.toml | 16 ---------------- ruff.toml => .github/ruff.toml | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 .github/linters/.ruff.toml rename ruff.toml => .github/ruff.toml (63%) diff --git a/.github/linters/.ruff.toml b/.github/linters/.ruff.toml deleted file mode 100644 index 9cb5f66..0000000 --- a/.github/linters/.ruff.toml +++ /dev/null @@ -1,16 +0,0 @@ -cache-dir = "/tmp/.ruff_cache" -line-length = 88 -output-format = "grouped" - -[lint] -# Allow unused variables when underscore-prefixed. -dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -# undefined-local-with-import-star-usage -ignore = ["F405"] - -[format] -# Like Black, indent with spaces, rather than tabs. -indent-style = "space" -quote-style = "double" -# Like Black, respect magic trailing commas. -skip-magic-trailing-comma = false diff --git a/ruff.toml b/.github/ruff.toml similarity index 63% rename from ruff.toml rename to .github/ruff.toml index 8db92a0..d0fd941 100644 --- a/ruff.toml +++ b/.github/ruff.toml @@ -2,7 +2,7 @@ line-length = 80 indent-width = 4 [lint] -select=["A","CPY"] +select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915"] ignore=[] [format] From e149c914dd9951ff74634eb31f060e97d558cebc Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Wed, 24 Jun 2026 10:18:42 +0100 Subject: [PATCH 22/32] Add NotImplementedError --- .github/ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ruff.toml b/.github/ruff.toml index d0fd941..509fdab 100644 --- a/.github/ruff.toml +++ b/.github/ruff.toml @@ -2,7 +2,7 @@ line-length = 80 indent-width = 4 [lint] -select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915"] +select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901"] ignore=[] [format] From 16cebe8f5fae1b15919e90ad6094891a303d9fd9 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 09:53:34 +0100 Subject: [PATCH 23/32] Add duplicate code checks --- .github/ruff.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ruff.toml b/.github/ruff.toml index 509fdab..52eb424 100644 --- a/.github/ruff.toml +++ b/.github/ruff.toml @@ -2,7 +2,8 @@ line-length = 80 indent-width = 4 [lint] -select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901"] +select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", +"B014","B025","B025","B033","PIE794","PYI016","PYI062","PT014","SIM101","PLE0241","RUF068"] ignore=[] [format] From 073e3f9726fdb5120544baf30a4ca88bc4ab44c3 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:02:02 +0100 Subject: [PATCH 24/32] Add checks for FIXME,TODO,XXX and HACK --- .github/ruff.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ruff.toml b/.github/ruff.toml index 52eb424..624b26e 100644 --- a/.github/ruff.toml +++ b/.github/ruff.toml @@ -3,7 +3,8 @@ indent-width = 4 [lint] select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", -"B014","B025","B025","B033","PIE794","PYI016","PYI062","PT014","SIM101","PLE0241","RUF068"] +"B014","B025","B025","B033","PIE794","PYI016","PYI062","PT014","SIM101","PLE0241","RUF068", +"FIX"] ignore=[] [format] From 0097f3c0f626bbdf6bb799459ef191b48009ebae Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:17:30 +0100 Subject: [PATCH 25/32] Add pinned ruff action for testing --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index d1ca1e9..4a2a31e 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: MetOffice/growss/.github/workflows/python-lint.yaml@main + uses: astral-sh/ruff-action@v0ce1b0bf8b818ef400413f810f8a11cdbda0034b with: version: latest From eea5ce768fcab5e525b3aec8fa804946e68db860 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:18:35 +0100 Subject: [PATCH 26/32] Add version number to ruff action --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 4a2a31e..9fdfd6b 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: astral-sh/ruff-action@v0ce1b0bf8b818ef400413f810f8a11cdbda0034b + uses: astral-sh/ruff-action@v4.0 with: version: latest From d82cd3dd5f0703e2a1f7e989f9554486fb0456e2 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:20:22 +0100 Subject: [PATCH 27/32] fix versioning syntax --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index 9fdfd6b..ce16267 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: astral-sh/ruff-action@v4.0 + uses: astral-sh/ruff-action@v4.0.0 with: version: latest From 41d0213c13475e9c692dbb357da6d4117344c614 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:22:46 +0100 Subject: [PATCH 28/32] fix PLR0904 rule --- .github/ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ruff.toml b/.github/ruff.toml index 624b26e..10b303f 100644 --- a/.github/ruff.toml +++ b/.github/ruff.toml @@ -2,7 +2,7 @@ line-length = 80 indent-width = 4 [lint] -select=["A","CPY","PLR904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", +select=["A","CPY","PLR0904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", "B014","B025","B025","B033","PIE794","PYI016","PYI062","PT014","SIM101","PLE0241","RUF068", "FIX"] ignore=[] From 1ddc2dbba301b3bfc434cb035cb51ea0c7ae7bb1 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:02:21 +0100 Subject: [PATCH 29/32] Move ruff.toml --- .github/ruff.toml => ruff.toml | 1 + 1 file changed, 1 insertion(+) rename .github/ruff.toml => ruff.toml (95%) diff --git a/.github/ruff.toml b/ruff.toml similarity index 95% rename from .github/ruff.toml rename to ruff.toml index 10b303f..278fb42 100644 --- a/.github/ruff.toml +++ b/ruff.toml @@ -1,5 +1,6 @@ line-length = 80 indent-width = 4 +preview = true [lint] select=["A","CPY","PLR0904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", From 50b72be26b8c56976264e34adffca206a944ad3b Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:26:06 +0100 Subject: [PATCH 30/32] Update version SHA --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index ce16267..c7768c0 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -9,6 +9,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Run Ruff Linter - uses: astral-sh/ruff-action@v4.0.0 + uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0 with: version: latest From d05304c3611b1384f560e863fe58f723fa0d31c3 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:41:19 +0100 Subject: [PATCH 31/32] Add no-self-use rule --- .github/ruff.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/ruff.toml diff --git a/.github/ruff.toml b/.github/ruff.toml new file mode 100644 index 0000000..9fc7b81 --- /dev/null +++ b/.github/ruff.toml @@ -0,0 +1,14 @@ +line-length = 80 +indent-width = 4 +preview = true + +[lint] +select=["A","CPY","PLR0904","PLR0911","PLR0912","PLR0913","PLR0914","PLR0915","F901", +"B014","B025","B025","B033","PIE794","PYI016","PYI062","PT014","SIM101","PLE0241","RUF068", +"FIX","PLR6301"] +ignore=[] + +[format] +quote-style = "double" +indent-style = "space" +docstring-code-format = false From 27f43b996c9a1b094e3580234f5989467cc0bbe5 Mon Sep 17 00:00:00 2001 From: Pierre Siddall <43399998+Pierre-siddall@users.noreply.github.com> Date: Tue, 30 Jun 2026 10:19:52 +0100 Subject: [PATCH 32/32] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/ruff-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yaml b/.github/workflows/ruff-lint.yaml index c7768c0..c8d8c01 100644 --- a/.github/workflows/ruff-lint.yaml +++ b/.github/workflows/ruff-lint.yaml @@ -4,7 +4,7 @@ on: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@v4