Skip to content

Commit

Permalink
Ensure linting checks for whole repo in CI (#1053)
Browse files Browse the repository at this point in the history
It often happens that `pre-commit` finds improperly formatted files that are not in the `dask_cuda` directory, therefore it is sensible to check the entire repo.

Authors:
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)
  - Lawrence Mitchell (https://github.com/wence-)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #1053
  • Loading branch information
pentschev authored Nov 29, 2022
1 parent 8effa7f commit 55375b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.6.4
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks:
- id: flake8
Expand Down
49 changes: 2 additions & 47 deletions ci/checks/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,5 @@ PATH=/opt/conda/bin:$PATH
. /opt/conda/etc/profile.d/conda.sh
conda activate rapids

# Print versions
echo -e "\nVersions:"
black --version
echo "isort, `isort --vn`"
echo "flake8, `flake8 --version`"

# Run isort and get results/return code
ISORT=`isort --check-only dask_cuda 2>&1`
ISORT_RETVAL=$?

# Run black and get results/return code
BLACK=`black --check dask_cuda 2>&1`
BLACK_RETVAL=$?

# Run flake8 and get results/return code
FLAKE=`flake8 dask_cuda 2>&1`
FLAKE_RETVAL=$?

# Output results if failure otherwise show pass
if [ "$ISORT_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort style check; begin output\n\n"
echo -e "$ISORT"
echo -e "\n\n>>>> FAILED: isort style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort style check\n\n"
fi

if [ "$BLACK_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: black style check; begin output\n\n"
echo -e "$BLACK"
echo -e "\n\n>>>> FAILED: black style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: black style check\n\n"
fi

if [ "$FLAKE_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: flake8 style check; begin output\n\n"
echo -e "$FLAKE"
echo -e "\n\n>>>> FAILED: flake8 style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: flake8 style check\n\n"
fi

RETVALS=($ISORT_RETVAL $BLACK_RETVAL $FLAKE_RETVAL)
IFS=$'\n'
RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1`
exit $RETVAL
# Run pre-commit checks
pre-commit run --hook-stage manual --all-files

0 comments on commit 55375b8

Please sign in to comment.