Skip to content

Commit

Permalink
fix(Python): Handle docformatter exit codes (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmcdonald3 authored Sep 18, 2024
1 parent 9dd74be commit e0caa14
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,13 @@ private void formatDocstrings(FileManifest fileManifest) {
return;
}
LOGGER.info("Running docformatter on generated code");
CodegenUtils.runCommand("python3 -m docformatter --recursive .", fileManifest.getBaseDir());
// docformatter exit codes:
// 0: docformatter did not make changes
// 1: docformatter made changes
// 2: Invalid docformatter usage (incorrect arguments, etc.)
// If docformatter returns exit codes 0 or 1, then exit 0 to CodegenUtils. Otherwise, exit 1.
CodegenUtils.runCommand(
"python3 -m docformatter --recursive --in-place .; [ $? -eq 0 ] || [ $? -eq 1 ] || exit 1", fileManifest.getBaseDir());
}

private void runMypy(FileManifest fileManifest) {
Expand Down

0 comments on commit e0caa14

Please sign in to comment.