diff options
| author | ruki <[email protected]> | 2023-03-28 23:06:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-28 23:06:41 +0800 |
| commit | 01b57309770a2a32db635841bfe666c51c9337a4 (patch) | |
| tree | de8c6fa2b924b1f0848142920a6f261d2bb8854c | |
| parent | 884ec302caa4751a18a5a85de04e64a42ac8b210 (diff) | |
add fix for clang.tidy #3537
| -rw-r--r-- | xmake/modules/private/check/checkers/clang/tidy.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/xmake/modules/private/check/checkers/clang/tidy.lua b/xmake/modules/private/check/checkers/clang/tidy.lua index 9b0d9b21e..6498ab093 100644 --- a/xmake/modules/private/check/checkers/clang/tidy.lua +++ b/xmake/modules/private/check/checkers/clang/tidy.lua @@ -30,19 +30,22 @@ import("private.action.require.impl.install_packages") -- the clang.tidy options local options = { - {"l", "list", "k", nil, "Show the clang-tidy checks list."}, - {'j', "jobs", "kv", tostring(os.default_njob()), + {"l", "list", "k", nil, "Show the clang-tidy checks list."}, + {'j', "jobs", "kv", tostring(os.default_njob()), "Set the number of parallel check jobs."}, - {nil, "create", "k", nil, "Create a .clang-tidy file."}, + {nil, "fix", "k", nil, "Apply suggested fixes."}, + {nil, "fix_errors", "k", nil, "Apply suggested errors fixes."}, + {nil, "fix_notes", "k", nil, "Apply suggested notes fixes."}, + {nil, "create", "k", nil, "Create a .clang-tidy file."}, {nil, "configfile", "kv", nil, "Specify the path of .clang-tidy or custom config file"}, - {nil, "checks", "kv", nil, "Set the given checks.", + {nil, "checks", "kv", nil, "Set the given checks.", "e.g.", " - xmake check clang.tidy --checks=\"*\""}, - {'f', "files", "v", nil, "Set files path with pattern", + {'f', "files", "v", nil, "Set files path with pattern", "e.g.", " - xmake check clang.tidy -f src/main.c", " - xmake check clang.tidy -f 'src/*.c" .. path.envsep() .. "src/**.cpp'"}, - {nil, "target", "v", nil, "Check the sourcefiles of the given target.", + {nil, "target", "v", nil, "Check the sourcefiles of the given target.", ".e.g", " - xmake check clang.tidy", " - xmake check clang.tidy [target]"} @@ -76,6 +79,15 @@ function _check_sourcefile(clang_tidy, sourcefile, opt) if opt.checks then table.insert(argv, "--checks=" .. opt.checks) end + if opt.fix then + table.insert(argv, "--fix") + end + if opt.fix_errors then + table.insert(argv, "--fix-errors") + end + if opt.fix_notes then + table.insert(argv, "--fix-notes") + end if opt.compdbfile then table.insert(argv, "-p") table.insert(argv, opt.compdbfile) |
