6.2.12.11. Miscellaneous¶
Miscellaneous checks that are often parts of other rule sets
Nested Rules
Use wide strings when calling the Microsoft C/C++ standard library |
|
Identify files with large product of includes and includers |
|
Checks for correctly used comment style in C units |
|
Checks for correctly used comment style in C++ units |
|
Start functions and methods with an upper-case letter |
|
The logical operators && and || should not appear together in a full expression |
|
Place Doxygen comments above (class and function) definitions |
|
Place Doxygen comments above classes and functions in header files |
|
Reports a (suppressed) issue per entity of a configurable type |
|
There shall be no expressions that could be removed because they do not affect program behaviour |
|
Do not use a file as primary file and included file |
|
Reports a (suppressed) issue per entity of a configurable type |
|
Do not call certain functions from certain header files |
|
Do not use certain macros |
|
Do not use certain token sequences |
|
Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier |
|
Import style violations from CSV file |
|
Use the correct include kind “” vs. <> |
|
Initialize all variables when defining them |
|
Do not use invalid effect attributes |
|
You have to use the specified sort of line breaks |
|
Replace #include with forward declaration or more precise #include where possible |
|
Declare variables as local as possible |
|
Scans for comments containing a specified regular expression |
|
Functions must not exceed cyclomatic complexity limit |
|
An expression must not have more than N logical operators |
|
A function must have a nesting level less than or equal N |
|
Do not put more than one statement in a line |
|
A function must not have more than N parameters |
|
Each class needs an explicitly declared constructor |
|
Each class needs an explicitly declared destructor |
|
Inline functions must be defined in every compilation unit where they are declared |
|
Assert parameters before actual function body |
|
Each compilation unit shall include its own header file |
|
Check named entities against naming conventions |
|
Do not use absolute path names in #include |
|
Avoid the use of global objects in constructors and destructors as they may not yet be initialized |
|
Do not use the assembler |
|
Do not use the C++11 auto type specifier |
|
Do not use C-style casts in C++ code |
|
Do not call C functions from C++ code |
|
Do not use C standard headers when a C++ one is available |
|
Do not use structs in C++, rather use classes |
|
You should not use catch(…) |
|
Do not use char* in C++ code |
|
Do not use the C comma sequence operator |
|
Do not use the conditional operator |
|
Do not use const_cast |
|
Put constants on right side of equality comparisons in conditions |
|
Put constants on left side of equality comparisons in conditions |
|
Do not use certain debugging macros |
|
Do not introduce a non-virtual diamond inheritance |
|
Do not ignore return values of functions |
|
Do not use more than one consecutive underscore in a macro |
|
Do not use variable arguments in functions |
|
Loops must not be empty |
|
Structs/unions must not be empty |
|
Do not use dynamic exception specifications |
|
Do not put extern declarations into implementation files |
|
Friend type declarations shall not be used |
|
Do not place comments above functions and methods in implementation files |
|
Do not define (non-inline) functions in header files |
|
Function-like macros shall not be called |
|
Do not use indirect calls with function pointers |
|
Avoid defining function pointers |
|
Do not declare function prototypes in implementation files |
|
Do not use global (non-const) variables |
|
Except for include guards there shall be no #if[n]def or #if in header files |
|
Do not use implicit type conversions |
|
Avoid using forbidden kinds of paths in #include |
|
Avoid #includes which cannot be syntactically integrated |
|
Do not assign to some nonlocal object a reference or pointer to a local variable |
|
Do not use magic literals |
|
The library functions “malloc”, “calloc”, “realloc”, and “free” from library <stdlib.h> shall not be used |
|
Do not mix pointer and integer arithmetic |
|
Do not use multiple inheritance |
|
Do not use new with arrays |
|
Do not assign longer data types to shorter ones |
|
Do not declare non-const data members public |
|
Do not return non-const references to private data members |
|
Do not use signed variables in divisions |
|
Do not use identifiers consisting of just a single character |
|
Do not put static declarations into header files |
|
Do not rely on std::string internals when converting to char* |
|
Do not use tabs |
|
Do not use trailing whitespace |
|
Do not use type conversions to bool, use value comparison |
|
The result of calls to the library functions “malloc”, “calloc”, and “realloc” must be checked |
|
Check pointer parameters for NULL before dereferencing them |
|
Do not use unnamed namespaces in header files |
|
Do not use macro definitions with parameters or expressions without parentheses around them |
|
Class needs a virtual destructor if at least one member function is virtual |
|
Do not use virtual inheritance |
|
No whitespace before or after a member selection |
|
No whitespace after an unary operator |
|
Add #includes for often-used files to precompiled header |
|
You should prefer field initialization over assignment in constructors |
|
Prefer prefix increment/decrement over postfix version |
|
The “default” clause of a switch must be omitted if a switch has cases for all enumerators |
|
List templates with instances |
|
Report units with high number of included files |
|
Do not redefine a typedef |
|
All user-defined conversion operators shall be defined explicit |
Options
Setting an option for this rule means setting the default for all nested rules.
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.