Skip to content

Commit

Permalink
Update flake8 rules
Browse files Browse the repository at this point in the history
Ensure flake8 rules are enabled on the CI runner. Use `ruff` to
accelerate flake8 checking. Increase the McCabe max complexity score
from 15 to 30 because `proximal/algorithms/pock_chambolle.py` contains
`pycuda` code.
  • Loading branch information
antonysigma committed Aug 4, 2024
1 parent 2ba692e commit 84dcdb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ jobs:
run: |
sudo apt-get install build-essential
pip install --upgrade uv
uv pip install --system flake8 pytest
echo -e 'ruff\npytest\n' >> requirements.txt
uv pip install --system -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ruff check proximal
- name: Test with pytest
run: |
uv pip install --system .
Expand Down
2 changes: 1 addition & 1 deletion proximal/examples/test_matengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
eng.quit()

# Wait until done
raw_input("Press Enter to continue...")
input("Press Enter to continue...")
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.ruff]
line-length=127

[tool.ruff.lint]
select=["E9", "F63", "F7", "F82", "C90"]

[tool.ruff.lint.mccabe]
max-complexity=30

0 comments on commit 84dcdb2

Please sign in to comment.