0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-21 12:39:08 +01:00

SERVER-97134 Only promote clang-tidy warnings to errors in CI scripts (#29191)

GitOrigin-RevId: cf820864cbfde8390760699dba27d28b97dddf96
This commit is contained in:
Mathias Stearn 2024-11-15 17:04:32 +01:00 committed by MongoDB Bot
parent 2bf401fcd9
commit 02ce1fb959
3 changed files with 4 additions and 5 deletions

View File

@ -152,7 +152,6 @@ Checks: '-*,
-readability-string-compare, -readability-string-compare,
-readability-uniqueptr-delete-release -readability-uniqueptr-delete-release
' '
WarningsAsErrors: '*,-clang-diagnostic-builtin-macro-redefined'
HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@)' HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@)'
CheckOptions: CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros - key: bugprone-assert-side-effect.AssertMacros

View File

@ -1,5 +1,5 @@
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands") load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@npm//:defs.bzl", "npm_link_all_packages")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -31,15 +31,14 @@ genrule(
# Note: we use sed to substitute the known good value `build/compiledb/mongo`; testing # Note: we use sed to substitute the known good value `build/compiledb/mongo`; testing
# has confirmed that this is the correct value. # has confirmed that this is the correct value.
# We also use it to append a line to opt-in to warnings as errors.
cmd = """ cmd = """
cp $(location .clang-tidy.in) $@ && \ cp $(location .clang-tidy.in) $@ && \
sed -i 's|@MONGO_BUILD_DIR@|$(RULEDIR)/src/mongo|g' $@ sed -i 's|@MONGO_BUILD_DIR@|$(RULEDIR)/src/mongo|g ; $$aWarningsAsErrors: "*"' $@
""", """,
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
refresh_compile_commands( refresh_compile_commands(
name = "compiledb", name = "compiledb",
exclude_external_sources = True, exclude_external_sources = True,

View File

@ -50,6 +50,7 @@ def _clang_tidy_executor(
clang_tidy_filename, clang_tidy_filename,
f"-export-fixes={output_filename_fixes}", f"-export-fixes={output_filename_fixes}",
f"-config={json.dumps(clang_tidy_cfg)}", f"-config={json.dumps(clang_tidy_cfg)}",
"--warnings-as-errors=*,-clang-diagnostic-builtin-macro-redefined",
] ]
proc = subprocess.run(clang_tidy_command, capture_output=True, check=False) proc = subprocess.run(clang_tidy_command, capture_output=True, check=False)
files_to_parse = None files_to_parse = None