Move clang-tidy rules to dotfile

as a more centralized/canonical way of handling the rules.
Also run it again and find a tiny fix courtesy of
  modernize-use-override
that regressed recently.

Bug: webrtc:424706384
Change-Id: I524b18e917e52a908a7e0596d7b4177c60954021
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403401
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45301}
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..cfa4a8f
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,9 @@
+---
+---
+  Checks:          '-*,
+                    llvm-namespace-comment,
+                    modernize-use-override,
+                    readability-static-definition-in-anonymous-namespace,
+                    readability-redundant-smartptr-get,
+                    readability-redundant-declaration'
+...
diff --git a/api/test/metrics/stdout_metrics_exporter_test.cc b/api/test/metrics/stdout_metrics_exporter_test.cc
index 93d25fb..f448ce0 100644
--- a/api/test/metrics/stdout_metrics_exporter_test.cc
+++ b/api/test/metrics/stdout_metrics_exporter_test.cc
@@ -75,7 +75,7 @@
         .stats = Metric::Stats{
             .mean = 30.0, .stddev = 10.0, .min = 20.0, .max = 40.0}};
   }
-  ~StdoutMetricsExporterTest() {
+  ~StdoutMetricsExporterTest() override {
     absl::SetFlag(&FLAGS_isolated_script_test_perf_output,
                   original_isolated_script_test_perf_output_);
   }
diff --git a/tools_webrtc/apply_clang_tidy.py b/tools_webrtc/apply_clang_tidy.py
index 5b715ad..ad64dc9 100755
--- a/tools_webrtc/apply_clang_tidy.py
+++ b/tools_webrtc/apply_clang_tidy.py
@@ -9,6 +9,9 @@
 # be found in the AUTHORS file in the root of the source tree.
 #
 # Run clang-tidy in the webrtc source directory.
+# The list of checks that is getting applied is in the toplevel
+# .clang-tidy file. To add a new check, add it to that file and run
+# the script.
 #
 # clang-tidy needs to be added to the .gclient file:
 # Example .gclient file:
@@ -43,18 +46,6 @@
 _TIDY_BINARY = _LLVM + "build/bin/clang-tidy"
 _REPLACEMENTS_BINARY = _LLVM + "build/bin/clang-apply-replacements"
 
-# The list of checks that is getting applied.
-# TODO: bugs.webrtc.org/424706384 - move to .clang-tidy file.
-_CHECKS = [
-    "-*",  # disable all checks by default.
-    "llvm-namespace-comment",
-    # conflicts with IWYU.
-    #"modernize-deprecated-headers",
-    "readability-static-definition-in-anonymous-namespace",
-    "readability-redundant-smartptr-get",
-]
-
-
 def _valid_dir(path: str) -> pathlib.Path:
     """Checks if the given path is an existing dir
     relative to the current working directory.
@@ -108,8 +99,7 @@
     clang_tidy_cmd = (work_dir / _TIDY_RUNNER, "-p", work_dir,
                       "-clang-tidy-binary", work_dir / _TIDY_BINARY,
                       "-clang-apply-replacements-binary",
-                      work_dir / _REPLACEMENTS_BINARY,
-                      "-checks=" + ",".join(_CHECKS), "-fix")
+                      work_dir / _REPLACEMENTS_BINARY, "-fix")
     subprocess.run(clang_tidy_cmd,
                    capture_output=False,
                    text=True,