Skip to content

STYLE move patterns checks to pre-commit #42123

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

Closed
4 tasks
MarcoGorelli opened this issue Jun 19, 2021 · 3 comments · Fixed by #42923
Closed
4 tasks

STYLE move patterns checks to pre-commit #42123

MarcoGorelli opened this issue Jun 19, 2021 · 3 comments · Fixed by #42923
Labels
Code Style Code style, linting, code_checks good first issue
Milestone

Comments

@MarcoGorelli
Copy link
Member

These checks from ci/code_checks.sh should be moved to pre-commit:

### PATTERNS ###
if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then

    # Check for the following code in the extension array base tests: `tm.assert_frame_equal` and `tm.assert_series_equal`
    MSG='Check for invalid EA testing' ; echo $MSG
    invgrep -r -E --include '*.py' --exclude base.py 'tm.assert_(series|frame)_equal' pandas/tests/extension/base
    RET=$(($RET + $?)) ; echo $MSG "DONE"

    MSG='Check for deprecated messages without sphinx directive' ; echo $MSG
    invgrep -R --include="*.py" --include="*.pyx" -E "(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)" pandas
    RET=$(($RET + $?)) ; echo $MSG "DONE"

    MSG='Check for backticks incorrectly rendering because of missing spaces' ; echo $MSG
    invgrep -R --include="*.rst" -E "[a-zA-Z0-9]\`\`?[a-zA-Z0-9]" doc/source/
    RET=$(($RET + $?)) ; echo $MSG "DONE"

    MSG='Check for unnecessary random seeds in asv benchmarks' ; echo $MSG
    invgrep -R --exclude pandas_vb_common.py -E 'np.random.seed' asv_bench/benchmarks/
    RET=$(($RET + $?)) ; echo $MSG "DONE"

fi

some might fit in the unwanted patterns hook, others might need their own pygrep hook (no additional dependencies are necessary here though so the same existing virtualenvs will be reused)

  • check for invalid EA testing
  • deprecated messages without sphinx directive
  • backticks incorrectly rendering because of missing spaces
  • unnecessary random seeds in asv benchmarks
@MarcoGorelli MarcoGorelli added Code Style Code style, linting, code_checks good first issue labels Jun 19, 2021
@nooraLeila
Copy link
Contributor

take

@debnathshoham
Copy link
Member

hi, is anyone working on this?

@MarcoGorelli
Copy link
Member Author

Hey @debnathshoham - the checks are still there, so if you want to submit a PR, go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants