6.2.2. Common Options

Most rules have these options, so they are documented here for brevity.

6.2.2.1. exclude_in_macros

exclude_in_macros : set[bauhaus.analysis.config.GlobPattern] = set()

Macro name patterns for macros where this rule should not be applied. Violations will not be reported if they are from code generated by the expansion of a macro matching one of these glob patterns.
 

6.2.2.2. exclude_messages_in_system_headers

exclude_messages_in_system_headers : bool | None = None

Whether to exclude files marked as system headers.

If this option is not set, the option defaults to true, except when axivion_analysis is called with the --system_headers command-line argument. In axivion_ci, this option always defaults to true.

If this option is set, the axivion_analysis --system_headers command-line argument will have no effect.

System headers are the header files that are found in the system include path. #pragma GCC system_header also causes files to be classified as system header.

 

6.2.2.3. excludes

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

Filename patterns for files to exclude from the individual rule.

Note that excludes can also be specified via the option /Analysis/global_excludes or via the `axivion_analysis --exclude` command-line option.

If both includes and excludes are used, the rule applies to all files that match at least one include pattern, and do not match any exclude patterns.

 

6.2.2.4. extend_exclude_to_macro_invocations

extend_exclude_to_macro_invocations : bool = False

When true, messages associated with macro expansions will not be reported if the macro is defined in an excluded file. This applies even if the violation is depending on the context in which the macro is used.

Note: violations reported inside the macro definition itself (e.g. if report_at is set to automatic) are always excluded, independently of this option.

 

6.2.2.5. includes

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

Filename patterns to restrict this individual rule to. May be combined with the /Analysis/global_includes (the rule then is applied to more locations than just the global include patterns).

If both includes and excludes are used, the rule applies to all files that match at least one include pattern, and do not match any exclude patterns.

 

6.2.2.6. justification_checker

justification_checker

Type: typing.Callable[[typing.Union[analysis_result_pb2.Architecture_Violation, analysis_result_pb2.Clone_Pair, analysis_result_pb2.Cycle_Finding, analysis_result_pb2.Dead_Entity, analysis_result_pb2.Metric, analysis_result_pb2.Style_Violation]], NoneType] | None

Default: None

Can be set to a callable taking (and possibly modifying) a style violation instance. Will be called per issue and can be used to check a disabled issue's justification, for example, against permitted ones.

Note: use the post_processing option for a more general method of filtering/modifying violations produced by this rule.

 

6.2.2.7. languages

languages : set[Language] = {'Assembler', 'C#', 'C', 'C++', 'C++/CLI'}

Source languages the rule applies to. Violations are excluded if they appear in a file of a language not in this set.
 

6.2.2.8. post_processing

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

This option allows registering custom post-processing steps that will be applied to violations produced by this rule.

See the documentation of module axivion.analysis.post_processing for more information.

 

6.2.2.9. provider

provider : str = 'axivion'

Provider of this check, appears in the dashboard.
 

6.2.2.10. report_at

report_at : MacroViolationPosition = 'automatic'

Select where violations from macro expansions should be reported.

Note: Reporting violations at the macro definition will cause violations to be excluded if the macro is defined in an excluded file (e.g. system header).

 

6.2.2.11. severity

severity : str = 'error'

Severity to classify violations, appears in the dashboard.
 

6.2.3. Option Types

These types are used by options listed above:

6.2.3.1. Language

IR languages, used for language filter.
 
  • C

  • C++

  • C#

  • C++/CLI

  • Assembler

  • Rust

6.2.3.2. MacroViolationPosition

An enumeration.
 

automatic

Automatically determine whether to report a violation at the macro invocation or definition. By the default this will report at the macro invocation, but some rules have special logic to report the violation in macro definitions when appropriate (usually when the violation is independent of the macro arguments).

macro_invocation

Always report violations at macro invocation.

macro_definition

Always report violations at the macro definition, even if the violation might depend on macro arguments.