Skip to content

Commit

Permalink
chore: modernize Ruff config
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Nov 16, 2023
1 parent 70deb39 commit bd01393
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
Expand All @@ -33,12 +36,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- {os: macos-latest, python-version: '3.7'}
- {os: macos-latest, python-version: '3.11'}
- {os: macos-latest, python-version: '3.12'}
- {os: windows-latest, python-version: '3.7'}
- {os: windows-latest, python-version: '3.11'}
- {os: windows-latest, python-version: '3.12'}

steps:
- uses: actions/checkout@v4
Expand All @@ -63,7 +66,7 @@ jobs:
uses: codecov/codecov-action@v3

- name: Test docstrings with doctest
if: "runner.os == 'Linux' && matrix.python-version == 3.11"
if: "runner.os == 'Linux' && matrix.python-version == 3.12"
run: python -m pytest --doctest-modules src/particle --ignore-glob="src/particle/particle/convert.py"

notebooks:
Expand Down
36 changes: 18 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ minversion = "6.0"
testpaths = ["tests"]
junit_family = "xunit2"
log_cli_level = "info"
xfail_strict = true
addopts = [
"--benchmark-disable",
"-ra",
Expand Down Expand Up @@ -144,9 +145,11 @@ messages_control.disable = [


[tool.ruff]
src = ["src"]

[tool.ruff.lint]
select = [
"E", "F", "W", # flake8
"B", "B904", # flake8-bugbear
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
Expand All @@ -164,23 +167,20 @@ select = [
"YTT", # flake8-2020
]
ignore = [
"B905",
"E402",
"E501",
"RUF001", # Ambiguous unicode
"RUF002", # Ambiguous unicode docstring
"PLR", # Design related pylint codes
"PT013", # Importing approx from pytest is fine
]
src = ["src"]
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
"RUF001", # Ambiguous unicode
"RUF002", # Ambiguous unicode docstring
"PLR2004", # Magic value used in comparison
"PLR09", # Too many X
]
isort.required-imports = ["from __future__ import annotations"]
mccabe.max-complexity = 24

[tool.ruff.mccabe]
max-complexity = 24

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"src/particle/__main__.py" = ["T20"]
"tests/**.py" = [
"PT013", # Importing approx from pytest is fine
]


[tool.repo-review]
ignore = ["RTD"]
2 changes: 1 addition & 1 deletion src/particle/particle/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class Particle:
minus_one, converter=_none_or_positive_converter
)
_three_charge: Charge | None = attr.ib(Charge.u, converter=Charge) # charge * 3
I: float | None = attr.ib(none_float, converter=_isospin_converter) # noqa: E741
I: float | None = attr.ib(none_float, converter=_isospin_converter)
# J = attr.ib(None) # Total angular momentum
G = attr.ib(Parity.u, converter=Parity) # Parity: '', +, -, or ?
P = attr.ib(Parity.u, converter=Parity) # Space parity
Expand Down

0 comments on commit bd01393

Please sign in to comment.