NextRoutine¶
Affects style violations in the next routine
Code annotations are special comments that can be used to suppress issues and/or to assign a justification to an issue. This rule describes comments that can be used for such code annotations. Each code annotation rule specifies the syntax for such a comment (option format). The code annotation rule can limit the affected issues by, for example:- the code portion (scope) where an issue is reported
- the issue kind(s) like style violations vs. metric issues
- the rule which reports the issue,
- the message, message key or entity being reported in the issue
group
attribute to the regular expression group in the format string which defines
the relevant portion of the comment for this field (group 0 is the complete
comment, group 1 the first group in parens, etc.). Then choose as
value attribute how the required information should be extracted
from the selected comment portion, or provide that information directly.
You can define your own comment format by copying the rule and changing
options as required, e.g. to use your company's name instead of
Axivion in the comments.
Assuming the default settings for this rule, a code annotation example comment using this rule would be:
/* AXIVION Next Routine MisraC2012-20.5: my justification */
Possible Messages
This rule has no predefined messages.
Options¶
The following places define options that affect this rule: CodeAnnotations, Analysis-GlobalOptions
action¶
code_annotations.Action to trigger when a matching comment is found.
action.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
action.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
action.value : Action =
The action to trigger when such a comment is found'SUPPRESS'
applies_to_c_comments¶
applies_to_c_comments : bool = True
applies_to_cpp_comments¶
applies_to_cpp_comments : bool = True
applies_to_pragmas¶
applies_to_pragmas : bool = False
case_sensitive¶
case_sensitive : bool = False
entity¶
Globbing pattern to restrict the affected issues by their reported entity. For architecture violations, this field is compared against the name of the source entity of the causing edge.
entity.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
entity.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
entity.value
These entities are affected by the commentType: None | Entity | bauhaus.analysis.config.GlobPattern
Default:
None
format¶
format : str = '\s*AXIVION\s+Next\s+Routine\s+([^:]*)(:.*)?'
justification¶
Justification to add to affected issues.
justification.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
justification.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.2
justification.in_next_comment : bool =
Whether the justification appears in the next comment. Only used for dynamically extracted justifications.False
justification.in_previous_comment : bool =
Whether the justification appears in the previous comment. Only used for dynamically extracted justifications.False
justification.transparent : bool =
If there is no justification in a comment, affected issues will continue to search for their justification in preceding comments. Only affects suppressing annotations (pure commenting annotations always continue the search).False
justification.value
This justification is attached to affected issues.Type: None | Justification | str
Default:
'AFTER_COLON'
kind¶
Issue kinds addressed with this comment.
kind.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
kind.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
kind.value
The issue kind(s) affected by the comment. If the issue kind is read from the comment instead of being a fixed choice, use the following keywords for the different issue kinds:Type: IssueKind
Default:
'STYLE'
- 'Style' or 'Stylecheck' for stylecheck issues
- 'Metric' or 'Metrics' for metric issues
- 'Architecture' for architecture issues
- 'Clone' or 'Clones' for clone issues
- 'Cycle' or 'Cycles' for cycle issues
- 'Dead' or 'DeadCode' for dead code issues
- 'All' for all issue kinds
macro¶
Globbing pattern to restrict the affected issues by their reported macro context.
macro.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
macro.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
macro.value
These macros are affected by the comment.Type: None | Macro | bauhaus.analysis.config.GlobPattern
Default:
None
match_always¶
match_always : bool = True
message¶
Globbing pattern to restrict the affected issues by their message. For architecture violations, this field is compared against the causing edge type.
message.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
message.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
message.value
These messages are affected by the comment.Type: None | Message | bauhaus.analysis.config.GlobPattern
Default:
None
message_key¶
Globbing pattern to restrict the affected issues by their message key. For architecture violations, this field is compared against the reflexion edge type.
message_key.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
message_key.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
message_key.value
These message keys are affected by the comment.Type: None | MessageKey | bauhaus.analysis.config.GlobPattern
Default:
None
rule¶
Globbing pattern to restrict the affected issues by their rule name.
rule.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
rule.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.1
rule.value
These rules are affected by the commentType: None | Rule | bauhaus.analysis.config.GlobPattern
Default:
'AXIVION_NAMES'
scope¶
Code regions addressed with this comment.
scope.custom_parser
When selecting a custom parser, this is the Python function to call as parser. You have to supply this function in a Python layer. It should return an allowed value and it takes as arguments, in order: 1. The comment object 2. The text corresponding to the selected regex group 3. Optionally: issue details of the issue being affected (only needed if the comment should behave differently for different issues) Ignored when not selecting a custom parser.Type: typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str], typing.Any] | typing.Callable[[bauhaus.ir.common.scanner.comments.CachedComment, str, bauhaus.config.code_annotations.Issue], bauhaus.analysis.config.GlobPattern] | None
Default:
None
scope.group : int =
Index of the regex group in the format which should be handed over to the given parser in order to dynamically extract the value from the comment. Index 0 is the complete comment text, index 1 the first group in (), etc. Ignored when selecting a statically known value instead of a parser.0
scope.value : Scope =
The code regions affected by the comment'NEXT_ROUTINE'
Option Types¶
These types are used by options listed above:
Action¶
Enumeration of possible actions to triggerNONE
Comment does not trigger any action.ACTIVATE
Activate the given rule(s) in the given scope.SUPPRESS
Suppress the given rule(s) in the given scope.COMMENT
Only add a justification to issues in the given scope.ENABLE_DISABLE_KEYWORD
ENABLE to activate, DISABLE to suppress the given rule(s) in the given scope.PLUS_MINUS_KEYWORD
+ to activate, - to suppress the given rule(s) in the given scope.BEGIN_END_SUPPRESS_KEYWORD
begin to activate, end to suppress the given rule(s) in the given scope.RHAPSODY_ENABLE_DISABLE_KEYWORD
[ to activate, ] to suppress the given rule(s) in the given scope.CUSTOM_PARSER
Entity¶
Selection of the parser to extract the affected entity from a commentENTITY_NAME
Entity directly given by nameENTITY_AS_GLOBBING
Makes entity* out of the given entityENTITY_REGEX
The given string for the entity is a regex to match against actual entitiesCUSTOM_PARSER
IssueKind¶
Enumeration of possible issue kinds to address with a commentSTYLE
Matches all stylecheck issues.METRIC
Matches all metric issues.ARCHITECTURE
Matches all architecture check issues.CLONE
Matches all clone detection issues.CYCLE
Matches all cycle detection issues.DEAD
Matches all dead code issues.ALL
Matches all issue kinds.ISSUE_KIND_KEYWORD
The issue kind is read from the comment where the following keywords can be used for the different issue kinds:- 'Style' or 'Stylecheck' for stylecheck issues
- 'Metric' or 'Metrics' for metric issues
- 'Architecture' for architecture issues
- 'Clone' or 'Clones' for clone issues
- 'Cycle' or 'Cycles' for cycle issues
- 'Dead' or 'DeadCode' for dead code issues
- 'All' for all issue kinds
CUSTOM_PARSER
Justification¶
Selection of the parser to extract the justification from a commentFULL_TEXT
The full text of the matched regex group is the justificationAFTER_COLON
Strip away a leading :script:`:` to extract the justificationCUSTOM_PARSER
Macro¶
Selection of the parser to extract the affected macro from a commentMACRO_NAME
Macro directly given by nameMACRO_AS_GLOBBING
Makes macro* out of the given macroMACRO_REGEX
The given string for the macro is a regex to match against actual entitiesCUSTOM_PARSER
Message¶
Selection of the parser to extract the affected messages from a commentFULL_TEXT
The full text of the matched regex group is the messageMESSAGE_AS_GLOBBING
Makes message* out of the given messageMESSAGE_REGEX
The given string for the message is a regex to match against actual messagesMESSAGES_SEPARATED_BY_SPACE
Space-separated list of messages given in the commentCUSTOM_PARSER
MessageKey¶
Selection of the parser to extract the affected message keys from a commentFULL_TEXT
The full text of the matched regex group is the message keyCUSTOM_PARSER
Rule¶
Selection of the parser to extract the affected rules from a commentAXIVION_NAME
Axivion full rule name given in the commentAXIVION_NAMES
Comma-separated list of Axivion rulenames given in the commentAXIVION_NAMES_SEPARATED_BY_SPACE
Space-separated list of Axivion rulenames given in the commentMISRA_C_2004_NUMBER
Only the number (like 10.1) is givenMISRA_C_2012_NUMBER
Only the number with optional R or D prefix (like 1.1, R1.1, or D1.1) is givenMISRA_C_2019_NUMBER
Only the number with optional R or D prefix (like 1.1, R1.1, or D1.1) is givenMISRA_C_2023_NUMBER
Only the number with optional R or D prefix (like 1.1, R1.1, or D1.1) is givenMISRA_C_2025_NUMBER
Only the number with optional R or D prefix (like 1.1, R1.1, or D1.1) is givenMISRA_CPP_2008_NUMBER
Only the number (like 10.1.1) is givenMISRA_CPP_2023_NUMBER
Only the number (like 10.1.1) is givenLINT_NUMBER
A single lint rule number (like 715) is givenLINT_NUMBERS
A comma-separated list of lint rule numbers is givenLINT_SAMELINE_NUMBERS
A space-separated list of lint rule numbers, each preceded by !ePRQA_NUMBER
A single PRQA rule number (like 1234) is givenPRQA_NUMBERS
A comma-separated list of PRQA rule numbers is givenPARASOFT_NAME
A single rule name in Parasoft name format is givenPOLYSPACE_NAME
A single rule name in Polyspace name format is givenCUSTOM_PARSER
Scope¶
Enumeration of possible code regions being addressed with a commentREST_OF_FILE
Comment affects all issues in subsequent lines of the file until a corresponding suppressing commentSAME_LINE
Comment affects all issues in the same lineNEXT_LINE
Comment affects all issues in the next linePREVIOUS_LINE
Comment affects all issues in the previous lineSAME_CONSTRUCT
Comment affects all issues inside the statement, lambda or declaration in which the comment itself is placed (e.g., in same statement sequence)NEXT_CONSTRUCT
Comment affects all issues in the next statement, lambda or declaration, whatever comes earlierNEXT_CONSTRUCT_OR_DIRECTIVE
Comment affects all issues in the next statement, lambda, declaration, #line or #pragma, whatever comes earlierNEXT_CODELINE
Comment affects all issues in the first line of the next statement, lambda, declaration, expression, #line or #pragma, whatever comes earlierPREVIOUS_CONSTRUCT
Comment affects all issues in the preceding statement, lambda or declarationSAME_ROUTINE
Comment affects all issues in the routine inside which the comment is placed.NEXT_ROUTINE
Comment affects all issues in the next routine after the commentPREVIOUS_ROUTINE
Comment affects all issues in the previous routine before the commentPROJECT
Comment affects the whole project (no scope restriction)NEXT_N_LINES
Comment affects all issues in the next N lines, where N is parsed from the comment (0 or empty string means "same line", negative means "previous N lines"); ATTENTION: if an omitted optional match group should mean "same line" then you have to write it as(regex|) and not (regex)? so that
the match group matches the empty string and not NoneROUTINE_BY_NAME
The affected routine is named in the commentMACRO_BY_NAME
Comment affects all issues in invocations of the given macros. Globbing patterns are supported for the macro names.FILE
Comment affects all issues in the same file as the comment.CUSTOM_PARSER