Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Replace flake8 linting with ruff linting #961

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unix_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
shell: bash -el {0}
run: |
pip install --verbose '.[opt, parallel, test, gui]'
- name: Lint with flake8
- name: Lint with ruff
shell: bash -el {0}
run: |
flake8 --count hnn_core
ruff check hnn_core
- name: Test non-MPI, embarrassingly parallel tests with pytest
shell: bash -el {0}
run: |
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ clean :
check-manifest:
check-manifest

test: flake
test: lint
pytest ./hnn_core/tests/ -m "not uses_mpi" -n auto
pytest ./hnn_core/tests/ -m "uses_mpi"

flake:
@if command -v flake8 > /dev/null; then \
echo "Running flake8"; \
flake8 hnn_core --count; \
lint:
@if command -v ruff > /dev/null; then \
echo "Running ruff check"; \
ruff check hnn_core; \
else \
echo "flake8 not found, please install it!"; \
echo "ruff not found, please install it!"; \
exit 1; \
fi;
@echo "flake8 passed"
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ check-hidden = true
# in jupyter notebooks - images and also some embedded outputs
ignore-regex = '^\s*"image/\S+": ".*|.*%22%3A%20.*'
ignore-words-list = 'tha,nam,sherif,dout'

[tool.ruff]
exclude = ["*.ipynb"]
[tool.ruff.lint]
exclude = ["__init__.py"]
ignore = [
"E722", # E722 is a pycodestyle PEP8 style violation called "bare-except".
# It indicates that the best practice of catching a specific
# Exception, as opposed to any, was not followed. For more details,
# see https://www.flake8rules.com/rules/E722.html
]
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[flake8]
exclude = __init__.py
ignore = E722, W504

[check-manifest]
ignore =
.circleci/*
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def run(self):
extras = {
'opt': ['scikit-learn'],
'parallel': ['joblib', 'psutil'],
'test': ['flake8', 'pytest', 'pytest-cov', 'pytest-xdist'],
'test': ['pytest', 'pytest-cov', 'pytest-xdist', 'ruff'],
'docs': ['mne', 'nibabel', 'pooch', 'tdqm',
'sphinx', 'sphinx-gallery',
'sphinx_bootstrap_theme', 'sphinx-copybutton',
Expand Down
Loading