blob: 86067f2405f9c787794818d13a26341b681c0767 [file] [log] [blame]
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for rappor.xml.
for more details on the presubmit API built into gcl.
def CheckChange(input_api, output_api):
"""Checks that rappor.xml is pretty-printed and well-formatted."""
for f in input_api.AffectedTextFiles():
p = f.AbsoluteLocalPath()
if (input_api.basename(p) == 'rappor.xml'
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code =
[input_api.python_executable, '', '--presubmit'],
if exit_code != 0:
return [output_api.PresubmitError(
'rappor.xml is not formatted correctly; run %s/ '
'to fix' % input_api.PresubmitLocalPath())]
return []
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)