BasicStyleCheck: Dividers are exactly 80 slashes.
This commit is contained in:
parent
b18794d835
commit
ff37192e94
@ -10,11 +10,12 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
|
|||||||
- Spaces after comma, not before
|
- Spaces after comma, not before
|
||||||
- Opening braces not at the end of a code line
|
- Opening braces not at the end of a code line
|
||||||
- Spaces after if, for, while
|
- Spaces after if, for, while
|
||||||
|
- Line dividers (////...) exactly 80 slashes
|
||||||
- (TODO) Spaces before *, /, &
|
- (TODO) Spaces before *, /, &
|
||||||
- (TODO) Hex numbers with even digit length
|
- (TODO) Hex numbers with even digit length
|
||||||
- (TODO) Hex numbers in lowercase
|
- (TODO) Hex numbers in lowercase
|
||||||
- (TODO) Line dividers (////...) exactly 80 slashes
|
|
||||||
- (TODO) Not using "* "-style doxy comment continuation lines
|
- (TODO) Not using "* "-style doxy comment continuation lines
|
||||||
|
- (TODO) Multi-level indent change
|
||||||
|
|
||||||
Violations that cannot be checked easily:
|
Violations that cannot be checked easily:
|
||||||
- Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables)
|
- 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
|
for _, pat in ipairs(g_ViolationPatterns) do
|
||||||
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
|
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
|
||||||
end
|
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
|
lineCounter = lineCounter + 1
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cPlayerLookCheck
|
// cPlayerLookCheck
|
||||||
class cPlayerLookCheck :
|
class cPlayerLookCheck :
|
||||||
public cPlayerListCallback
|
public cPlayerListCallback
|
||||||
|
Loading…
Reference in New Issue
Block a user