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

[FIX] Flake8 latest release raises error and includes backwards incompatilble change #3420

Closed
wants to merge 3 commits into from

Conversation

ymzayek
Copy link
Member

@ymzayek ymzayek commented Nov 24, 2022

Closes #3431. Flake8 just released a new version that raises a PEP8 failure in our CI check. Also the --diff option is now removed so we have to handle differently how we pipe changes for flake8 to check.
See: https://flake8.pycqa.org/en/latest/release-notes/6.0.0.html#backwards-incompatible-changes

@github-actions
Copy link
Contributor

👋 @ymzayek Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention "Closes #XXXX"
  • Code is PEP8-compliant.
  • (Bug fixes) There is at least one test that would fail under the original bug conditions.
  • (New features) There is at least one unit test per new function / class.
  • (New features) The new feature is demoed in at least one relevant example.

We will review it as quick as possible, feel free to ping us with questions if needed.

@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Merging #3420 (781af0b) into main (109f4a6) will decrease coverage by 0.21%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3420      +/-   ##
==========================================
- Coverage   90.93%   90.72%   -0.22%     
==========================================
  Files         133      128       -5     
  Lines       15399    15003     -396     
  Branches     3123     3074      -49     
==========================================
- Hits        14003    13611     -392     
+ Misses        825      822       -3     
+ Partials      571      570       -1     
Impacted Files Coverage Δ
...ces/fmriprep/tests/test_load_confounds_strategy.py
...rfaces/fmriprep/tests/test_load_confounds_utils.py
nilearn/interfaces/fmriprep/tests/utils.py
...n/interfaces/fmriprep/tests/test_load_confounds.py
...rfaces/fmriprep/tests/test_load_confounds_scrub.py

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bthirion
Copy link
Member

There is still a flake8 error due to --diff option.

@ymzayek
Copy link
Member Author

ymzayek commented Nov 24, 2022

Yes, sorry I haven't had time to look into it. I will change this to a draft until it's ready.

@ymzayek ymzayek marked this pull request as draft November 24, 2022 17:06
@ymzayek
Copy link
Member Author

ymzayek commented Nov 25, 2022

I changed the flake8 --diff command to what is suggested on this thread: PyCQA/flake8#1760
The problem now is that flake8 will be run on entire changed files instead of just the diff. Do we want this? If we implement automatic formatting discussed in #2528, then it won't be a problem. But I'm just worried the transition will be painful. Any alternative suggestions welcome.

@ymzayek ymzayek marked this pull request as ready for review November 25, 2022 13:23
@jeromedockes
Copy link
Member

jeromedockes commented Nov 25, 2022 via email

@ymzayek
Copy link
Member Author

ymzayek commented Nov 25, 2022

Yes agreed. I will stall this then

@ymzayek ymzayek added the Stalled This issue is currently stalled and has no recent activity. Use this label before closing due to ina label Nov 25, 2022
@ymzayek
Copy link
Member Author

ymzayek commented Nov 30, 2022

BTW a short term solution here can be just to use a previous version of flake8 in our PEP8 check. Any opinions on that?

@bthirion
Copy link
Member

rather -1 on my side. Rather use up-to-date tools.

# The --diff argument has been removed from flake8:
# https://github.com/PyCQA/flake8/issues/1760
# Now flake8 will be run on entire files but only files that have been changed.
git diff $COMMIT --name-only -z --diff-filter=d -- '*.py' | xargs -0 -r flake8
Copy link
Member

Choose a reason for hiding this comment

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

does #3420 (comment) mean we should remove flake8 check entirely for now?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could since we cannot use it in the way we want. I just stalled it while waiting for a better solution but if the only solution will be implementing automatic formatting then we won't need this I guess

@ymzayek ymzayek removed the Stalled This issue is currently stalled and has no recent activity. Use this label before closing due to ina label Feb 6, 2023
@ymzayek
Copy link
Member Author

ymzayek commented Feb 6, 2023

Closing this since it's superseded by #3484

@ymzayek ymzayek closed this Feb 6, 2023
@ymzayek ymzayek deleted the flake8-fix branch March 1, 2023 16:57
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.

All CI failing because flake8 --diff option has been removed
3 participants