Skip to content

CI: format isort output for detection by azure pipelines #27334

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
wants to merge 7 commits into from
Closed
Changes from 4 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
7 changes: 5 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ 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
if [[ "$AZURE" == "true" ]]; then
isort --recursive --check-only pandas asv_bench | awk -F ':' '{print $0"\n" "##vso[task.logissue type=error;sourcepath=%(path)s]%(text)s"}'
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 return code $? we are checking later to see if isort was successful or not, will actually be the one of awk with this, which will always be 0.

This means that if the imports are not correctly sorted, we won't detect them in the CI.

Can you start by swapping the order of two imports in pandas in this PR, so we know if this is working or not? We'll remove them once the PR is approved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will push up the badly sorted imports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

here is the output! Check import format using isort ERROR: /home/vsts/work/1/s/pandas/plotting/_matplotlib/core.py Imports are incorrectly sorted. ##[error]%(path)s(,): error : %(text)s Check import format using isort DONE ##[error]Bash exited with code '1'. ##[section]Finishing: Linting

else
isort --recursive --check-only pandas asv_bench | awk -F ':' '{print}'
fi
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi

### PATTERNS ###
Expand Down