fix: return exit code 0 when no Python files are found - #361
Open
Sanjays2402 wants to merge 1 commit into
Open
Conversation
Since v1.7.8 docformatter exits 1 whenever no Python file was processed, so running it on a non-Python file, or recursively over a directory that happens to contain no Python files, fails CI pipelines that used to pass on v1.7.7. The unconditional 'is_empty -> error' branch in do_format_files() now only reports an error when a path given on the command line does not exist, preserving the existing missing-file exit code 1 while making an empty but valid set of inputs a no-op. Closes PyCQA#348
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #348
Since v1.7.8,
do_format_files()counted "no Python files were processed" as an error, sodocformatter example.txtordocformatter -cr .on a tree with no Python files exits 1 and breaks CI pipelines that passed on 1.7.7.The
is_emptybranch now only reports an error when a path passed on the command line does not exist, so the missing-file exit code 1 is preserved while an empty-but-valid set of inputs is a no-op. Newtest_no_python_files_exit_codefails on master (exit 1) and passes with the fix; the existingtest_io_error_exit_codestill passes.