From d7da2ecade4e44039df086f9b9167d544a17a100 Mon Sep 17 00:00:00 2001 From: Andi Date: Wed, 27 Apr 2022 09:10:21 +0000 Subject: [PATCH] Bug 1766262 - move clang-tidy arguments for clangd from cli to spcific file. r=marco Differential Revision: https://phabricator.services.mozilla.com/D144577 --- .gitignore | 1 + .hgignore | 1 + python/mozbuild/mozbuild/backend/mach_commands.py | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 47ff16638659..ee8e24679e42 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ ID **/.projectile # User files that may appear at the root +/.clang-tidy /.mozconfig* /mozconfig* /configure diff --git a/.hgignore b/.hgignore index 9c60201a7c1d..2f71d75388aa 100644 --- a/.hgignore +++ b/.hgignore @@ -27,6 +27,7 @@ compile_commands\.json \.projectile # User files that may appear at the root +^\.clang-tidy ^\.mozconfig ^mozconfig* ^configure$ diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py index 6cfe2438aaf7..80986117a261 100644 --- a/python/mozbuild/mozbuild/backend/mach_commands.py +++ b/python/mozbuild/mozbuild/backend/mach_commands.py @@ -249,11 +249,19 @@ def setup_vscode(command_context, vscode_cmd): "--pch-storage", "memory", "--clang-tidy", - "--clang-tidy-checks", - ",".join(clang_tidy_cfg.checks), ], } + clang_tidy = {} + clang_tidy["Checks"] = ",".join(clang_tidy_cfg.checks) + clang_tidy.update(clang_tidy_cfg.checks_config) + + # Write .clang-tidy yml + import yaml + + with open(".clang-tidy", "w") as file: + yaml.dump(clang_tidy, file) + # Load the existing .vscode/settings.json file, to check if if needs to # be created or updated. try: