AutosarC++18_03-A2.7.2¶
Sections of code shall not be “commented out”
Required inputs: IR
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
code_in_c_comment |
Sections of code should not be commented out. |
None |
False |
code_in_cpp_comment |
Sections of code should not be commented out. |
None |
False |
Options¶
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
doxygen_start¶
doxygen_start : set[str] = {'/**', '///'}
files_to_check¶
files_to_check : bauhaus.rules.axivion.lexical.comments.FileToCheckSet = {'Primary_File', 'System_Include_File', 'User_Include_File'}
forbidden_tokens¶
forbidden_tokens : set[str] = {'/*', '// '}
This is the first step of checking a comment. If any of these words exist in the comment text, it is regarded as containing code and no further steps are taken. By default these tokens are comment starters that can be removed if nested comments are acceptable.
ignore_doxygen_comments¶
ignore_doxygen_comments : bool = False
normal_text¶
normal_text
Tokens that indicate non-code comments.Type: set[str]
Default:
{' and ', ' are ', ' be ', ' because ', ' but ', ' has ', ' is ', ' now ', ' oder ', ' only ', ' or ', ' the ', ' to ', ' und ', ' when ', ' with ', '##', '++++', '----', '://', '====', 'AXIVION'}
This is the second step of checking a comment. If any of these words exist in the comment text, it is regarded as not containing code.
normal_text_regex¶
normal_text_regex : bauhaus.analysis.config.SearchPattern = '\b[\w\d_]+\s+[\w\d_]+\s+[\w\d_]+\b'
This is the third step of checking a comment. If this regex finds a match in the comment text, the comment is regarded as not containing code.
suspicious¶
suspicious
Tokens that indicate code in comments without normal text.Type: set[str]
Default:
{' <= ', ' = ', ' == ', ' >= ', '#define', '#elif', '#else', '#endif', '#error', '#if', '#ifdef', '#ifndef', '#import', '#include', '#include_next', '#line', '#pragma', '#undef', '#warning', '++', '--', '->', '->*', '::', '::*', ';', '[', '_Pragma', '__has_include', 'for (', 'for(', 'if (', 'if(', 'while (', 'while('}
This is the final step of checking a comment. If the steps before did not exclude the comment from further inspection, the comment text is searched for any of these suspicious tokens. The comment is regarded as containing code, if any suspicious token is found.