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] add workflow to check for f strings #3759
Conversation
👋 @Remi-Gau 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.
For new features:
For bug fixes:
We will review it as quick as possible, feel free to ping us with questions if needed. |
Codecov Report
@@ Coverage Diff @@
## main #3759 +/- ##
=======================================
Coverage 91.65% 91.65%
=======================================
Files 139 139
Lines 16554 16554
Branches 3230 3230
=======================================
Hits 15172 15172
Misses 1379 1379
Partials 3 3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the github workflow will fail if any code is added with %
or .format()
formatting ?
Co-authored-by: Yasmin <63292494+ymzayek@users.noreply.github.com>
only for the simplest usage of in terms of complexity flynt acts like a high-pass filter for string formatting it has an "aggressive" option to force reformating but the doc itself that those reformating may result in behavior change does that make sense? |
oh and it is already one the pre-commit hook that is run, this would just provide an official check in CI |
@Remi-Gau have you looked at |
Was not aware of this one. Will investigate. |
OK as far I can tell the 2 are not completely mutually exclusive. Flynt will actually try to convert % and Format to f strings but can only do the most simple ones because it tries to be conservative. The flake8 extension will flag % and format and potentially report them as error. So the 2 could coexist but one will throw more errors than the other when used for Linting purposes. I would suggest to start with Flynt and and then tackle the remaining non f strings. Then we can switch to flake8 extensions to ensure we stick to f strings from now on. |
👍 sounds good to me. Thanks for taking a look at the flake8 extension. |
Co-authored-by: bthirion <bertrand.thirion@inria.fr>
The PR LGTM, but I think lots of red CI. |
yeah I will rebase to clean some of that |
Co-authored-by: Remi-Gau <Remi-Gau@users.noreply.github.com>
* update git-blame-ignore * update changelog * fix * update ignore * fix regex escape * flake8 * use list and not set * simplify rev file * rm spaces * pragmatism wins * rm import * reset plotting files
…r` message (nilearn#3763) * Modify ValueError string * Warning based on sklearn version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it mixed several things but LGTM overall.
yeah some files should not be in that diff: will fix |
Closes #2528
Relates to https://github.com/orgs/nilearn/projects/2/views/1?pane=issue&itemId=30677086
Changes proposed in this pull request: