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