mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Use canned CheckPatchFormatted instead of our own linting
This calls into git cl format, so it should always be consistent with that. Removes all the old clang-format scripts and dependencies. Change-Id: I879577a5c1df81617ec0d33096ce7884f4413659 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24840 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ce665b4624
commit
82961129b0
32
PRESUBMIT.py
32
PRESUBMIT.py
@@ -17,40 +17,14 @@ import platform
|
||||
import subprocess
|
||||
|
||||
|
||||
def _DoClangFormat(input_api, output_api):
|
||||
if platform.system() == 'Linux' and platform.architecture()[0] == '64bit':
|
||||
clang_format_path = 'buildtools/linux64/clang-format'
|
||||
elif platform.system() == 'Darwin':
|
||||
clang_format_path = 'buildtools/mac/clang-format'
|
||||
else:
|
||||
return [output_api.PresubmitNotifyResult('Skipping clang-format')]
|
||||
|
||||
# We need to know which commit to diff against. It doesn't seem to be exposed anywhere
|
||||
# except in that private member of presubmit_support.Change. This is likely to break
|
||||
# but hopefully we have an updated clang-format in CPID/GS before it does.
|
||||
upstream_commit = input_api.change._upstream
|
||||
if upstream_commit == None:
|
||||
return []
|
||||
|
||||
lint_cmd = [
|
||||
'scripts/lint_clang_format.sh', clang_format_path, upstream_commit
|
||||
]
|
||||
|
||||
# Call the linting script and forward the output as a notification or as an error
|
||||
try:
|
||||
output = subprocess.check_output(lint_cmd)
|
||||
return [output_api.PresubmitNotifyResult(output)]
|
||||
except subprocess.CalledProcessError as e:
|
||||
return [output_api.PresubmitError(e.output)]
|
||||
|
||||
|
||||
def _DoCommonChecks(input_api, output_api):
|
||||
results = []
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangedLUCIConfigs(input_api, output_api))
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckGNFormatted(input_api, output_api))
|
||||
results.extend(_DoClangFormat(input_api, output_api))
|
||||
input_api.canned_checks.CheckPatchFormatted(input_api,
|
||||
output_api,
|
||||
check_python=True))
|
||||
return results
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user