Miscellaneous-LocalScope¶
Declare variables as local as possible
Required inputs: IR
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
function_file_static |
{} can be declared static in primary file. |
None |
False |
locality_block |
{} can be declared in a more local scope. |
None |
False |
locality_function |
Global {} can be declared inside function. |
None |
False |
locality_function_static |
Global {} can be declared as local static inside function. |
None |
False |
locality_loop_init |
{} can be declared in the for-loop’s initialization. |
None |
False |
unused_variable |
Variable is unused. |
None |
False |
var_file_static |
{} can be declared static in primary file. |
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_moving_to_other_primary_file¶
allow_moving_to_other_primary_file : bool = False
check_loop_counter¶
check_loop_counter : bool = False
consider_constructors_as_capturing¶
consider_constructors_as_capturing : bool = False
exclude_c_function_locals¶
exclude_c_function_locals : bool = False
exclude_dllexport¶
exclude_dllexport : bool = True
exclude_function_locals¶
exclude_function_locals : bool = True
exclude_undefined¶
exclude_undefined : bool = True
ignore_types¶
ignore_types : set[bauhaus.analysis.config.GlobPattern] = set()
move_global_const_into_function¶
move_global_const_into_function : bool = True
only_check_unit_locals¶
only_check_unit_locals : bool = False
report_global_constants¶
report_global_constants : bool = False
report_nonstatic_functions¶
report_nonstatic_functions : bool = False
report_undefined_variables¶
report_undefined_variables : bool = True
report_unused¶
report_unused : bool = True
suppress_attribute_maybe_unused¶
suppress_attribute_maybe_unused
Filter action to apply to violations for objects marked asType: FilterAction
Default:
'suppress'
[[maybe_unused]] or __attribute__((unused)).
If set to "suppress", findings will be reported but marked as suppressed.
If set to "exclude", findings will not be reported at all.
If set to "normal", no special treatment is applied and the finding is reported as usual.
template_args_can_be_static¶
template_args_can_be_static : bool = False
treat_initialization_as_use¶
treat_initialization_as_use : bool = False
treat_side_effect_constructors_as_use¶
treat_side_effect_constructors_as_use : bool = False
std::lock_guard, or destroyed through a destructor having a
side-effect.
Option Types¶
These types are used by options listed above:
FilterAction¶
Used for the return value of add_filter() callbacks.normal
The violation proceeds as usual.exclude
The violation is excluded: The violation is discarded as if `--exclude` applied to it. The following filters won't get to see the violation, and it will not be imported into the database under any circumstances.suppress
The violation is suppressed as if `AXIVION DISABLE` applied to it. Whether the violation gets imported into the database is controlled by the Axivion CI configuration.