summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-19 15:08:49 +0200
committermadmaxoft <github@xoft.cz>2014-07-19 15:08:49 +0200
commit822d83009d9ccc698e930907a707ba2451e95a20 (patch)
tree8e3d0ba3bdc4eba767c7006a321f606f04b15a5f
parentFixed spaces after commas in protocol data. (diff)
downloadcuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar.gz
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar.bz2
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar.lz
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar.xz
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.tar.zst
cuberite-822d83009d9ccc698e930907a707ba2451e95a20.zip
-rw-r--r--src/CheckBasicStyle.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua
index 6aad4125d..14e3caa26 100644
--- a/src/CheckBasicStyle.lua
+++ b/src/CheckBasicStyle.lua
@@ -6,13 +6,13 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
- Tabs for indentation, spaces for alignment
- Trailing whitespace on non-empty lines
- Two spaces between code and line-end comment ("//")
- - Spaces after comma, not before (except in #define argument list)
+ - Spaces after comma, not before
- (TODO) Spaces before *, /, &
- (TODO) Hex numbers with even digit length
- (TODO) Hex numbers in lowercase
- (TODO) Braces not on the end of line
- (TODO) Line dividers (////...) exactly 80 slashes
- - (TODO) Not using "* "-style doxy comments continuation lines
+ - (TODO) Not using "* "-style doxy comment continuation lines
Violations that cannot be checked easily:
- Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables)
@@ -79,8 +79,8 @@ local g_NumViolations = 0
--- Reports one violation
-- Pretty-prints the message
-- Also increments g_NumViolations
-local function ReportViolation(a_FileName, a_LineNumber, a_Message)
- print(a_FileName .. "(" .. a_LineNumber .. "): " .. a_Message)
+local function ReportViolation(a_FileName, a_LineNumber, a_PatStart, a_PatEnd, a_Message)
+ print(a_FileName .. "(" .. a_LineNumber .. "): " .. a_PatStart .. " .. " .. a_PatEnd .. ": " .. a_Message)
g_NumViolations = g_NumViolations + 1
end
@@ -94,7 +94,7 @@ local function ReportViolationIfFound(a_Line, a_FileName, a_LineNum, a_Pattern,
if not(patStart) then
return
end
- ReportViolation(a_FileName, a_LineNum, a_Message .. "(" .. patStart .. " .. " .. patEnd .. ")")
+ ReportViolation(a_FileName, a_LineNum, patStart, patEnd, a_Message)
end
@@ -120,7 +120,7 @@ local g_ViolationPatterns =
-- Check that all commas have spaces after them and not in front of them:
{" ,", "Extra space before a \",\""},
- {"^\t*[^#].*,[^%s]", "Needs a space after a \",\""}, -- Anywhere except lines starting with "#" - avoid #define params
+ {",[^%s\"%%]", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting
}