From c37643cfa8a672ad33f238f3c1b0f475e0f8ba0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gl=C3=A4=C3=9Fle?= Date: Sat, 28 Dec 2024 02:14:08 +0100 Subject: [PATCH] Replace to flake8 by ruff to fully migrate to pyproject.toml --- .github/workflows/build.yml | 16 +++++++--------- pyproject.toml | 19 ++++++++++++++++++- setup.cfg | 6 ------ 3 files changed, 25 insertions(+), 16 deletions(-) delete mode 100644 setup.cfg diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c66ce98..5a93cd27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,17 +4,15 @@ on: pull_request: jobs: - # Quickly check with flake8 without having to go through the whole build: - flake8: - name: "Fast flake8" + # Quickly check with ruff without having to go through the whole build: + ruff: + name: "Fast lint" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # Check on lowest supported python version to catch syntax errors: - uses: actions/setup-python@v5 - with: { python-version: "3.7" } - - run: pip install flake8 - - run: flake8 + - run: pip install ruff + - run: ruff check src build_linux: name: "Build: Linux (x64)" @@ -323,9 +321,9 @@ jobs: pip install cpymad -f dist --no-index --no-deps pip install cpymad - - run: pip install flake8 twine coverage coveralls pytest + - run: pip install ruff twine coverage coveralls pytest - run: twine check dist/* - - run: flake8 + - run: ruff check src - run: coverage run --source=cpymad -p -m pytest -v -k "not dframe" - run: pip install pandas diff --git a/pyproject.toml b/pyproject.toml index 85cae34c..94809f0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ optional-dependencies.doc = [ ] optional-dependencies.dev = [ "cython", - "flake8", + "ruff", "pytest", ] @@ -78,3 +78,20 @@ paths.source = [ "*/site-packages/cpymad-*.egg/cpymad", "*/site-packages/cpymad/", ] + +[tool.ruff] +line-length = 84 +lint.ignore = [ + "E701", + "E731", + "E741", +] +exclude = [ + ".git", + "__pycache__", + "doc/conf.py", + "build", + "dist", + ".eggs", + "src/MAD-X", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4710dd2e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[flake8] -# codes: https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes -# default: ignore = E121,E123,E126,E133,E226,E241,E242,E704,W503,W504,W505 -ignore = E126,E221,E226,E241,E272,E306,E701,E731,E741,W503,W504 -exclude = .git,__pycache__,doc/conf.py,build,dist,.eggs -max-line-length = 84