summaryrefslogtreecommitdiffstats
path: root/src/CheckBasicStyle.lua
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-08-04 12:03:37 +0200
committermadmaxoft <github@xoft.cz>2014-08-04 13:20:28 +0200
commitff37192e945c9083d313ddc8924ef433e193f9c7 (patch)
treea2dee0bc49fb96dd0fff36f9e1787d253ffe4297 /src/CheckBasicStyle.lua
parentMerge pull request #1284 from Howaner/Monster (diff)
downloadcuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar.gz
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar.bz2
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar.lz
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar.xz
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.tar.zst
cuberite-ff37192e945c9083d313ddc8924ef433e193f9c7.zip
Diffstat (limited to '')
-rw-r--r--src/CheckBasicStyle.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua
index 13a6d15d2..c743a84a5 100644
--- a/src/CheckBasicStyle.lua
+++ b/src/CheckBasicStyle.lua
@@ -10,11 +10,12 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
- Spaces after comma, not before
- Opening braces not at the end of a code line
- Spaces after if, for, while
+ - Line dividers (////...) exactly 80 slashes
- (TODO) Spaces before *, /, &
- (TODO) Hex numbers with even digit length
- (TODO) Hex numbers in lowercase
- - (TODO) Line dividers (////...) exactly 80 slashes
- (TODO) Not using "* "-style doxy comment continuation lines
+ - (TODO) Multi-level indent change
Violations that cannot be checked easily:
- Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables)
@@ -165,6 +166,21 @@ local function ProcessFile(a_FileName)
for _, pat in ipairs(g_ViolationPatterns) do
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
end
+
+ local dividerStart, dividerEnd = a_Line:find("/////*")
+ if (dividerStart) then
+ if (dividerEnd ~= dividerStart + 79) then
+ ReportViolation(a_FileName, lineCounter, 1, 80, "Divider comment should have exactly 80 slashes")
+ end
+ if (dividerStart > 1) then
+ if (
+ (a_Line:sub(1, dividerStart - 1) ~= string.rep("\t", dividerStart - 1)) or -- The divider should have only indent in front of it
+ (a_Line:len() > dividerEnd + 1) -- The divider should have no other text following it
+ ) then
+ ReportViolation(a_FileName, lineCounter, 1, 80, "Divider comment shouldn't have any extra text around it")
+ end
+ end
+ end
lineCounter = lineCounter + 1
end