当前位置: 首页 > 工具软件 > Vera++ > 使用案例 >

Vera++ 默认Rules文件功能解读

聂奇
2023-12-01

Vera++ Rules .tcl
 
规则文件名A2:D25注释注释翻译解释
F001Source files should not use the '\r' (CR) character源文件不应使用 '\r' (CR)字符文件名不应包含转义字符“回车”
F002File names should be well-formed文件名应符合格式检查文件名长度、目录名长度、文件路径长度
L001No trailing whitespace无尾随空白行尾空白字符应删除
L002Don't use tab characters不使用tab符号(制表符)规范中制表符应以4个空格替代
L003No leading and no trailing empty lines首尾无空行文件开始及最后无空白行
L004Line cannot be too long单行长度不应过长单行长度限制,默认长度上限为100
L005There should not be too many consecutive empty lines不应有连续的空行代码块、语句之间的间隔至多为1行
L006Source file should not be too long源文件不应过长单个文件行数限制,默认行数上限为2000行
T001One-line comments should not have forced continuation单行注释不应强制延续单行注释后不另加单行注释
T002Reserved names should not be used for preprocessor macros保留关键字不应用在(预处理宏)
T003Some keywords should be followed by a single space部分关键字后应有空格跟随关键字+" "
T004Some keywords should be immediately followed by a colon部分关键字后应有冒号跟随关键字+":"
T005Keywords break and continue should be immediately followed by a semicolon关键字break,continue后应有分号跟随break; continue;
T006Keywords return and throw should be immediately followed by a semicolon or a single space关键字return和throw后应有分号或单个空格跟随return XXX 或 return;
T007Semicolons should not be isolated by spaces or comments from the rest of the code分号不应被空白或注释与其他代码分隔开不允许 [code] ; 不允许 [code]//[comments] ;
T008Keywords catch, for, if and while should be followed by a single space关键字catch for if while 后应跟随空格if ( A == B ){}
T009Comma should not be preceded by whitespace, but should be followed by one空格不应出现在逗号之前,应在逗号后XXX, XXX, XXXX;
T010Identifiers should not be composed of 'l' and 'O' characters only标识符不应仅由字符‘l’,‘0’组成小写字母l易与数字1混淆,大写字母O易与数字0混淆
T011Curly brackets from the same pair should be either in the same line or in the same column一队对应的花括号{}应位于同一行或的同一列配对的'{''}'位置必须对应
T012Negation operator should not be used in its short form否定运算符不应使用它的简略形式!运算符,应使用“not”而不是‘!’
T013Source files should contain the copyright notice源文件应包含版权信息文件内包含版权信息注释,copyright开头
T014Source files should refer the Boost Software License源文件应参考Boost Software Licensehttp://www.boost.org/users/license.html
T015HTML links in comments and string literals should be correct检查在注释和字符串字面值中的HTML链接正确性URL地址中不得包含字符“'”,“^”;
协议应合法,如http: https: ftp:;
不允许使用file:链接至文件
T016Calls to min/max should be protected against accidental macro substitution调用min/max应防止出现意外宏带入(宏替换)
T017Unnamed namespaces are not allowed in header files头文件中不允许出现未命名的命名空间
T018using namespace are not allowed in header filesusing namespace不允许出现在头文件中using namespace 会使该命名空间内定义的所有标识符都有效,效果类似声明为全局变量,可能会引起冲突
T019control structures should have complete curly-braced block of code控制结构应有完整的花括号括起的代码块禁止if(condition)后直接加单行语句作为判断为true后的执行代码,必须使用{}

 类似资料: