1
0

BasicStyleCheck: Dividers are exactly 80 slashes.

This commit is contained in:
madmaxoft 2014-08-04 12:03:37 +02:00
parent b18794d835
commit ff37192e94
2 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -8,7 +8,7 @@
///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// cPlayerLookCheck
class cPlayerLookCheck :
public cPlayerListCallback