8000 CI/BLD: Restrict ci/code_checks.sh to tracked repo files by plammens · Pull Request #36386 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

CI/BLD: Restrict ci/code_checks.sh to tracked repo files #36386

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
Prev Previous commit
BLD: refactor code_checks.sh to avoid duplication due to GH Actions c…
…heck
  • Loading branch information
plammens committed Sep 23, 2020
commit 8611fe68aa9b13936d240e65d3bb6d3e3afc4dbc
42 changes: 22 additions & 20 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ else
FLAKE8_FORMAT="default"
fi


function if_gh_actions {
# If this is running on GitHub Actions, echo the argument list, otherwise
# echo the empty string.
# Used to conditionally pass command-line arguments as in
# $(if_gh_actions --baz spam) | xargs foo --bar
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
for arg in "$@"; do echo $arg; done | quote_if_needed
else
echo ""
fi
}


### LINTING ###
if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then

Expand Down Expand Up @@ -126,35 +140,23 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
VALIDATE_CMD=$BASE_DIR/scripts/validate_unwanted_patterns.py

MSG='Check for use of not concatenated strings' ; echo $MSG
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
echo $GIT_TRACKED_ALL_PY_FILES | xargs $VALIDATE_CMD --validation-type="strings_to_concatenate" --format="##[error]{source_path}:{line_number}:{msg}" --no-override
else
echo $GIT_TRACKED_ALL_PY_FILES | xargs $VALIDATE_CMD --validation-type="strings_to_concatenate" --no-override
fi
ARGS=$({ if_gh_actions --format="##[error]{source_path}:{line_number}:{msg}"; echo $GIT_TRACKED_ALL_PY_FILES; })
echo $ARGS | xargs $VALIDATE_CMD --validation-type="strings_to_concatenate" --no-override
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for strings with wrong placed spaces' ; echo $MSG
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
echo $GIT_TRACKED_ALL_PY_FILES | xargs $VALIDATE_CMD --validation-type="strings_with_wrong_placed_whitespace" --format="##[error]{source_path}:{line_number}:{msg}" --no-override
else
echo $GIT_TRACKED_ALL_PY_FILES | xargs $VALIDATE_CMD --validation-type="strings_with_wrong_placed_whitespace" --no-override
fi
ARGS=$({ if_gh_actions --format="##[error]{source_path}:{line_number}:{msg}"; echo $GIT_TRACKED_ALL_PY_FILES; })
echo $ARGS | xargs $VALIDATE_CMD --validation-type="strings_with_wrong_placed_whitespace" --no-override
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for import of private attributes across modules' ; echo $MSG
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
$VALIDATE_CMD --validation-type="private_import_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored --format="##[error]{source_path}:{line_number}:{msg}" pandas/
else
$VALIDATE_CMD --validation-type="private_import_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored pandas/
fi
ARGS=$(if_gh_actions --format="##[error]{source_path}:{line_number}:{msg}")
echo $ARGS | xargs $VALIDATE_CMD --validation-type="private_import_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored pandas/
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Check for use of private functions across modules' ; echo $MSG
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
$VALIDATE_CMD --validation-type="private_function_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored,doc/ --format="##[error]{source_path}:{line_number}:{msg}" pandas/
else
$VALIDATE_CMD --validation-type="private_function_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored,doc/ pandas/
fi
ARGS=$(if_gh_actions --format="##[error]{source_path}:{line_number}:{msg}")
echo $ARGS | xargs $VALIDATE_CMD --validation-type="private_function_across_module" --included-file-extensions="py" --excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored,doc/ pandas/
RET=$(($RET + $?)) ; echo $MSG "DONE"

echo "isort --version-number"
Expand Down
0