Skip to content

STYLE move patterns checks to pre-commit #42123

Closed
@MarcoGorelli

Description

@MarcoGorelli

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions