From c13b1931ff26a5643c9fe68ab32b1e362cfacd70 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 9 May 2015 09:25:09 +0200 Subject: More style checking. Spaces around some operators are checked. --- src/CheckBasicStyle.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/CheckBasicStyle.lua') diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index 8cd454e8f..09e64b954 100755 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -149,6 +149,27 @@ 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 *"}, + + -- 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 /"}, } -- cgit v1.2.3