Update linting rules and workflow

This commit is contained in:
Veronica Berglyd Olsen
2025-04-07 16:52:02 +02:00
parent a760b22341
commit dab48d43a5
3 changed files with 46 additions and 21 deletions
+6 -2
View File
@@ -23,11 +23,15 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Dependencies - name: Install Dependencies
run: pip install -r requirements.txt -r requirements-dev.txt run: pip install -r requirements.txt -r requirements-dev.txt
- name: Run Ruff - name: Ruff Check
run: | run: |
ruff --version ruff --version
ruff check ruff check
- name: Run Pyright - name: Pyright Check
run: | run: |
pyright --version pyright --version
pyright pyright
- name: Isort Check
run: |
isort --version
isort --check .
+39 -18
View File
@@ -60,30 +60,48 @@ line-length = 99
[tool.ruff.lint] [tool.ruff.lint]
preview = true preview = true
# Rules: https://docs.astral.sh/ruff/rules
select = [ select = [
"A", # flake8-builtins (A) "A", # flake8-builtins (A)
"B", # flake8-bugbear (B) "ANN", # flake8-annotations (ANN)
"E", # pycodestyle (E) "B", # flake8-bugbear (B)
"F", # Pyflakes (F) "E", # pycodestyle (E)
"W", # pycodestyle (W) "F", # Pyflakes (F)
"UP", # pyupgrade (UP) "FA", # flake8-future-annotations (FA)
"ANN", # flake8-annotations (ANN) "PERF", # Perflint (PERF)
"PLE", # Pylint Error (PLE) "PLC", # Pylint Convention (PLC)
"FA", # flake8-future-annotations (FA) "PLE", # Pylint Error (PLE)
"PLW", # Pylint Warning (PLW)
"Q", # flake8-quotes (Q)
"RUF", # Ruff-specific rules (RUF)
"SLF", # flake8-self (SLF)
"SLOT", # flake8-slots (SLOT)
"TC", # flake8-type-checking (TC)
"UP", # pyupgrade (UP)
"W", # pycodestyle (W)
] ]
ignore = [ ignore = [
"E221", # multiple-spaces-before-operator "ANN401", # any-type
"E226", # missing-whitespace-around-arithmetic-operator "E221", # multiple-spaces-before-operator
"E228", # missing-whitespace-around-modulo-operator "E226", # missing-whitespace-around-arithmetic-operator
"E241", # multiple-spaces-after-comma "E228", # missing-whitespace-around-modulo-operator
"E272", # multiple-spaces-before-keyword "E241", # multiple-spaces-after-comma
"ANN401", # any-type "E272", # multiple-spaces-before-keyword
"UP015", # redundant-open-modes "PLC0415", # import-outside-top-level
"UP030", # format-literals "PLC1901", # compare-to-empty-string
"PLW0108", # unnecessary-lambda
"PLW2901", # redefined-loop-name
"RUF001", # ambiguous-unicode-character-string
"RUF002", # ambiguous-unicode-character-docstring
"RUF015", # unnecessary-iterable-allocation-for-first-element
"UP015", # redundant-open-modes
"UP030", # format-literals
] ]
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"tests/*" = ["ANN"] "tests/*" = ["ANN", "SLF", "TC", "PLC2701"]
"utils/*" = ["ANN", "SLF", "TC"]
[tool.ruff.format] [tool.ruff.format]
quote-style = "double" quote-style = "double"
@@ -111,3 +129,6 @@ branch = false
[tool.coverage.report] [tool.coverage.report]
precision = 2 precision = 2
exclude_also = [
"if TYPE_CHECKING:"
]
+1 -1
View File
@@ -1,3 +1,3 @@
ruff
isort isort
pyright pyright
ruff