Skip to content

STY: add code check for use of builtin filter function #36089

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

Merged
merged 1 commit into from
Sep 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
invgrep -R --include="*.py" -E "super\(\w*, (self|cls)\)" pandas
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for use of builtin filter function' ; echo $MSG
invgrep -R --include="*.py" -P '(?<!def)[\(\s]filter\(' pandas
Copy link
Member

@WillAyd WillAyd Sep 3, 2020

Choose a reason for hiding this comment

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

Suggested change
invgrep -R --include="*.py" -P '(?<!def)[\(\s]filter\(' pandas
invgrep -R --include="*.py" -P '(?<!def )filter\(' pandas

Is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

that would fail on uses of .filter, simplefilter, .apply_filter and more

RET=$(($RET + $?)) ; echo $MSG "DONE"

# Check for the following code in testing: `np.testing` and `np.array_equal`
MSG='Check for invalid testing' ; echo $MSG
invgrep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/
Expand Down