summaryrefslogtreecommitdiffstats
path: root/src/CheckBasicStyle.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-09 13:22:59 +0200
committerMattes D <github@xoft.cz>2015-05-09 13:22:59 +0200
commitca949447eefe74804e677fff5a46a1f18a826901 (patch)
tree911736baccf3617a13f6b7e04ebbfe3fe035fb50 /src/CheckBasicStyle.lua
parentRabbit and cooked rabbit now stackable (diff)
parentAdded check against "Type const &" and "Type const *". (diff)
downloadcuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar.gz
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar.bz2
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar.lz
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar.xz
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.tar.zst
cuberite-ca949447eefe74804e677fff5a46a1f18a826901.zip
Diffstat (limited to '')
-rwxr-xr-xsrc/CheckBasicStyle.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua
index 8cd454e8f..9ff47634d 100755
--- a/src/CheckBasicStyle.lua
+++ b/src/CheckBasicStyle.lua
@@ -149,6 +149,39 @@ local g_ViolationPatterns =
-- No space before a closing parenthesis:
{" %)", "Remove the space before \")\""},
+
+ -- Check spaces around "+":
+ {"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
+ {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
+ --[[
+ -- Cannot check these because of text such as "X+" and "+2" appearing in some comments.
+ {"^[a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"},
+ {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"},
+ {"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
+ {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
+ --]]
+
+ -- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words
+
+ -- Check spaces around "*":
+ {"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
+ {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
+ {"^[a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"},
+ {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"},
+
+ -- Check spaces around "/":
+ {"^[a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"},
+ {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"},
+
+ -- Check spaces around "&":
+ {"^[a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"},
+ {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"},
+ {"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
+ {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
+
+ -- We don't like "Type const *" and "Type const &". Use "const Type *" and "const Type &" instead:
+ {"const %&", "Use 'const Type &' instead of 'Type const &'"},
+ {"const %*", "Use 'const Type *' instead of 'Type const *'"},
}