Skip to content

Commit eb5ff59

Browse files
authored
update superlinter (#161)
* update superlinter * Update Super-Linter configuration to refine filter regex and add Ruff config path * Refactor Super-Linter to accommodate API changes * Update Ruff config path in Super-Linter workflow * Fix validation flag for Python Ruff formatting in Super-Linter workflow * Add missing [lint] section in Ruff configuration * Refactor Super-Linter workflow * Ignore undefined-local-with-import-star-usage * Fix / suppress some Python linter warnings * Refactor YAML configuration for consistency and readability * Refactor permissions and enable Perl linting * Validation for Checkov, GitHub Actions, Git leaks, and natural language * Update Python version matrix to include 3.9 and 3.14 * Tidy * Rename job from 'Validate' to 'Lint' for clarity in linting workflow * Improve error handling in file opening for whitespace.py
1 parent 7531fca commit eb5ff59

File tree

13 files changed

+254
-250
lines changed

13 files changed

+254
-250
lines changed

.github/linters/.ruff.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
cache-dir = "/tmp/.ruff_cache"
2-
line-length = 80
3-
2+
line-length = 88
43

4+
[lint]
55
# Allow unused variables when underscore-prefixed.
66
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
7+
# undefined-local-with-import-star-usage
8+
ignore = ["F405"]
79

810
[format]
911
# Like Black, indent with spaces, rather than tabs.
1012
indent-style = "space"
11-
13+
quote-style = "double"
1214
# Like Black, respect magic trailing commas.
1315
skip-magic-trailing-comma = false

.github/linters/.yaml-lint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
extends: default
2+
ignore: |
3+
.venv/
4+
.svn/
5+
rules:
6+
comments:
7+
level: warning
8+
require-starting-space: true
9+
min-spaces-from-content: 1
10+
document-start: disable
11+
indentation:
12+
spaces: 2
13+
indent-sequences: true
14+
line-length: disable
15+
truthy: disable

.github/workflows/lint.yml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,52 @@ on:
1111

1212
concurrency:
1313
group: ${{ github.ref }}
14-
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
14+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1515

1616
permissions: read-all
1717

1818
jobs:
1919
check:
2020
name: Lint
2121
runs-on: ubuntu-latest
22+
timeout-minutes: 10
2223
strategy:
2324
max-parallel: 4
2425
fail-fast: false
2526
matrix:
26-
python-version: ["3.9", "3.10", "3.11", "3.12"]
27+
python-version: ["3.9", "3.12", "3.14"]
2728

2829
permissions:
29-
contents: read
30-
packages: read
31-
statuses: write
30+
contents: read
31+
statuses: write
3232

3333
steps:
3434
- name: Checkout current
3535
uses: actions/checkout@v4
3636
with:
3737
fetch-depth: 0
3838

39-
- name: Super-Linter
40-
uses: super-linter/super-linter/slim@85f7611e0f7b53c8573cca84aa0ed4344f6f6a4d # v7.2.1
39+
- name: Super-Lint
40+
uses: super-linter/super-linter/slim@d5b0a2ab116623730dd094f15ddc1b6b25bf7b99 # v8.3.2
4141
env:
42-
FILTER_REGEX_EXCLUDE: (.*[.]conf.py|pull_request_template.md|/linters/)
42+
# Once the codebase is perfectly linted/formatted, switch to validating only changed files
43+
# VALIDATE_ALL_CODEBASE: false # lint and format new or changed files only
44+
FILTER_REGEX_EXCLUDE: (.*[.]conf.py|pull_request_template.md)
45+
FIX_PYTHON_RUFF_FORMAT: true
46+
FIX_PYTHON_RUFF: true
4347
IGNORE_GITIGNORED_FILES: true
44-
VALIDATE_BASH_EXEC: false
45-
VALIDATE_JAVASCRIPT_STANDARD: false
46-
VALIDATE_JSCPD: false
47-
VALIDATE_MARKDOWN_PRETTIER: false
48-
VALIDATE_PYTHON_FLAKE8: false
49-
VALIDATE_PYTHON_ISORT: false
50-
VALIDATE_PYTHON_MYPY: false
51-
VALIDATE_PYTHON_PYINK: false
52-
VALIDATE_PYTHON_PYLINT: false
53-
VALIDATE_PYTHON_RUFF: false
54-
VALIDATE_SHELL_SHFMT: false
55-
VALIDATE_YAML_PRETTIER: false
56-
VALIDATE_YAML: false
48+
VALIDATE_BASH: true
49+
VALIDATE_CHECKOV: true
50+
VALIDATE_GITHUB_ACTIONS: true
51+
VALIDATE_GIT_LEAKS: true
52+
VALIDATE_GIT_MERGE_CONFLICT_MARKERS: true
53+
VALIDATE_JSON: true
54+
VALIDATE_MARKDOWN: true
55+
VALIDATE_NATURAL_LANGUAGE: true
56+
VALIDATE_PERL: true
57+
VALIDATE_PYTHON_RUFF_FORMAT: true
58+
VALIDATE_PYTHON_RUFF: true
59+
VALIDATE_YAML: true
5760
# To report GitHub Actions status checks
5861
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5962
...

kgo_updates/kgo_update/kgo_update.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,13 @@ def _split_lines(self, text, width):
611611
"q to print all\n\n"
612612
)
613613
with open(script_path, "r") as f:
614-
l = 0
614+
line_count = 0
615615
print_all = False
616616
for line in f:
617617
print(line, end="")
618-
l += 1
619-
if l == 10 and not print_all:
620-
l = 0
618+
line_count += 1
619+
if line_count == 10 and not print_all:
620+
line_count = 0
621621
key = input()
622622
if key.lower() == "q":
623623
print_all = True

lfric_macros/tests/test_apply_macros.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from ..apply_macros import *
6+
from ..apply_macros import * # noqa: F403
77

88
# A macro that we want to find for these tests
99
desired_macro = """class vn00_t001(MacroUpgrade):
@@ -171,11 +171,11 @@ def test_deduplicate_list():
171171

172172

173173
def test_match_python_imports():
174-
assert match_python_import("import z") == True
175-
assert match_python_import("from x import y") == True
176-
assert match_python_import("from a import b.c") == True
177-
assert match_python_import("import m as n") == True
178-
assert match_python_import("false") == False
174+
assert match_python_import("import z")
175+
assert match_python_import("from x import y")
176+
assert match_python_import("from a import b.c")
177+
assert match_python_import("import m as n")
178+
assert not match_python_import("false")
179179

180180

181181
# Remove appsdir

0 commit comments

Comments
 (0)