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

MAINT: Use flake8 pre-commit hook over pep8speaks #1026

Merged
merged 4 commits into from
Dec 1, 2023

Conversation

ghisvail
Copy link
Collaborator

This PR sets up flake8 with pre-commit and drops pep8speaks.

The latter did let a few pycodestyle errors and warnings pass by, which gives me little trust in the tool for the long term. Instead, let's rely on the official pre-commit hook for flake8 and use the same config used with pep8speaks. It might be worth adding some more checks later (the select option) than just pycodestyle errors (E) and warnings (W).

@ghisvail ghisvail marked this pull request as ready for review November 30, 2023 15:38
@ghisvail
Copy link
Collaborator Author

I fixed the errors and warnings reported:

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

<unknown>:1594: SyntaxWarning: invalid escape sequence '\d'
<unknown>:70: SyntaxWarning: invalid escape sequence '\s'
<unknown>:374: SyntaxWarning: invalid escape sequence '\d'
<unknown>:36: SyntaxWarning: invalid escape sequence '\s'
clinica/iotools/converters/adni_to_bids/adni_utils.py:1594:29: W605 invalid escape sequence '\d'
clinica/iotools/converters/adni_to_bids/adni_utils.py:1594:47: W605 invalid escape sequence '\d'
clinica/iotools/converters/adni_to_bids/adni_utils.py:1606:5: E722 do not use bare 'except'
clinica/iotools/converters/genfi_to_bids/genfi_to_bids_utils.py:110:5: E722 do not use bare 'except'
clinica/iotools/converters/habs_to_bids/habs_to_bids.py:72:23: E226 missing whitespace around arithmetic operator
clinica/iotools/converters/habs_to_bids/habs_to_bids.py:245:35: E226 missing whitespace around arithmetic operator
clinica/iotools/converters/oasis3_to_bids/oasis3_utils.py:117:5: E722 do not use bare 'except'
clinica/iotools/converters/oasis3_to_bids/oasis3_utils.py:126:5: E722 do not use bare 'except'
clinica/iotools/converters/oasis3_to_bids/oasis3_utils.py:171:31: E201 whitespace after '{'
clinica/iotools/converters/oasis3_to_bids/oasis3_utils.py:171:34: E226 missing whitespace around arithmetic operator
clinica/iotools/converters/oasis3_to_bids/oasis3_utils.py:197:27: E226 missing whitespace around arithmetic operator
clinica/pipelines/engine.py:641:48: E226 missing whitespace around arithmetic operator
clinica/pipelines/machine_learning/input.py:42:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
clinica/pipelines/t1_freesurfer_longitudinal/t1_freesurfer_template_pipeline.py:322:17: E124 closing bracket does not match visual indentation
clinica/pipelines/t1_volume_create_dartel/t1_volume_create_dartel_pipeline.py:205:17: E124 closing bracket does not match visual indentation
clinica/pipelines/t1_volume_dartel2mni/t1_volume_dartel2mni_pipeline.py:207:17: E124 closing bracket does not match visual indentation
clinica/utils/freesurfer.py:70:24: W605 invalid escape sequence '\s'
test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py:374:18: W605 invalid escape sequence '\d'
test/unittests/iotools/converters/adni_to_bids/test_adni_utils.py:374:36: W605 invalid escape sequence '\d'
test/unittests/utils/test_nipype.py:36:56: W605 invalid escape sequence '\s'

Copy link
Member

@NicolasGensollen NicolasGensollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @ghisvail !

@ghisvail ghisvail merged commit 9a40c3f into aramis-lab:dev Dec 1, 2023
15 of 17 checks passed
@ghisvail ghisvail deleted the maint/flake8-check branch December 1, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants