6.2.1. Global Options

These options affect all rules in this aspect.

6.2.1.1. global_excludes

global_excludes : set[bauhaus.analysis.config.FileGlobPattern] = set()

Exclusion glob patterns that apply to all rules.

If this set is non-empty, no violations matching any of the glob patterns will be reported.

If both includes and excludes are used, the analysis will run on all files that match at least one include pattern, and do not match any exclude patterns.

The globbing patterns are applied to the project-directory relative paths.

Examples:

*/generated/* excludes violations in all files anywhere inside a directory called generated (except for project toplevel).
generated/* excludes violations in all files beneath toplevel directory generated (but not other generated folders nested more deeply).
/usr/include/mylib/* excludes violations in headers of the third-party library at /usr/include/mylib.

Note:

The axivion_analysis --exclude command-line option has the effect of adding to this set.

 

6.2.1.2. global_includes

global_includes : set[bauhaus.analysis.config.FileGlobPattern] = set()

Inclusion glob patterns that apply to all rules.

If this set is non-empty, only violations matching one of the glob patterns will be reported.

If both includes and excludes are used, the analysis will run on all files that match at least one include pattern, and do not match any exclude patterns.

The globbing patterns are applied to the project-directory relative paths.

Examples:

*/checkme/* reports violations in all files anywhere inside a directory called checkme (except for project toplevel).
checkme/* reports violations in all files beneath toplevel directory checkme (but not other checkme folders nested more deeply).
subproject/part/* reports violations in files in the project subtree subproject/part.

Note:

The axivion_analysis --include command-line option has the effect of adding to this set.

 

6.2.1.3. global_post_processing

global_post_processing : bauhaus.analysis.post_processing.PostProcessingSettings = <PostProcessingSettings(0 filters)>

Global post-processing steps that apply to all rules.
 

6.2.1.4. log_violations

log_violations : bool = False

Whether analysis violations will be logged to the console during axivion_ci. This has no effect in axivion_analysis.
 

6.2.1.5. message_format

Options regarding the formatting of messages for console output
 

message_format.architecture

Options for architecture message formatting.
 

message_format.architecture.absence_string : str = 'Missing dependency'

String to show for an absence (defines the value to be used when replacing the 'violation_message' placeholder in the primary line).
 

message_format.architecture.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.architecture.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.architecture.convergence_string : str = 'Expected dependency'

String to show for a convergence (defines the value to be used when replacing the 'violation_message' placeholder in the primary line).
 

message_format.architecture.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.architecture.divergence_string : str = 'Forbidden dependency'

String to show for a divergence (defines the value to be used when replacing the 'violation_message' placeholder in the primary line).
 

message_format.architecture.message_string : str = 'Architecture violation'

String to show as message (defines the value to be used when replacing the 'message' placeholder in the primary line).
 

message_format.architecture.primary_line : str = '%(disabled)s%(filename)s:%(line)d:%(column)d: %(message)s: %(violation_message)s [%(target_entity)s] (Rule %(errno)s)'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information of the source of the architecture violation
  • target_filename, target_line, target_column: Position information of the target of the architecture violation
  • message: Custom text describing the issue
  • violation_message: Custom text being selected based on whether it is a divergence, absence or convergence
  • edge_type, violation_type: Classification of the violation; edge_type is the RFG edge type in the source, like Static_Call, while violation_type is one of Absence/Divergence/Convergence
  • errno: Rulename of the rule reporting the issue
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
 

message_format.clone

Options for clone message formatting.
 

message_format.clone.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.clone.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.clone.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.clone.message_string : str = 'Cloned code section'

String to show as message (defines the value to be used when replacing the 'message' placeholder in the primary line).
 

message_format.clone.primary_line

Type: str

Default: '%(disabled)s%(filename)s:%(line)d:%(column)d: %(message)s (%(clone_type)s) having length %(length)s; other code section at %(other_filename)s:%(other_line)d'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information
  • other_filename, other_line, other_column: Position information of the second part in the clone pair
  • message: Custom text describing the issue
  • clone_type, length: Classification and number of lines of the clone
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
 

message_format.cycle

Options for cycle message formatting.
 

message_format.cycle.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.cycle.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.cycle.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.cycle.message_string : str = 'Recursive call'

String to show as message (defines the value to be used when replacing the 'message' placeholder in the primary line).
 

message_format.cycle.primary_line : str = '%(disabled)s%(filename)s:%(line)d:%(column)d: %(message)s [%(entity)s]'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information
  • message: Custom text describing the issue
  • entity, entity_type: Name and type of the entity being reported (e.g., a function)
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
 

message_format.deadcode

Options for deadcode message formatting.
 

message_format.deadcode.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.deadcode.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.deadcode.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.deadcode.message_string : str = 'Dead code detected'

String to show as message (defines the value to be used when replacing the 'message' placeholder in the primary line).
 

message_format.deadcode.primary_line : str = '%(disabled)s%(filename)s:%(line)d:%(column)d: %(message)s [%(entity)s]'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information
  • message: Custom text describing the issue
  • entity, entity_type: Name and type of the entity being reported (e.g., a function)
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
 

message_format.metric

Options for metric message formatting.
 

message_format.metric.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.metric.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.metric.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.metric.primary_line

Type: str

Default: '%(disabled)s%(filename)s:%(line)d:%(column)d: %(metric_name)s, %(display_name)s: %(metric_value)f; %(min_value)f; %(max_value)f%(violation)s: %(entity_type)s: %(entity)s'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information
  • severity: The issue's severity
  • metric_name, display_name: Text describing the metric being reported
  • entity, entity_type: Name and type of the entity for which the metric was computed (e.g., a function)
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
  • metric_value, violation: Value of the metric and custom string if the metric thresholds are violated
  • min_value, max_value: Metric thresholds
 

message_format.metric.show_all_values : bool = False

Whether all metric values or only violations of the thresholds should be shown.
 

message_format.metric.violation_string : str = ' VIOLATION'

String to show when an issue is a violation of metric thresholds (defines the value to be used when replacing the 'violation' placeholder in the primary line).
 

message_format.style

Options for stylecheck message formatting.
 

message_format.style.additional_header_prefix : str = 'n    '

Separator before intermediate header (e.g. "Additional SLocs:" or "Context:"). Only used in non-brief mode.
 

message_format.style.after_justification : str = '] '

Value for the 'after_justification' placeholder in the primary/secondary line.
 

message_format.style.before_justification : str = '['

Value for the 'before_justification' placeholder in the primary/secondary line.
 

message_format.style.brief_secondary_line_prefix : str = ', '

Separator before secondary sloc in brief mode.
 

message_format.style.disabled_string : str = 'DISABLED: '

String to show when an issue is disabled (defines the value to be used when replacing the 'disabled' placeholder in the primary/secondary line).
 

message_format.style.macro_context_at_definition : str = ' (when expanded at %(expansion_filename)s:%(expansion_line)d:%(expansion_column)d)'

Macro context to be shown if the issue is reported at the macro definition (defines the value to be used when replacing the 'macro_context' placeholder in the primary/secondary line).
 

message_format.style.macro_context_at_invocation : str = ' (%(macro_expansion)s)'

Macro context to be shown if the issue is reported at the macro invocation (defines the value to be used when replacing the 'macro_context' placeholder in the primary/secondary line).
 

message_format.style.previous_position_line : str = 'Previous position: %(filename)s:%(line)d:%(column)d: %(message)s'

Format of the console output line giving the previous position, if any, when migrating from old to new Axivion Suite versions. Used for tests.
 

message_format.style.primary_line

Type: str

Default: '%(disabled)s%(filename)s:%(line)d:%(column)d: %(severity)s:%(macro_context)s%(template_instantiation_context)s %(message)s (Rule %(errno)s)'

Format of the primary line in console outputs. Available placeholders are:
  • filename, line, column: Position information
  • severity: The issue's severity
  • message: The message describing the issue
  • disabled, justification: Non-empty when the issue is disabled / has a justification
  • before_justification, after_justification: Strings to be printed before/after the justification, if any, as configured with corresponding options
  • errno: Rulename of the rule reporting the issue
  • macro_context, template_instantiation_context: Non-empty if there is a relevant macro or template context
 

message_format.style.secondary_line : str = '%(filename)s:%(line)d:%(column)d: %(message)s'

Format of any secondary line in console output. A secondary line has its own position and message information.
 

message_format.style.secondary_line_prefix : str = 'n        '

Separator before secondary sloc in normal mode.
 

message_format.style.show_macro_context : bool = False

Whether the macro_context placeholder is supported and replaced by either macro_context_at_invocation or macro_context_at_definition.
 

message_format.style.show_previous_position : bool = False

Whether a line with the previous position should be printed. Used for tests.
 

message_format.style.template_instantiation_context : str = ' (%(template_instantiations)s)'

Value for the 'template_instantiation_context' placeholder in the primary/secondary line.
 

6.2.1.6. scanner

Several options related to low-level scanning of source files during analyses.
 

scanner.additional_basic_characters : str = ''

Additional characters that should be treated as basic characters. Characters with special meaning within a regex character group [...] should be escaped with \.
 

scanner.additional_basic_characters_in_comments : str = ''

Additional characters that should be treated as basic characters inside comments. Characters with special meaning within a regex character group [...] should be escaped with \. Rules concerned with comments take "additional_basic_characters" into account as well, so these characters do not have to be repeated here.
 

scanner.ignore_tokens_in_disabled_sections : bool = True

Whether tokens in #if 0 sections should be ignored.
 

6.2.1.7. side_effects

Several options related to side-effects of functions and volatile variables.
 

side_effects.effect_free_atomic_variables : set[str] = set()

Names of variables that can be read without side-effect despite being atomic. If this list contains a macro name, any atomic reads within the macro expansion are treated as free of side effects; as well as any atomic variables declared within the macro expansion. This can be used for memory-mapped IO when the hardware guarantees that reads have no side effect. Write accesses continue to be seen as side-effect.
 

side_effects.effect_free_functions : set[bauhaus.analysis.config.QualifiedName] = set()

Names of functions that should be assumed to have no side effects. This causes the analysis to ignore the body of the function. For C++, use qualified names without template arguments, e.g. std::numeric_limits::max.

If you have a function that has a side effect that you wish to ignore for the purposes of the analysis (e.g. logging), consider using the option side_effects.local_effect_functions.

Adding a function to this configuration option is equivalent to marking it as [[axivion::pure]]. See rule Miscellaneous-InvalidEffectAttributes for a more detailed description of effect attributes.

 

side_effects.effect_free_volatile_variables : set[str] = set()

Names of variables that can be read without side-effect despite being volatile. If this list contains a macro name, any volatile reads within the macro expansion are treated as free of side effects; as well as any volatile variables declared within the macro expansion. This can be used for memory-mapped IO when the hardware guarantees that reads have no side effect. Write accesses continue to be seen as side-effect.
 

side_effects.local_effect_functions : set[bauhaus.analysis.config.QualifiedName] = set()

Names of functions for which side effects should not be propagated up the call graph. For C++, use qualified names without template arguments, e.g. std::__assert_fail.

Calls to these functions can be seen as having an effect within the caller function (thus there is no "Statement has no side effect" violation when calling these functions); but the effect will not be propagated further up the call stack into the caller's caller. The effect remains "local" to the function's direct callers.

This option is intended to be used with assertion failures or logging output: these are technically side effects, but the effect is irrelevant to the normal functionality of the program.

The following example illustrates the difference between side_effects.effect_free_functions and side_effects.local_effect_functions:

void abort();

int foo(int* p) {
    if (p == NULL) {
        abort();
    }
    return *p;
}

int main(int argc, char** argv) {
    int a = argc;
    int b = argc;
    foo(&a);
    if (argc && foo(&b)) {}
}
Without any extra configuration, this code example will result in a MisraC2012-13.5 violation: "Side-effect in right-hand-side of &&"

With effect_free_functions=["abort"], the MisraC2012-13.5 violation will not be reported, but instead there will be two MisraC2012-2.2 "Statement without side-effect" violations reported for the abort() call and for the foo(&a) call.

With local_effect_functions=["abort"], the MisraC2012-13.5 violation will also not be reported, but there will only be a single MisraC2012-2.2 "Statement without side-effect" violation: the foo(&a) call. The abort() call is still considered a side effect -- but only locally within the body of foo. For the purpose of foo's callers, the potential abort call is ignored.

 

side_effects.side_effect_functions : set[bauhaus.analysis.config.QualifiedName] = {'fclose', 'fopen', 'fprintf', 'fputs', 'freopen', 'printf', 'tmpfile'}

Names of functions that cause an external side effect, e.g. file operations. For C++, use qualified names without template arguments, e.g. std::vector::push_back.
 

6.2.1.8. types

Several options related to types of the analysed project.
 

types.allow_single_bitfield_as_bool : bool = False

If true, bitfields of size "1 bit" are effectively bool
 

types.enums_as_integer_constants : set[str] = set()

Enum type name patterns which should be seen as collection of integer constants.
 

types.external_functions_returning_bool : set[bauhaus.analysis.config.QualifiedName] = set()

Qualified function names for external functions which should be seen as returning bool
 

types.fixed_size_int_typedefs : set[str] = set()

Regular expression strings for names of typedefs for fixed-size integers, e.g. 'char(\d)*_t$', 'u?int\d+_t$', 'float\d+_t$'
 

types.user_bool_macros : set[bauhaus.analysis.config.MacroName] = set()

Names of macros that should be considered to have type bool. This option is intended to be used in combination with user_bool_types.

This option only works for macros defined as a simple integer literal:

typedef unsigned int bool_t;
#define FALSE 0
#define TRUE 1
Configuration: "user_bool_types": [ "bool_t" ], "user_bool_macros": [ "FALSE", "TRUE" ]

If the macros instead contain a cast, user_bool_macros will have no effect. With a cast, it is sufficient to set option types.user_bool_types.

 

types.user_bool_types : set[str] = set()

Used to configure additional boolean types in C.

You can configure the names of typedefs, enums or macros.

This option influences "essentially boolean" in MisraC2012 and "effectively boolean" in the other Misra standards.

Example with boolean typedef:

typedef unsigned int bool_t;
#define FALSE ((bool_t)0)
#define TRUE ((bool_t)1)
Configuration: "user_bool_types": [ "bool_t" ]

Example with boolean enum:

enum bool_tag {
    FALSE = 0,
    TRUE = 1
};
typedef enum bool_tag bool_t;
Configuration: "user_bool_types": [ "bool_tag", "bool_t" ]

Example with macro:

#define BOOL unsigned char
#define FALSE ((BOOL)0)
#define TRUE ((BOOL)1)
Configuration: "user_bool_types": [ "BOOL" ]

If your TRUE/FALSE macros do not contain a cast to the boolean type, you will need to also configure option types.user_bool_macros.