AutosarC++17_03-A5.1.1¶
Literal values shall not be used apart from type initialization, otherwise symbolic names shall be used instead
Required inputs: IR
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
magic_number |
Use of magic literal. |
None |
False |
magic_number_without_token |
Use of magic literal. |
None |
False |
magic_string |
Use of magic string literal. |
None |
False |
possible_magic_number |
Potential use of magic literal. |
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
allow_nonconst_variable_initialization¶
allow_nonconst_variable_initialization : bool = False
allowed¶
allowed : set[float] = {0.0, 1.0, 2.0}
allowed_contexts¶
allowed_contexts
Optional set of PIR classes or functions ((node) -> bool) for allowed contexts, e.g. Case_Label.Type: set[bauhaus.ir.PIR_Class_Name | typing.Callable[[bauhaus.ir.Node], bool]]
Default:
{'Template_Const_Argument', <function bauhaus.rules.autosar.cpp.rule_A5_1_1.allow_in_type_initialization(node)>}
allowed_logging_contexts¶
allowed_logging_contexts : set[bauhaus.analysis.config.QualifiedName] = {'std::basic_ostream'}
operator<<). If this is non-empty,
std::throw() is considered a valid logging context as well.
allowed_string_contexts¶
allowed_string_contexts
Optional set of PIR classes or functions ((node) -> bool) for allowed contexts.Type: set[bauhaus.ir.PIR_Class_Name | typing.Callable[[bauhaus.ir.Node], bool]]
Default:
{<function bauhaus.rules.autosar.cpp.rule_A5_1_1.allow_in_type_initialization(node)>}
allowed_strings¶
allowed_strings : set[str] = {' ', ''}
exceptions¶
exceptions : typing.Callable[[bauhaus.ir.Node], bool] | None = None
exclude_pp_literals¶
exclude_pp_literals : bool = True
exclude_single_uses¶
exclude_single_uses : bool = False