-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fixing typo in cython casting lint, and making it azure friendly #23486
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
Yep, good catch. |
can you fix the issues as well so that this passes |
Wanted to make sure I was not misunderstanding the problem first. All fixed, and made the the regex more robust too (one case in CI should finish on green now. |
Codecov Report
@@ Coverage Diff @@
## master #23486 +/- ##
=======================================
Coverage 92.23% 92.23%
=======================================
Files 161 161
Lines 51197 51197
=======================================
Hits 47220 47220
Misses 3977 3977
Continue to review full report at Codecov.
|
thanks @datapythonista |
@jbrockmendel
Fixing typo introduced in #23474, when validating the spaces in casts in the cython code.
The original grep command used was:
grep -r -E --include '*.pyx' --include '*.pxi.in' '> ' pandas/_libs | grep -v '[ ->]> '
If I'm not mistaken, the goal of
grep -v '[ ->]> '
was to exclude from the initially caught>
the cases where before the greater than we have a space, a hyphen or another greater than. The problem is that the hyphen is understood as a range, like in[a-z]
, and the regex is excluding other characters, like the star. So, we're exclusing cases like:Which should probably have the same standard as the one we're enforcing.
Just by changing the order of
'[ ->]> '
to'[ >-]> '
makes it work as expected. But there is an additional problem on this grep. In #22854 I'm movingcode_checks.py
from travis to azure. And I implemented a bash functioninvgrep
that is like a grep, that besides inverting the exit status of grep, formats the output in a way that looks nicer in azure. And pipping two greps together is making things a bit more complex, so I'd prefer to avoid it if possible.So, the proposed changes in this PR, create a new regex that tries to solve the problem with a single grep. I changed the pattern to match any alphanumberic of star followed by the greater than and the space. But equivalent to what you were doing, we can also use
'[^ ^>^-]> '
. Happy to change to it if it makes more sense to you.If you can confirm that my assumptions are correct, I'll fix the pending cases in this PR, so the CI is green and we can merge.