Skip to content

CI: Format isort output for azure #29654

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 13 commits into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 7 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then

# Imports - Check formatting using isort see setup.cfg for settings
MSG='Check import format using isort ' ; echo $MSG
isort --recursive --check-only pandas asv_bench
set -o pipefail
Copy link
Member

Choose a reason for hiding this comment

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

I think you should disable when it's not needed anymore. Otherwise things in other part of the script can fail, and this is not expected to be active by default.

isort_cmd="isort --recursive --check-only pandas asv_bench"
Copy link
Member

Choose a reason for hiding this comment

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

I think the convention is to have environment variables in bash in upper case.

if [[ "$AZURE" == "true" ]]; then
eval $isort_cmd | awk '{ORS=""} {print "##vso[task.logissue type=error;sourcepath="$2";]"} {$1=$2=""; print $0}'
Copy link
Member

Choose a reason for hiding this comment

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

Just an opinion, but I'd personally prefer something like:

if [[ "$AZURE" == "true" ]]; then
    FORMAT_ISORT="awk '{ORS=""} {print "##vso[task.logissue type=error;sourcepath="$2";]"} {$1=$2=""; print $0}'"
else
    FORMAT_ISORT="cat"
fi
isort --recursive --check-only pandas asv_bench | eval $FORMAT_ISORT

Not a huge difference, but I think it makes more clear what's going on, since the line that actually does things is just one, shorter, and more explicit on what it does

else
eval $isort_cmd
Copy link
Member

Choose a reason for hiding this comment

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

This indentation doesn't much the previous eval.

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

fi
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/window/test_pairwise.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pandas.core.algorithms import safe_sort
import warnings

import pytest

from pandas import DataFrame, Series
from pandas.core.algorithms import safe_sort
import pandas.util.testing as tm


Expand Down