static_checks: Change how Readability works
Readability is now enforced by Gerrit and not by recipes, so recipe code
no longer fails if the Readability requirement isn't met. However, for
CLs that make only trivial modifications to files covered by
readability, recipes mark the CL as trivial, and Gerrit uses that to
bypass the readability requirement.
Bug: b/240290899
Change-Id: Icb16fe3456a3029f2281d39e87ae116f3533289d
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/121393
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
diff --git a/recipes/static_checks.expected/do-not-submit.json b/recipes/static_checks.expected/do-not-submit.json
index 655d17e..f60ada0 100644
--- a/recipes/static_checks.expected/do-not-submit.json
+++ b/recipes/static_checks.expected/do-not-submit.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/docs.commit-message-ignored.json b/recipes/static_checks.expected/docs.commit-message-ignored.json
index 4a64a31..f3feaae 100644
--- a/recipes/static_checks.expected/docs.commit-message-ignored.json
+++ b/recipes/static_checks.expected/docs.commit-message-ignored.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/docs.gerrit-comment.json b/recipes/static_checks.expected/docs.gerrit-comment.json
index d02cfc1..624cbe0 100644
--- a/recipes/static_checks.expected/docs.gerrit-comment.json
+++ b/recipes/static_checks.expected/docs.gerrit-comment.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/docs.has_doc_changes.json b/recipes/static_checks.expected/docs.has_doc_changes.json
index ee36808..00866be 100644
--- a/recipes/static_checks.expected/docs.has_doc_changes.json
+++ b/recipes/static_checks.expected/docs.has_doc_changes.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
@@ -164,7 +165,10 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.rst\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.rst\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 20, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 20@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
diff --git a/recipes/static_checks.expected/docs.has_doc_changes_properties.json b/recipes/static_checks.expected/docs.has_doc_changes_properties.json
index 3bae05c..5f6bddd 100644
--- a/recipes/static_checks.expected/docs.has_doc_changes_properties.json
+++ b/recipes/static_checks.expected/docs.has_doc_changes_properties.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
@@ -164,7 +165,10 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.gn\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.gn\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 20, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 20@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
diff --git a/recipes/static_checks.expected/docs.no_doc_changes.json b/recipes/static_checks.expected/docs.no_doc_changes.json
index 59ba682..8423d42 100644
--- a/recipes/static_checks.expected/docs.no_doc_changes.json
+++ b/recipes/static_checks.expected/docs.no_doc_changes.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/docs.no_doc_changes_properties.json b/recipes/static_checks.expected/docs.no_doc_changes_properties.json
index 3ede5a8..bdbc37f 100644
--- a/recipes/static_checks.expected/docs.no_doc_changes_properties.json
+++ b/recipes/static_checks.expected/docs.no_doc_changes_properties.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
@@ -164,7 +165,10 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.rst\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.rst\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 20, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 20@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
diff --git a/recipes/static_checks.expected/docs.owner.json b/recipes/static_checks.expected/docs.owner.json
index d9eb632..9dfee98 100644
--- a/recipes/static_checks.expected/docs.owner.json
+++ b/recipes/static_checks.expected/docs.owner.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/docs.owners-files.json b/recipes/static_checks.expected/docs.owners-files.json
index 8853f33..04f60e7 100644
--- a/recipes/static_checks.expected/docs.owners-files.json
+++ b/recipes/static_checks.expected/docs.owners-files.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
@@ -164,8 +165,14 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"OWNERS\": {}, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo/OWNERS\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"OWNERS\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 20, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 20@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo/OWNERS\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 20, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 20@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
diff --git a/recipes/static_checks.expected/docs.revert.json b/recipes/static_checks.expected/docs.revert.json
index f84ba52..027bbb5 100644
--- a/recipes/static_checks.expected/docs.revert.json
+++ b/recipes/static_checks.expected/docs.revert.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/readability.dry_run.json b/recipes/static_checks.expected/readability.dry_run.json
deleted file mode 100644
index 46c6889..0000000
--- a/recipes/static_checks.expected/readability.dry_run.json
+++ /dev/null
@@ -1,284 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure gerrit"
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "RECIPE_MODULE[fuchsia::gerrit]/resources/tool_manifest.json",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.read manifest",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/gerrit\",@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
- "@@@STEP_LOG_END@tool_manifest.json@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure gerrit.install path/to/gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "ensure-directory",
- "--mode",
- "0777",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure package directory",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version",
- "-ensure-file",
- "path/to/gerrit version:pinned-version",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/gerrit\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\", \"params\": {\"o\": [\"ALL_COMMITS\", \"ALL_REVISIONS\", \"ALL_FILES\"]}}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "change details",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revert_of\": 0, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"HASH\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"_number\": 1, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"parents\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": \"PARENT\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"subject\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"params\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"o\": [@@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_COMMITS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_REVISIONS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_FILES\"@@@",
- "@@@STEP_LOG_LINE@json.input@ ]@@@",
- "@@@STEP_LOG_LINE@json.input@ }@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "list-change-comments",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "list change comments",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\"@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [],
- "name": "TRYJOB DO NOT RETRY",
- "~followup_annotations": [
- "@@@SET_BUILD_PROPERTY@$recipe_engine/cq/output@{\"retry\": \"OUTPUT_RETRY_DENIED\"}@@@",
- "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking if revert",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@0@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking owner account",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@nobody@example.com@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check docs"
- },
- {
- "cmd": [],
- "name": "check docs.doc changes not required",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check requires"
- },
- {
- "cmd": [],
- "name": "check dns"
- },
- {
- "cmd": [],
- "name": "Readability"
- },
- {
- "cmd": [],
- "name": "Readability.dry run",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_approved.json b/recipes/static_checks.expected/readability.has_cpp_changes_approved.json
deleted file mode 100644
index 1d61a41..0000000
--- a/recipes/static_checks.expected/readability.has_cpp_changes_approved.json
+++ /dev/null
@@ -1,288 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure gerrit"
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "RECIPE_MODULE[fuchsia::gerrit]/resources/tool_manifest.json",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.read manifest",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/gerrit\",@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
- "@@@STEP_LOG_END@tool_manifest.json@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure gerrit.install path/to/gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "ensure-directory",
- "--mode",
- "0777",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure package directory",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version",
- "-ensure-file",
- "path/to/gerrit version:pinned-version",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/gerrit\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\", \"params\": {\"o\": [\"ALL_COMMITS\", \"ALL_REVISIONS\", \"ALL_FILES\"]}}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "change details",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"approved\": true@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revert_of\": 0, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"HASH\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"_number\": 1, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"parents\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": \"PARENT\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"subject\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"params\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"o\": [@@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_COMMITS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_REVISIONS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_FILES\"@@@",
- "@@@STEP_LOG_LINE@json.input@ ]@@@",
- "@@@STEP_LOG_LINE@json.input@ }@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "list-change-comments",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "list change comments",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\"@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [],
- "name": "TRYJOB DO NOT RETRY",
- "~followup_annotations": [
- "@@@SET_BUILD_PROPERTY@$recipe_engine/cq/output@{\"retry\": \"OUTPUT_RETRY_DENIED\"}@@@",
- "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking if revert",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@0@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking owner account",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@nobody@example.com@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check docs"
- },
- {
- "cmd": [],
- "name": "check docs.doc changes not required",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check requires"
- },
- {
- "cmd": [],
- "name": "check dns"
- },
- {
- "cmd": [],
- "name": "Readability"
- },
- {
- "cmd": [],
- "name": "Readability.label approved",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_no_vote.json b/recipes/static_checks.expected/readability.has_cpp_changes_no_vote.json
deleted file mode 100644
index 535bf4d..0000000
--- a/recipes/static_checks.expected/readability.has_cpp_changes_no_vote.json
+++ /dev/null
@@ -1,309 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure gerrit"
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "RECIPE_MODULE[fuchsia::gerrit]/resources/tool_manifest.json",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.read manifest",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/gerrit\",@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
- "@@@STEP_LOG_END@tool_manifest.json@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure gerrit.install path/to/gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "ensure-directory",
- "--mode",
- "0777",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure package directory",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version",
- "-ensure-file",
- "path/to/gerrit version:pinned-version",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/gerrit\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\", \"params\": {\"o\": [\"ALL_COMMITS\", \"ALL_REVISIONS\", \"ALL_FILES\"]}}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "change details",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revert_of\": 0, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"HASH\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"_number\": 1, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"parents\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": \"PARENT\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"subject\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"params\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"o\": [@@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_COMMITS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_REVISIONS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_FILES\"@@@",
- "@@@STEP_LOG_LINE@json.input@ ]@@@",
- "@@@STEP_LOG_LINE@json.input@ }@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "list-change-comments",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "list change comments",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"unrelated\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\"@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [],
- "name": "TRYJOB DO NOT RETRY",
- "~followup_annotations": [
- "@@@SET_BUILD_PROPERTY@$recipe_engine/cq/output@{\"retry\": \"OUTPUT_RETRY_DENIED\"}@@@",
- "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking if revert",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@0@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking owner account",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@nobody@example.com@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check docs"
- },
- {
- "cmd": [],
- "name": "check docs.doc changes not required",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check requires"
- },
- {
- "cmd": [],
- "name": "check dns"
- },
- {
- "cmd": [],
- "name": "Readability",
- "~followup_annotations": [
- "@@@STEP_FAILURE@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@unrelated@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.files",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_SUMMARY_TEXT@foo.cpp@@@"
- ]
- },
- {
- "failure": {
- "failure": {},
- "humanReason": "Readability not set but foo.cpp changed. If necessary this requirement can be bypassed by adding a Gerrit comment like \"Skip-Readability-Justification: <reason>\""
- },
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_recommended.json b/recipes/static_checks.expected/readability.has_cpp_changes_recommended.json
deleted file mode 100644
index de5a457..0000000
--- a/recipes/static_checks.expected/readability.has_cpp_changes_recommended.json
+++ /dev/null
@@ -1,288 +0,0 @@
-[
- {
- "cmd": [],
- "name": "ensure gerrit"
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "RECIPE_MODULE[fuchsia::gerrit]/resources/tool_manifest.json",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.read manifest",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/gerrit\",@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
- "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
- "@@@STEP_LOG_END@tool_manifest.json@@@"
- ]
- },
- {
- "cmd": [],
- "name": "ensure gerrit.install path/to/gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "ensure-directory",
- "--mode",
- "0777",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure package directory",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version",
- "-ensure-file",
- "path/to/gerrit version:pinned-version",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "ensure gerrit.install path/to/gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/gerrit\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\", \"params\": {\"o\": [\"ALL_COMMITS\", \"ALL_REVISIONS\", \"ALL_FILES\"]}}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "change details",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"recommended\": true@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revert_of\": 0, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"HASH\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"_number\": 1, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"parents\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"commit\": \"PARENT\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ], @@@",
- "@@@STEP_LOG_LINE@json.output@ \"subject\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }, @@@",
- "@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"params\": {@@@",
- "@@@STEP_LOG_LINE@json.input@ \"o\": [@@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_COMMITS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_REVISIONS\", @@@",
- "@@@STEP_LOG_LINE@json.input@ \"ALL_FILES\"@@@",
- "@@@STEP_LOG_LINE@json.input@ ]@@@",
- "@@@STEP_LOG_LINE@json.input@ }@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
- "list-change-comments",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"123456\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:try"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "list change comments",
- "timeout": 600,
- "~followup_annotations": [
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@",
- "@@@STEP_LOG_LINE@json.input@{@@@",
- "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"123456\"@@@",
- "@@@STEP_LOG_LINE@json.input@}@@@",
- "@@@STEP_LOG_END@json.input@@@",
- "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/123456@@@"
- ]
- },
- {
- "cmd": [],
- "name": "TRYJOB DO NOT RETRY",
- "~followup_annotations": [
- "@@@SET_BUILD_PROPERTY@$recipe_engine/cq/output@{\"retry\": \"OUTPUT_RETRY_DENIED\"}@@@",
- "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking if revert",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@0@@@"
- ]
- },
- {
- "cmd": [],
- "name": "checking owner account",
- "~followup_annotations": [
- "@@@STEP_SUMMARY_TEXT@nobody@example.com@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check docs"
- },
- {
- "cmd": [],
- "name": "check docs.doc changes not required",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
- "name": "check requires"
- },
- {
- "cmd": [],
- "name": "check dns"
- },
- {
- "cmd": [],
- "name": "Readability"
- },
- {
- "cmd": [],
- "name": "Readability.label recommended",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.inserted_nontrivial.json
similarity index 92%
rename from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
rename to recipes/static_checks.expected/readability.inserted_nontrivial.json
index 52a566e..591d745 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.inserted_nontrivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,9 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 15@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +219,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,33 +274,25 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
+ "name": "Readability-Trivial.changed lines 15",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.threshold 10",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.inserted_trivial.json
similarity index 79%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.inserted_trivial.json
index 52a566e..b3d7305 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.inserted_trivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,9 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 5@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +219,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,38 +274,75 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.changed lines 5",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
+ "cmd": [],
+ "name": "Readability-Trivial.threshold 10",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
+ "set-review",
+ "-host",
+ "https://pigweed-review.googlesource.com",
+ "-input",
+ "{\"change_id\": \"1234\", \"input\": {\"labels\": {\"Readability-Trivial\": 1}, \"notify\": \"OWNER\"}, \"revision_id\": \"current\"}",
+ "-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Readability-Trivial.set label",
+ "timeout": 600,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
+ "@@@STEP_LOG_END@json.output (exception)@@@",
+ "@@@STEP_LOG_LINE@json.input@{@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\", @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"labels\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"Readability-Trivial\": 1@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\"@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"revision_id\": \"current\"@@@",
+ "@@@STEP_LOG_LINE@json.input@}@@@",
+ "@@@STEP_LOG_END@json.input@@@",
+ "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/1234@@@"
+ ]
+ },
+ {
"name": "$result"
}
]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.mixed_nontrivial.json
similarity index 92%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.mixed_nontrivial.json
index 52a566e..1255aaa 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.mixed_nontrivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,10 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 5, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 5@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +220,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,33 +275,25 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
+ "name": "Readability-Trivial.changed lines 10",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.threshold 10",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.mixed_trivial.json
similarity index 78%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.mixed_trivial.json
index 52a566e..ecedac2 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.mixed_trivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,10 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 4, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 5@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +220,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,38 +275,75 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.changed lines 9",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
+ "cmd": [],
+ "name": "Readability-Trivial.threshold 10",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
+ "set-review",
+ "-host",
+ "https://pigweed-review.googlesource.com",
+ "-input",
+ "{\"change_id\": \"1234\", \"input\": {\"labels\": {\"Readability-Trivial\": 1}, \"notify\": \"OWNER\"}, \"revision_id\": \"current\"}",
+ "-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Readability-Trivial.set label",
+ "timeout": 600,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
+ "@@@STEP_LOG_END@json.output (exception)@@@",
+ "@@@STEP_LOG_LINE@json.input@{@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\", @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"labels\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"Readability-Trivial\": 1@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\"@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"revision_id\": \"current\"@@@",
+ "@@@STEP_LOG_LINE@json.input@}@@@",
+ "@@@STEP_LOG_END@json.input@@@",
+ "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/1234@@@"
+ ]
+ },
+ {
"name": "$result"
}
]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.multiple_nontrivial.json
similarity index 83%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.multiple_nontrivial.json
index 52a566e..dba5347 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.multiple_nontrivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,26 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.c\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cc\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.hh\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.hpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +236,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,33 +291,25 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 5",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
+ "name": "Readability-Trivial.changed lines 10",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.threshold 10",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.multiple_trivial.json
similarity index 73%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.multiple_trivial.json
index 52a566e..d10f2cc 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.multiple_trivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,22 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cc\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.hh\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.hpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 1, @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_inserted\": 1@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +232,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,38 +287,75 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 4",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.changed lines 8",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
+ "cmd": [],
+ "name": "Readability-Trivial.threshold 10",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
+ "set-review",
+ "-host",
+ "https://pigweed-review.googlesource.com",
+ "-input",
+ "{\"change_id\": \"1234\", \"input\": {\"labels\": {\"Readability-Trivial\": 1}, \"notify\": \"OWNER\"}, \"revision_id\": \"current\"}",
+ "-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Readability-Trivial.set label",
+ "timeout": 600,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
+ "@@@STEP_LOG_END@json.output (exception)@@@",
+ "@@@STEP_LOG_LINE@json.input@{@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\", @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"labels\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"Readability-Trivial\": 1@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\"@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"revision_id\": \"current\"@@@",
+ "@@@STEP_LOG_LINE@json.input@}@@@",
+ "@@@STEP_LOG_END@json.input@@@",
+ "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/1234@@@"
+ ]
+ },
+ {
"name": "$result"
}
]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/readability.no_cpp_changes.json b/recipes/static_checks.expected/readability.no_cpp_changes.json
index bb574f9..373da0c 100644
--- a/recipes/static_checks.expected/readability.no_cpp_changes.json
+++ b/recipes/static_checks.expected/readability.no_cpp_changes.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -269,32 +270,25 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 0",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.files",
+ "name": "Readability-Trivial.changed lines 0",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.no matching files",
+ "name": "Readability-Trivial.threshold 10",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_no_label.json b/recipes/static_checks.expected/readability.no_label.json
similarity index 96%
rename from recipes/static_checks.expected/readability.has_cpp_changes_no_label.json
rename to recipes/static_checks.expected/readability.no_label.json
index ea8e0b4..9551186 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_no_label.json
+++ b/recipes/static_checks.expected/readability.no_label.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
@@ -163,9 +164,7 @@
"@@@STEP_LOG_LINE@json.output@ \"subject\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"files\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -269,11 +268,11 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.no such label",
+ "name": "Readability-Trivial.trivial label not present for repo",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.removed_nontrivial.json
similarity index 92%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.removed_nontrivial.json
index 52a566e..23055dc 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.removed_nontrivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,9 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 15@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +219,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,33 +274,25 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
+ "name": "Readability-Trivial.changed lines 15",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.threshold 10",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json b/recipes/static_checks.expected/readability.removed_trivial.json
similarity index 79%
copy from recipes/static_checks.expected/readability.has_cpp_changes_justification.json
copy to recipes/static_checks.expected/readability.removed_trivial.json
index 52a566e..bd81c6a 100644
--- a/recipes/static_checks.expected/readability.has_cpp_changes_justification.json
+++ b/recipes/static_checks.expected/readability.removed_trivial.json
@@ -144,9 +144,10 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"Readability\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"Readability-Trivial\": {}@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"email\": \"nobody@example.com\"@@@",
@@ -166,7 +167,9 @@
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"description\": \"\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"files\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {}@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"foo.cpp\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"lines_deleted\": 5@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -216,7 +219,7 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"/PATCHSET_LEVEL\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"message\": \"Skip-Readability-Justification: because\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ ]@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
@@ -271,38 +274,75 @@
},
{
"cmd": [],
- "name": "Readability"
+ "name": "Readability-Trivial"
},
{
"cmd": [],
- "name": "Readability.checking comments",
+ "name": "Readability-Trivial.changed files 1",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "Readability.checking comments.comment (0)",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_SUMMARY_TEXT@MATCH: Skip-Readability-Justification: because@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.checking comments.found",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "Readability.found Skip-Readability-Justification",
+ "name": "Readability-Trivial.changed lines 5",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
+ "cmd": [],
+ "name": "Readability-Trivial.threshold 10",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/gerrit/version%3Apinned-version/gerrit",
+ "set-review",
+ "-host",
+ "https://pigweed-review.googlesource.com",
+ "-input",
+ "{\"change_id\": \"1234\", \"input\": {\"labels\": {\"Readability-Trivial\": 1}, \"notify\": \"OWNER\"}, \"revision_id\": \"current\"}",
+ "-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Readability-Trivial.set label",
+ "timeout": 600,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_END@json.output (invalid)@@@",
+ "@@@STEP_LOG_LINE@json.output (exception)@No JSON object could be decoded@@@",
+ "@@@STEP_LOG_END@json.output (exception)@@@",
+ "@@@STEP_LOG_LINE@json.input@{@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"change_id\": \"1234\", @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"input\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"labels\": {@@@",
+ "@@@STEP_LOG_LINE@json.input@ \"Readability-Trivial\": 1@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"notify\": \"OWNER\"@@@",
+ "@@@STEP_LOG_LINE@json.input@ }, @@@",
+ "@@@STEP_LOG_LINE@json.input@ \"revision_id\": \"current\"@@@",
+ "@@@STEP_LOG_LINE@json.input@}@@@",
+ "@@@STEP_LOG_END@json.input@@@",
+ "@@@STEP_LINK@gerrit link@https://pigweed-review.googlesource.com/q/1234@@@"
+ ]
+ },
+ {
"name": "$result"
}
]
\ No newline at end of file
diff --git a/recipes/static_checks.expected/regexp.fail-msg.json b/recipes/static_checks.expected/regexp.fail-msg.json
index df21351..9acc3f4 100644
--- a/recipes/static_checks.expected/regexp.fail-msg.json
+++ b/recipes/static_checks.expected/regexp.fail-msg.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/regexp.fail.json b/recipes/static_checks.expected/regexp.fail.json
index dfab6aa..9ffe505 100644
--- a/recipes/static_checks.expected/regexp.fail.json
+++ b/recipes/static_checks.expected/regexp.fail.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/regexp.pass.json b/recipes/static_checks.expected/regexp.pass.json
index 1ca8878..4985d24 100644
--- a/recipes/static_checks.expected/regexp.pass.json
+++ b/recipes/static_checks.expected/regexp.pass.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.case.json b/recipes/static_checks.expected/requires.case.json
index 12e740d..46c7763 100644
--- a/recipes/static_checks.expected/requires.case.json
+++ b/recipes/static_checks.expected/requires.case.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.first-paragraph.json b/recipes/static_checks.expected/requires.first-paragraph.json
index 3906496..13e797a 100644
--- a/recipes/static_checks.expected/requires.first-paragraph.json
+++ b/recipes/static_checks.expected/requires.first-paragraph.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.forbid.json b/recipes/static_checks.expected/requires.forbid.json
index e4bec01..7f69387 100644
--- a/recipes/static_checks.expected/requires.forbid.json
+++ b/recipes/static_checks.expected/requires.forbid.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.middle-paragraph.json b/recipes/static_checks.expected/requires.middle-paragraph.json
index 9c13f18..39ca1a9 100644
--- a/recipes/static_checks.expected/requires.middle-paragraph.json
+++ b/recipes/static_checks.expected/requires.middle-paragraph.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.multiple-warnings.json b/recipes/static_checks.expected/requires.multiple-warnings.json
index b3b8ed9..3eb2ff2 100644
--- a/recipes/static_checks.expected/requires.multiple-warnings.json
+++ b/recipes/static_checks.expected/requires.multiple-warnings.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.no-requires.json b/recipes/static_checks.expected/requires.no-requires.json
index 0393ecd..816b3f3 100644
--- a/recipes/static_checks.expected/requires.no-requires.json
+++ b/recipes/static_checks.expected/requires.no-requires.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.require.json b/recipes/static_checks.expected/requires.require.json
index 581c213..c4e82f5 100644
--- a/recipes/static_checks.expected/requires.require.json
+++ b/recipes/static_checks.expected/requires.require.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.required.json b/recipes/static_checks.expected/requires.required.json
index d5ba138..1541b98 100644
--- a/recipes/static_checks.expected/requires.required.json
+++ b/recipes/static_checks.expected/requires.required.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/requires.requires-with-autosubmit.json b/recipes/static_checks.expected/requires.requires-with-autosubmit.json
index 0133960..2edc4ef 100644
--- a/recipes/static_checks.expected/requires.requires-with-autosubmit.json
+++ b/recipes/static_checks.expected/requires.requires-with-autosubmit.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"auto-submit\": {@@@",
diff --git a/recipes/static_checks.expected/requires.valid.json b/recipes/static_checks.expected/requires.valid.json
index 1c9565e..25392b4 100644
--- a/recipes/static_checks.expected/requires.valid.json
+++ b/recipes/static_checks.expected/requires.valid.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/tested.tested-fail.json b/recipes/static_checks.expected/tested.tested-fail.json
index 2471b82..3d5efde 100644
--- a/recipes/static_checks.expected/tested.tested-fail.json
+++ b/recipes/static_checks.expected/tested.tested-fail.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/tested.tested-pass.json b/recipes/static_checks.expected/tested.tested-pass.json
index feabe5d..ec187d8 100644
--- a/recipes/static_checks.expected/tested.tested-pass.json
+++ b/recipes/static_checks.expected/tested.tested-pass.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.expected/tested.tested-skip.json b/recipes/static_checks.expected/tested.tested-skip.json
index b3c6233..138773b 100644
--- a/recipes/static_checks.expected/tested.tested-skip.json
+++ b/recipes/static_checks.expected/tested.tested-skip.json
@@ -144,6 +144,7 @@
"timeout": 600,
"~followup_annotations": [
"@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": 1234, @@@",
"@@@STEP_LOG_LINE@json.output@ \"current_revision\": \"HASH\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"labels\": {}, @@@",
"@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
diff --git a/recipes/static_checks.proto b/recipes/static_checks.proto
index 62b65d2..8531676 100644
--- a/recipes/static_checks.proto
+++ b/recipes/static_checks.proto
@@ -17,16 +17,15 @@
package recipes.pigweed.static_checks;
message Readability {
- // Label that indicates readability approval.
- string label = 1;
+ // Applicable file extensions.
+ repeated string file_extensions = 1;
- // File extensions that, if modified in the current CL, require the above
- // label to have an "approved" vote.
- repeated string file_extensions = 2;
+ // Label to vote on to indicate this CL is trivial with respect to the above
+ // file extensions.
+ string trivial_label = 2;
- // Level of approval required. Default is "approved" (max positive vote on
- // label) but with this "recommended" (positive non-max vote on label) is ok.
- bool allow_recommended = 3;
+ // Number of lines below which the CL is assumed to be trivial.
+ int32 line_number_threshold = 3;
}
message InputProperties {
diff --git a/recipes/static_checks.py b/recipes/static_checks.py
index eb4819b..78ed376 100644
--- a/recipes/static_checks.py
+++ b/recipes/static_checks.py
@@ -218,56 +218,42 @@
def _check_readability(api, details, comments, readability):
- """Check that the readability label has been approved.
+ """Set the trivial readability label if the CL is trivial."""
- Check that the readability label has been approved if files matching
- readability.file_extensions are in the CL.
- """
+ extensions = tuple(str(x) for x in readability.file_extensions)
- with api.step.nest(readability.label):
- if api.cq.active and api.cq.run_mode != 'FULL_RUN':
- with api.step.nest('dry run'):
- return
-
- if readability.label not in details['labels']:
- with api.step.nest('no such label'):
- return
-
- # "approved" would mean +2 if values are [-2,+2].
- if 'approved' in details['labels'][readability.label]:
- with api.step.nest('label approved'):
- return
-
- # "recommended" would mean +1 if values are [-2,+2].
- if readability.allow_recommended:
- if 'recommended' in details['labels'][readability.label]:
- with api.step.nest('label recommended'):
- return
-
- skip_line = 'Skip-{}-Justification'.format(readability.label)
-
- match = api.util.find_matching_comment(
- re.compile(r'{}: \w+'.format(skip_line)), comments,
- )
- if match:
- with api.step.nest('found {}'.format(skip_line)):
+ with api.step.nest(readability.trivial_label):
+ if readability.trivial_label not in details['labels']:
+ with api.step.nest('trivial label not present for repo'):
return
current_revision = details['revisions'][details['current_revision']]
- files = sorted(current_revision.get('files', ()))
- with api.step.nest('files') as pres:
- pres.step_summary_text = '\n'.join(files)
- for path in files:
- if path.endswith(tuple(readability.file_extensions)):
- raise api.step.StepFailure(
- '{} not set but {} changed. If necessary this requirement '
- 'can be bypassed by adding a Gerrit comment like '
- '"{}: <reason>"'.format(readability.label, path, skip_line,)
- )
+ changed_lines = 0
+ changed_files = 0
+ for filename, entry in current_revision['files'].items():
+ # TODO(b/240290899) Maybe don't count deleted files?
+ if filename.endswith(extensions):
+ changed_files += 1
+ changed_lines += entry.get('lines_deleted', 0)
+ changed_lines += entry.get('lines_inserted', 0)
- with api.step.nest('no matching files'):
+ with api.step.nest(f'changed files {changed_files}'):
pass
+ with api.step.nest(f'changed lines {changed_lines}'):
+ pass
+
+ with api.step.nest(f'threshold {readability.line_number_threshold}'):
+ pass
+
+ if changed_files and changed_lines < readability.line_number_threshold:
+ api.gerrit.set_review(
+ f'set label',
+ str(details['_number']),
+ labels={readability.trivial_label: 1},
+ notify='OWNER',
+ )
+
def RunSteps(api, props):
res = api.util.get_change_with_comments()
@@ -340,6 +326,9 @@
assert v in "approved recommended disliked rejected".split()
labels[k][v] = True
+ if isinstance(files, (list, tuple)):
+ files = {x: {'lines_inserted': 20, 'lines_deleted': 20} for x in files}
+
return api.step_data(
'change details',
api.json.output(
@@ -353,13 +342,14 @@
'message': msg,
'parents': [{'commit': 'PARENT',}],
},
- 'files': {x: {} for x in files},
+ 'files': files,
'description': description,
}
},
'owner': {'email': owner},
'revert_of': revert_of,
'labels': labels,
+ '_number': 1234,
},
),
)
@@ -559,84 +549,143 @@
final_props = {
'readability': [
{
- 'label': 'Readability',
+ 'trivial_label': 'Readability-Trivial',
'file_extensions': (
'.c .cc .cpp .cxx .C .h .hh .hpp .hxx .H'.split()
),
- 'allow_recommended': True,
+ 'line_number_threshold': 10,
},
],
}
+ votes = kwargs.pop('votes', {'Readability-Trivial': None})
+
return (
api.status_check.test('readability.{}'.format(name), status=status)
+ api.properties(**final_props)
- + change_details(api, msg=msg, **kwargs)
+ + change_details(api, msg=msg, votes=votes, **kwargs,)
+ api.cq(api.cq.FULL_RUN)
)
- def comment(message='unrelated'):
- return api.util.change_comment(message, prefix='')
+ def assert_changed_files(num):
+ return api.post_process(
+ post_process.MustRun, f'Readability-Trivial.changed files {num}',
+ )
+
+ def assert_changed_lines(num):
+ return api.post_process(
+ post_process.MustRun, f'Readability-Trivial.changed lines {num}',
+ )
+
+ def assert_set():
+ return api.post_process(
+ post_process.MustRun, 'Readability-Trivial.set label',
+ )
+
+ def assert_not_set():
+ return api.post_process(
+ post_process.DoesNotRun, 'Readability-Trivial.set label',
+ )
yield (
- test('no_cpp_changes', votes={'Readability': None})
+ test('no_label', votes={})
+ api.checkout.try_test_data()
- + must_run(api, 'Readability.no matching files')
+ + assert_not_set()
+ )
+
+ yield (
+ test('no_cpp_changes')
+ + api.checkout.try_test_data()
+ + assert_changed_files(0)
+ + assert_changed_lines(0)
+ + assert_not_set()
+ )
+
+ yield (
+ test('inserted_nontrivial', files={'foo.cpp': {'lines_inserted': 15}},)
+ + api.checkout.try_test_data()
+ + assert_changed_files(1)
+ + assert_changed_lines(15)
+ + assert_not_set()
+ )
+
+ yield (
+ test('inserted_trivial', files={'foo.cpp': {'lines_inserted': 5}},)
+ + api.checkout.try_test_data()
+ + assert_changed_files(1)
+ + assert_changed_lines(5)
+ + assert_set()
+ )
+
+ yield (
+ test('removed_nontrivial', files={'foo.cpp': {'lines_deleted': 15}})
+ + api.checkout.try_test_data()
+ + assert_changed_files(1)
+ + assert_changed_lines(15)
+ + assert_not_set()
+ )
+
+ yield (
+ test('removed_trivial', files={'foo.cpp': {'lines_deleted': 5}})
+ + api.checkout.try_test_data()
+ + assert_changed_files(1)
+ + assert_changed_lines(5)
+ + assert_set()
)
yield (
test(
- 'has_cpp_changes_no_vote',
- files=('foo.cpp',),
- votes={'Readability': None},
- status='failure',
+ 'mixed_nontrivial',
+ files={'foo.cpp': {'lines_inserted': 5, 'lines_deleted': 5}},
)
+ api.checkout.try_test_data()
- + comment()
+ + assert_changed_files(1)
+ + assert_changed_lines(10)
+ + assert_not_set()
)
yield (
test(
- 'has_cpp_changes_approved',
- files=('foo.cpp',),
- votes={'Readability': 'approved'},
+ 'mixed_trivial',
+ files={'foo.cpp': {'lines_inserted': 5, 'lines_deleted': 4}},
)
+ api.checkout.try_test_data()
- + must_run(api, 'Readability.label approved')
+ + assert_changed_files(1)
+ + assert_changed_lines(9)
+ + assert_set()
)
yield (
test(
- 'has_cpp_changes_recommended',
- files=('foo.cpp',),
- votes={'Readability': 'recommended'},
+ 'multiple_nontrivial',
+ files={
+ 'foo.cpp': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.hpp': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.cc': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.hh': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.c': {'lines_inserted': 1, 'lines_deleted': 1},
+ },
)
+ api.checkout.try_test_data()
- + must_run(api, 'Readability.label recommended')
+ + assert_changed_files(5)
+ + assert_changed_lines(10)
+ + assert_not_set()
)
yield (
test(
- 'has_cpp_changes_justification',
- files=('foo.cpp',),
- votes={'Readability': None},
+ 'multiple_trivial',
+ files={
+ 'foo.cpp': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.hpp': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.cc': {'lines_inserted': 1, 'lines_deleted': 1},
+ 'foo.hh': {'lines_inserted': 1, 'lines_deleted': 1},
+ },
)
+ api.checkout.try_test_data()
- + comment('Skip-Readability-Justification: because')
- + must_run(api, 'Readability.found Skip-Readability-Justification')
- )
-
- yield (
- test('has_cpp_changes_no_label', files=('foo.cpp',))
- + api.checkout.try_test_data()
- + must_run(api, 'Readability.no such label')
- )
-
- yield (
- test('dry_run', files=('foo.cpp',))
- + api.cq(api.cq.DRY_RUN)
- + api.checkout.try_test_data()
- + must_run(api, 'Readability.dry run')
+ + assert_changed_files(4)
+ + assert_changed_lines(8)
+ + assert_set()
)