Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2867)

Unified Diff: tools/metrics/ukm/PRESUBMIT.py

Issue 2769223005: Create a UKM descriptions XML file (Closed)
Patch Set: Update Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/metrics/ukm/PRESUBMIT.py
diff --git a/tools/metrics/ukm/PRESUBMIT.py b/tools/metrics/ukm/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..daf3495811fe78655ab18163b542eb5c6b304fc7
--- /dev/null
+++ b/tools/metrics/ukm/PRESUBMIT.py
@@ -0,0 +1,35 @@
+# Copyright 2017 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 ukm.xml.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details on the presubmit API built into gcl.
+"""
+
+UKM_XML = 'ukm.xml'
+
+
+def CheckChange(input_api, output_api):
+ """Checks that ukm.xml is pretty-printed and well-formatted."""
+ for f in input_api.AffectedTextFiles():
+ p = f.AbsoluteLocalPath()
+ if (input_api.basename(p) == UKM_XML
+ and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
+ cwd = input_api.os_path.dirname(p)
+ exit_code = input_api.subprocess.call(
+ ['python', 'pretty_print.py', '--presubmit'], cwd=cwd)
+ if exit_code != 0:
+ return [output_api.PresubmitError(
+ 'ukm.xml is not formatted correctly; run %s/pretty_print.py '
rkaplow 2017/04/03 03:12:51 since it's a const now I would use it here
Steven Holte 2017/04/04 18:20:51 Done.
+ '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)
« no previous file with comments | « tools/metrics/ukm/OWNERS ('k') | tools/metrics/ukm/model.py » ('j') | tools/metrics/ukm/model.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698