You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/12/04 22:57:48 UTC

[kudu] 01/02: clang_tidy_gerrit: disable readability-magic-numbers check

This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 9d14d74aaf61d916f01ccc736ec416dc087aa658
Author: Adar Dembo <ad...@cloudera.com>
AuthorDate: Wed Dec 4 12:05:28 2019 -0800

    clang_tidy_gerrit: disable readability-magic-numbers check
    
    Although useful, we lean quite heavily on magic numbers in tests, and
    as there's no way to disable this check in specific files, let's disable it
    across the board.
    
    Change-Id: I26c39915f4fc96078116552286248fb3eb3704cf
    Reviewed-on: http://gerrit.cloudera.org:8080/14833
    Tested-by: Adar Dembo <ad...@cloudera.com>
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
 build-support/clang_tidy_gerrit.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/build-support/clang_tidy_gerrit.py b/build-support/clang_tidy_gerrit.py
index 9c8552e..35b206a 100755
--- a/build-support/clang_tidy_gerrit.py
+++ b/build-support/clang_tidy_gerrit.py
@@ -45,6 +45,12 @@ GERRIT_PASSWORD = os.getenv('TIDYBOT_PASSWORD')
 
 GERRIT_URL = "https://gerrit.cloudera.org"
 
+DISABLED_TIDY_CHECKS=[
+    # Although useful in production code, we use magic numbers liberally in
+    # tests, and many would be net less clear as named constants.
+    'readability-magic-numbers',
+]
+
 def run_tidy(sha="HEAD", is_rev_range=False):
     diff_cmdline = ["git", "diff" if is_rev_range else "show", sha]
 
@@ -62,9 +68,11 @@ def run_tidy(sha="HEAD", is_rev_range=False):
             "--",
             path]
         subprocess.check_call(cmd, stdout=patch_file, cwd=ROOT)
+        checks_arg_value = ",".join([ "-" + c for c in DISABLED_TIDY_CHECKS ])
         cmdline = [CLANG_TIDY_DIFF,
                    "-clang-tidy-binary", CLANG_TIDY,
                    "-p0",
+                   "-checks=" + checks_arg_value,
                    "--",
                    "-DCLANG_TIDY"] + compile_flags.get_flags()
         return subprocess.check_output(