hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndimi...@apache.org
Subject hbase git commit: HBASE-12896 checkstyle report diff tool
Date Thu, 22 Jan 2015 22:26:07 GMT
Repository: hbase
Updated Branches:
  refs/heads/master e370baf8a -> 508085fe5


HBASE-12896 checkstyle report diff tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/508085fe
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/508085fe
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/508085fe

Branch: refs/heads/master
Commit: 508085fe5a6bebb48edfabdf84671c9d83288e53
Parents: e370baf
Author: Nick Dimiduk <ndimiduk@apache.org>
Authored: Wed Jan 21 12:21:18 2015 -0800
Committer: Nick Dimiduk <ndimiduk@apache.org>
Committed: Thu Jan 22 14:12:46 2015 -0800

----------------------------------------------------------------------
 dev-support/checkstyle_report.py | 63 +++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/508085fe/dev-support/checkstyle_report.py
----------------------------------------------------------------------
diff --git a/dev-support/checkstyle_report.py b/dev-support/checkstyle_report.py
new file mode 100644
index 0000000..ce4a0dd
--- /dev/null
+++ b/dev-support/checkstyle_report.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+##
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##
+# script to diff results of checkstyle-result.xml output. Find the result files
+# under $buildRoot/target
+#
+# usage: ./checkstyle_report.py <master-result.xml> <patch-result.xml>
+#
+
+import os
+import sys
+import xml.etree.ElementTree as etree
+from collections import defaultdict
+
+if len(sys.argv) != 3 :
+  print "usage: %s checkstyle-result-master.xml checkstyle-result-patch.xml" % sys.argv[0]
+  exit(1)
+
+def path_key(x):
+  path = x.attrib['name']
+  return path[path.find('hbase-'):]
+
+def print_row(path, master_errors, patch_errors):
+    print '%s\t%s\t%s' % (k,master_dict[k],child_errors)
+
+master = etree.parse(sys.argv[1])
+patch = etree.parse(sys.argv[2])
+
+master_dict = defaultdict(int)
+
+for child in master.getroot().getchildren():
+    if child.tag != 'file':
+        continue
+    child_errors = len(child.getchildren())
+    if child_errors == 0:
+        continue
+    master_dict[path_key(child)] = child_errors
+
+for child in patch.getroot().getchildren():
+    if child.tag != 'file':
+        continue
+    child_errors = len(child.getchildren())
+    if child_errors == 0:
+        continue
+    k = path_key(child)
+    if child_errors > master_dict[k]:
+        print_row(k, master_dict[k], child_errors)


Mime
View raw message