linter: Add a PRESUBMIT check for example/all.yaml
Work towards https://github.com/dart-lang/sdk/issues/53578 Change-Id: Ia07d999abc2fcf4b8195c9f7688799bc099a1d88 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341385 Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Alexander Thomas <athom@google.com> Reviewed-by: Jonas Termansen <sortie@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
b305954b60
commit
7320da0d19
+20
-4
@@ -298,14 +298,13 @@ def _CheckClangTidy(input_api, output_api):
|
||||
def _CheckAnalyzerFiles(input_api, output_api):
|
||||
"""Run analyzer checks on source files."""
|
||||
|
||||
# The first (and so far, only) check, is to verify the "error fix status"
|
||||
# file.
|
||||
relevant_files = [
|
||||
# Verify the "error fix status" file.
|
||||
code_files = [
|
||||
"pkg/analyzer/lib/src/error/error_code_values.g.dart",
|
||||
"pkg/linter/lib/src/rules.dart",
|
||||
]
|
||||
|
||||
if any(f.LocalPath() in relevant_files for f in input_api.AffectedFiles()):
|
||||
if any(f.LocalPath() in code_files for f in input_api.AffectedFiles()):
|
||||
args = [
|
||||
"tools/sdks/dart-sdk/bin/dart",
|
||||
"pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart",
|
||||
@@ -320,6 +319,23 @@ def _CheckAnalyzerFiles(input_api, output_api):
|
||||
long_text=stdout)
|
||||
]
|
||||
|
||||
# Verify the linter's `example/all.yaml` file.
|
||||
if any(f.LocalPath().startswith('pkg/linter/lib/src/rules')
|
||||
for f in input_api.AffectedFiles()):
|
||||
args = [
|
||||
"tools/sdks/dart-sdk/bin/dart",
|
||||
"pkg/analysis_server/tool/checks/check_all_yaml.dart",
|
||||
]
|
||||
stdout = input_api.subprocess.check_output(args).strip()
|
||||
if not stdout:
|
||||
return []
|
||||
|
||||
return [
|
||||
output_api.PresubmitError(
|
||||
"The check_all_yaml linter tool revealed issues:",
|
||||
long_text=stdout)
|
||||
]
|
||||
|
||||
# TODO(srawlins): Check more:
|
||||
# * "verify_sorted" for individual modified (not deleted) files in
|
||||
# Analyzer-team-owned directories.
|
||||
|
||||
Reference in New Issue
Block a user