summaryrefslogtreecommitdiff
path: root/xmake/plugins/format/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-12-01 13:09:50 +0800
committerGitHub <[email protected]>2024-12-01 13:09:50 +0800
commit50f38ee9620dd4ca794eab340e6997f22518ef55 (patch)
treee17fcc53c1b496cf4c8704a846bb43e0563c9288 /xmake/plugins/format/main.lua
parentce6f7dbd1350ba83c88c55b7ca170ae97bc54764 (diff)
parente4835887a580cf14c6b5b00372c87fe8f3bfdee4 (diff)
Merge pull request #5908 from jj683/clang-format-only-checks
Add Werror and dry-run flags for clang-format
Diffstat (limited to 'xmake/plugins/format/main.lua')
-rw-r--r--xmake/plugins/format/main.lua19
1 files changed, 17 insertions, 2 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua
index 52c64d3b0..7f807f412 100644
--- a/xmake/plugins/format/main.lua
+++ b/xmake/plugins/format/main.lua
@@ -148,8 +148,23 @@ function main()
table.insert(argv, "--style=" .. option.get("style"))
end
- -- inplace flag
- table.insert(argv, "-i")
+ if option.get("dry-run") then
+ -- do not make any changes, just show the files that would be formatted
+ table.insert(argv, "--dry-run")
+ else
+ -- inplace flag
+ table.insert(argv, "-i")
+ end
+
+ -- changes formatting warnings to errors
+ if option.get("error") then
+ table.insert(argv, "--Werror")
+ end
+
+ -- print verbose information
+ if option.get("verbose") then
+ table.insert(argv, "--verbose")
+ end
local targetname
local group_pattern = option.get("group")