summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-19 15:25:28 +0200
committermadmaxoft <github@xoft.cz>2014-07-19 15:25:28 +0200
commite612d07eeae351cbdb413dbb8fb543284ea46628 (patch)
tree805d219e82e1a5a669d024d51e415b05d967f431
parentCode style: Fixed braces on separate lines. (diff)
downloadcuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar.gz
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar.bz2
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar.lz
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar.xz
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.tar.zst
cuberite-e612d07eeae351cbdb413dbb8fb543284ea46628.zip
-rw-r--r--src/CheckBasicStyle.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua
index 14e3caa26..e4597a426 100644
--- a/src/CheckBasicStyle.lua
+++ b/src/CheckBasicStyle.lua
@@ -7,10 +7,11 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
- Trailing whitespace on non-empty lines
- Two spaces between code and line-end comment ("//")
- Spaces after comma, not before
+ - Opening braces not at the end of a code line
+ - (TODO) Spaces after if, for, while
- (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 comment continuation lines
@@ -121,6 +122,9 @@ local g_ViolationPatterns =
-- Check that all commas have spaces after them and not in front of them:
{" ,", "Extra space before a \",\""},
{",[^%s\"%%]", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting
+
+ -- Check that opening braces are not at the end of a code line:
+ {"[^%s].-{\n?$", "Brace should be on a separate line"},
}
@@ -145,7 +149,7 @@ local function ProcessFile(a_FileName)
if ((lastChar ~= 13) and (lastChar ~= 10)) then
local numLines = 1
string.gsub(all, "\n", function() numLines = numLines + 1 end) -- Count the number of line-ends
- ReportViolation(a_FileName, numLines, "Missing empty line at file end")
+ ReportViolation(a_FileName, numLines, 1, 1, "Missing empty line at file end")
return
end