You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isort is a tool to validate the order of the imports in Python code. We are using it in the CI to make sure all pandas imports follow a defined standard. It is implemented in ci/code_checks.sh.
When isort detects imports incorrectly sorted, it finishes with an exit code different than 0, and that makes the CI red. Besides that, it'd be useful that in Azure Pipelines (the CI system where isort runs) the output messages of isort were detected as errors.
Some tools provide an option to specify the output format, like flake8, but isort doesn't (see PyCQA/isort#961).
What we can do in this case is to modify the output with bash pipelines. We are already doing that in the invgrep function in ci/code_checks.sh.
What needs to be done is:
Change the format of isort output to be: `##vso[task.logissue type=error;sourcepath=%(path)s]%(text)s"
Make sure that the resulting command still has an exit code of 0 if no issues are found, and the exit code of isort is there are. e.g. the exit code of isort -c foo.py | awk -F" " '{ print $2 }' is 0, the exit code of awk even if errors are found (the exit code of isort is lost in the pipeline).
Note that the error message of isort is not delimited in a way that can be easily parsed. But since the error message does not change, it should be possible to extract the name of the file removing the number of characters of the text around it (see https://github.com/timothycrosley/isort/blob/develop/isort/isort.py#L122).
The text was updated successfully, but these errors were encountered:
isort
is a tool to validate the order of the imports in Python code. We are using it in the CI to make sure all pandas imports follow a defined standard. It is implemented inci/code_checks.sh
.When
isort
detects imports incorrectly sorted, it finishes with an exit code different than 0, and that makes the CI red. Besides that, it'd be useful that in Azure Pipelines (the CI system whereisort
runs) the output messages ofisort
were detected as errors.Some tools provide an option to specify the output format, like
flake8
, butisort
doesn't (see PyCQA/isort#961).What we can do in this case is to modify the output with bash pipelines. We are already doing that in the
invgrep
function inci/code_checks.sh
.What needs to be done is:
isort
output to be: `##vso[task.logissue type=error;sourcepath=%(path)s]%(text)s"0
if no issues are found, and the exit code ofisort
is there are. e.g. the exit code ofisort -c foo.py | awk -F" " '{ print $2 }'
is 0, the exit code ofawk
even if errors are found (the exit code ofisort
is lost in the pipeline).Note that the error message of
isort
is not delimited in a way that can be easily parsed. But since the error message does not change, it should be possible to extract the name of the file removing the number of characters of the text around it (see https://github.com/timothycrosley/isort/blob/develop/isort/isort.py#L122).The text was updated successfully, but these errors were encountered: