summaryrefslogtreecommitdiffstats
path: root/src/CheckBasicStyle.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-05 12:58:30 +0100
committerMattes D <github@xoft.cz>2014-12-05 12:58:48 +0100
commit21d5374b979329aa04e0ee5af63becca08439d86 (patch)
tree9c579ddcaf78beb1c5e2d0c41465d1728c5c861e /src/CheckBasicStyle.lua
parentFixed reported parentheses around comparisons. (diff)
downloadcuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar.gz
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar.bz2
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar.lz
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar.xz
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.tar.zst
cuberite-21d5374b979329aa04e0ee5af63becca08439d86.zip
Diffstat (limited to 'src/CheckBasicStyle.lua')
-rw-r--r--src/CheckBasicStyle.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua
index 76ae8c325..d703c3816 100644
--- a/src/CheckBasicStyle.lua
+++ b/src/CheckBasicStyle.lua
@@ -92,6 +92,25 @@ end
local g_ViolationPatterns =
{
+ -- Parenthesis around comparisons:
+ {"==[^)]+&&", "Add parenthesis around comparison"},
+ {"&&[^(]+==", "Add parenthesis around comparison"},
+ {"==[^)]+||", "Add parenthesis around comparison"},
+ {"||[^(]+==", "Add parenthesis around comparison"},
+ {"!=[^)]+&&", "Add parenthesis around comparison"},
+ {"&&[^(]+!=", "Add parenthesis around comparison"},
+ {"!=[^)]+||", "Add parenthesis around comparison"},
+ {"||[^(]+!=", "Add parenthesis around comparison"},
+ {"<[^)T][^)]*&&", "Add parenthesis around comparison"}, -- Must take special care of templates: "template <T> fn(Args && ...)"
+ {"&&[^(]+<", "Add parenthesis around comparison"},
+ {"<[^)T][^)]*||", "Add parenthesis around comparison"}, -- Must take special care of templates: "template <T> fn(Args && ...)"
+ {"||[^(]+<", "Add parenthesis around comparison"},
+ -- Cannot check ">" because of "obj->m_Flag &&". Check at least ">=":
+ {">=[^)]+&&", "Add parenthesis around comparison"},
+ {"&&[^(]+>=", "Add parenthesis around comparison"},
+ {">=[^)]+||", "Add parenthesis around comparison"},
+ {"||[^(]+>=", "Add parenthesis around comparison"},
+
-- Check against indenting using spaces:
{"^\t* +", "Indenting with a space"},
@@ -227,6 +246,9 @@ end
+-- Remove buffering from stdout, so that the output appears immediately in IDEs:
+io.stdout:setvbuf("no")
+
-- Process all files in the AllFiles.lst file (generated by cmake):
for fnam in io.lines("AllFiles.lst") do
ProcessItem(fnam)