-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Apply ruff/flake8-implicit-str-concat rules (ISC) #30695
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
Conversation
+ r"(([A-Za-z]+\-?)+)" | ||
+ r"(MinVersion\| replace::)" | ||
+ r"( [0-9]+\.[0-9]+(\.[0-9]+)?)" | ||
r"(([A-Za-z]+\-?)+)" |
Check failure
Code scanning / CodeQL
Inefficient regular expression High test
038ed2d
to
94bbc92
Compare
2613932
to
8fedcdf
Compare
@@ -116,7 +116,7 @@ def plot_results(ax1, ax2, estimator, X, y, title, plot_title=False): | |||
[0.001, 1, 1000], | |||
), | |||
( | |||
"Infinite mixture with a Dirichlet process\n prior and" r"$\gamma_0=$", | |||
"Infinite mixture with a Dirichlet process\nprior and $\\gamma_0=$", |
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.
This one's debatable.
Note I've also removed an extra space for consistency with previous estimator.
8fedcdf
to
039b8e5
Compare
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.
Otherwise LGTM
039b8e5
to
09ff827
Compare
ISC001 Implicitly concatenated string literals on one line
ISC003 Explicitly concatenated string should be implicitly concatenated
09ff827
to
5a96c8e
Compare
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.
Please avoid force pushing since it makes review harder. It's easier to have the whole history in the PR.
I've also wondered about switching to ruff formatter instead of black. One less tool to handle. |
Sure, I could switch to EDIT: See #31015. |
@Charlie-XIAO maybe you could have a look? Should be an easy review. |
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.
This LGTM, thanks! I think we do need to fix CodeQL though.
Inefficient regular expression This part of the regular expression may cause exponential backtracking on strings starting with `.. |` and containing many repetitions of `A`. Co-authored-by: Yao Xiao <108576690+Charlie-XIAO@users.noreply.github.com>
This reverts commit 76b2c95.
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695) * black → ruff format (scikit-learn#31015)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695) * black → ruff format (scikit-learn#31015)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695) * black → ruff format (scikit-learn#31015)
* Enforce ruff rules (RUF) (scikit-learn#30694) * Apply ruff/flake8-implicit-str-concat rules (ISC) (scikit-learn#30695) * black → ruff format (scikit-learn#31015)
What does this implement/fix? Explain your changes.
Applying rule
ISC001
merges split string literals — usually as a result of black unfolding a line.As for rule
ISC003
, it may appear it doesn't improve readability in some cases. However, I see such cases as black formatting issues.Any other comments?
Not sure these rules should be enforced in CI, because I'm not certain they're always compatible with black.
[doc skip]