1.4.65. Migration to new Configuration System¶
Version 7.0 introduces a new, extended configuration system. Now, besides manually
created Python configuration files, you can also use JSON
configuration files created using a graphical user interface
named axivion_config. Starting from version 7.1, the new system is available
for CI/VCS configuration, all kinds of analyses and code annotations (markup comments)
used to suppress or justify issues. Version 7.3 introduces support for
compiler and UI tool configuration using the new system.
Caution
The steps described in Migration to 7.0.0 need to be done before the steps described here.
Caution
Old-style XML files for configuring the project, analyses, the compiler and code annotations can still be used in 7.3, but they are deprecated, and support for these files will be dropped in a future version. Migration scripts are provided for the transition to the new system.
In case you’ve got additional stylechecks or metrics in place, they also might need some migration to be usable in the new analysis framework which now handles all kinds of analyses in a uniform way.
The new Project Configuration allows a uniform analysis configuration with the
new graphical user interface axivion_config and Python files.
In general, you can decide which parts to configure using the GUI, and which parts to configure in Python (some options can only be configured in Python, e.g. when they require a Python function as value).
It is recommended to configure as much as possible with axivion_config
unless you have specific reasons to prefer Python. An approach for the migration
thus would be:
Use
axivion_configand enable the rules which correspond to the CI analysis tools, stylechecks and metrics that your existing configuration activates. You do not have to switch everything at once. For example, you could start by migrating the stylechecks, leaving other analyses in the old form at first.Also use
axivion_configto set rule options where possible in the GUI to the values of your current configuration.Create a Python configuration file for those parts of the configuration that you cannot do in the GUI.
Create an interface configuration file
axivion_config.jsonand reference the file(s) saved from within the GUI and the Python file(s). This file will be picked up by default as the configuration for your project.
The sections below help you with the details of these steps.
The new tool axivion_analysis is used to execute all kinds of analyses.
The sections below describe the migration for each erosion kind.
1.4.65.1. Overview of Configuration Files¶
Old file |
Migration tool |
New file |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
N/A |
|
|
|
|
|
|
|
|
|
|
|
N/A |
|
|
|
|
|
|
|
|
|
|
|
N/A |
|
|
|
|
|
|
|
|
N/A |
|
|
|
|
|
|
|
Note: the new file names are the output files created by the migration tool.
The new configuration system does not require the use of these names, e.g.
the complete configuration could be combined in a single axivion_config.json
file.
1.4.65.2. Automatic Config Migration¶
You can use the command migrate config to automatically generate a new JSON
configuration from your existing configuration. Note that your existing configuration
will first need to be adjusted to 7.0
(as described in Migration to 7.0.0).
To generate the new configuration, set BAUHAUS_CONFIG as during analysis,
then run:
migrate config --all_layers
This will write the new configuration files into the existing directories.
If your existing configuration depends on the environment (e.g. because
you have code in stylecheck_config.py inspecting os.environ),
only the current variant of the configuration will be migrated.
For more complex configurations, the automatic migration can be used to create a starting point for the manual migration.
The migration tool will generate an interface JSON file axivion_config.json,
a declarative config rule_config.json, which can be edited with the
axivion_config GUI, and a Python script rule_config.py for settings
that cannot be configured using the GUI.
Note that XML/Python comments in the existing configuration are ignored by
migrate and should be copied to the new configuration manually.
Starting with version 7.1, there is a further step migrate ci available
that can migrate the build.conf contents to the new configuration system.
We recommend that you first migrate the stylechecks to the new configuration system
before you attempt to migrate build.conf.
Starting with version 7.3, there are two further steps migrate compiler and
migrate gravis available. migrate compiler migrates the contents of
cafeCC.config, predefined_macros.txt, predefined_sizes.txt,
irlink.config and LanguageSupport.config to the new configuration system.
migrate gravis migrates the contents of gravis2.config to
the new configuration system.
We recommend that you first migrate the stylechecks and CI configuration (build.conf)
to the new configuration system before attempting to migrate the compiler settings.
Recommended order of migration:
migrate config
migrate ci
migrate compiler
migrate gravis
1.4.65.3. Activate the new Analysis Tool¶
In order to use the new configuration system for analysis configuration,
add the following to your build.conf, next to the classic
stylecheck tool:
<action tool="analysis" name="analysis" />
In this simple form, the default file name axivion_config.json is looked
up in your project configuration. The easiest approach is to create this file in
the following steps using the GUI. If you want to split the configuration into
different files, or if you require Python configuration files besides the part
done with the GUI, then this can also be an interface JSON file
(see Configuration Files). Now start axivion_config
in order to create the file with contents as described in the next sections.
1.4.65.4. Migrate Clone Detection¶
If you’ve got clone detection via irclones enabled, perform the
following steps:
In the GUI, select the rule
CloneDetectionIf your
irclonesentry inbuild.conflisted some options for the analysis, or if you had special settings in yourirclones.config, set them now in the GUI to the same valuesSave the configuration in the GUI
Remove the
irclonesconfiguration in yourbuild.confand delete any project-specific fileirclones.config
1.4.65.5. Migrate Cycle Detection¶
If you’ve got cycle detection via cycles enabled, perform the
following steps:
In the GUI, select the corresponding rule depending on the view on which the analysis was executed:
CycleDetection-CallgraphCyclesif you used the default settings (operating on theCallview)CycleDetection-IncludeCyclesif you configured the analysisto use the
Includeview
Architecture-CycleDetectionin all other cases (don’t forget to set the view there)
If your
cyclesentry inbuild.conflisted some options for the analysis, set them now in the GUI to the same valuesIf you also want the number of strongly connected components as a metric, activate the rule
Metric-Number_Of_SCCs(in the GUI, you find this in the pathMetrics/CallgraphMetrics) and set its optionsSave the configuration in the GUI
Remove the
cyclesconfiguration in yourbuild.conf
1.4.65.6. Migrate Dead Code Detection¶
If you’ve got dead code detection via deadcode enabled, perform the
following steps:
In the GUI, select the rule
DeadCodeDetectionIf your
deadcodeentry inbuild.conflisted some options for the analysis, set them now in the GUI to the same valuesIf you also want to configure additional entry points, activate the corresponding rules in rulegroup
AnalysisControl/Environment/EntryPointsand set their optionsSave the configuration in the GUI
Remove the
deadcodeconfiguration in yourbuild.conf
1.4.65.7. Migrate ir2rfg¶
If you’ve got ir2rfg enabled, perform the following steps:
If your
ir2rfgentry inbuild.conflisted some options, or if you had special settings in yourir2rfg.config, set them now in the GUI to the same values. The former options are now available in different places:Most options are present in rule
Architecture-Dependencies(which is activated automatically when an RFG is needed)Metric options have been moved to the metric rules (for example, former command-line option
--consider_dynamic_calls_in_metricsis now an option of the affected rules in rulegroupMetrics/CallgraphMetrics); former command-line option--his_metrics_aliasesis not needed any more as it is inferred automaticallyConfiguration of additional entry points as previously possible in the
build.conftoolir2rfgwith optionsinterrupt_keywordsandanimating_attributesis now handled by the rulesEntryPoints-EntriesByKeywordandEntryPoints-EntriesByAttributeIf you did not use option
--no_dllexport_entriesand you require functions being marked asdllexportas additional entry points (e.g., when analysing a library instead of a tool), then activateEntryPoints-EntriesByDLLExport
Save the configuration in the GUI
Remove the
ir2rfgconfiguration in yourbuild.confand delete any project-specific fileir2rfg.config
1.4.65.8. Migrate iranalysis¶
If you’ve got iranalysis enabled, perform the following steps:
If your
iranalysisentry inbuild.conflisted some options, or if you had special settings in youriranalysis.config, set them now in the GUI to the same values. The former options are now available in different places:Most options are present in rule
AnalysisControl/StaticSemanticAnalysisConfiguration of specific checks (as it was possible in
iranalysis.config) is now done at the rules for these checksConfiguration of the effects of external functions is now done with the rules in rulegroup
AnalysisControl/Environment/ExternalsConfiguration of custom resources is now done with the rules in rulegroup
AnalysisControl/Environment/Resources, and checks targeting those dynamic resources refer to them by nameConfiguration of additional entry points as previously possible in
iranalysis.configis now handled by the ruleEntryPoints-EntriesByNameThe command-line option
--only_control_flowis inferred automatically
If you formerly had
CONFIG.Run_IRAnalysis_Checks = Truein your stylecheck configuration, activateAnalysisControl/StaticSemanticAnalysis. See below for the general mapping of such global iranalysis options for stylechecks.If you had the call to
iranalysisprior toir2rfgin yourbuild.confwith the intention to have dynamic call edges in the RFG, then also activate the ruleArchitecture-AddDynamicCallsSave the configuration in the GUI
Remove the
iranalysisconfiguration in yourbuild.confand delete any project-specific fileiranalysis.configas well as files in theiranalysisconfig subfolder
1.4.65.9. Migrate Stylechecks¶
If you’ve got stylecheck enabled, perform the following steps:
If your
stylecheckentry inbuild.conflisted some options, then add the same options to theanalysisentry (command-line options for the tool now use to dashes)If you had special directories listed in your
stylecheck.config, add them in the GUI by right-clicking on theAnalysistoplevel node and selectingAdditional rules.... Notice that formerly only rules in subdirectories of the listed directories were used; this has been changed: now rules in the given directory itself are also foundInspect your
stylecheck_config.pyfile and activate the rules put into theACTIVEset in the GUI. Also set the rule options there to the same values as before.For cases that still require Python, either adapt
stylecheck_config.pyto fit into the new configuration system, or create a new Python file for that purpose. List the file in theaxivion_config.jsoninterface file.Formerly, magic variables
RULESandACTIVEwere used in the stylecheck configuration. This is no longer the case, a proper Python API has been created. Activating a rule and setting an option in Python now looks like this:Activating rules and setting rule options in Python¶import axivion.config analysis = axivion.config.get_analysis() analysis.activate('MisraC2012-1.1', 'Architecture-ArchitectureCheck') analysis.activate('MisraC2012-10.3', severity='error') analysis['MisraC2012-10.3'].provider = 'myself'
Formerly, magic variable
CONFIGwas used to provide some global options. Set them now in the GUI, or if your prefer, in Python. Some options are still present in the toplevelAnalysisnode, others have been moved to analysis rules.The following table shows the migration of the
CONFIGoptions (the right side here is in Python terms, the GUI of course provides equal access):CONFIG.xxx option
New option
Additional_Basic_Characters
analysis.options.scanner.additional_basic_characters
Allow_Single_Bitfield_As_Bool
analysis.options.types.allow_single_bitfield_as_bool
Base_View_Name
analysis[‘Metrics’].base_view_name
Effect_Free_Functions
analysis.options.side_effects.effect_free_functions
Effect_Free_Volatile_Variables
analysis.options.side_effects.effect_free_volatile_variables
Enums_As_Integer_Constants
analysis.options.types.enums_as_integer_constants
External_Functions_Returning_Bool
analysis.options.types.external_functions_returning_bool
Fixed_Size_Int_Typedefs
analysis.options.types.fixed_size_int_typedefs
Hierarchy_Edge_Name
analysis[‘Metrics’].hierarchy_edge_name
Hierarchy_View_Name
analysis[‘Metrics’].hierarchy_view_name
Ignore_Tokens_In_Disabled_Sections
analysis.options.scanner.ignore_tokens_in_disabled_sections
IRAnalysis_Allow_Function_Pointer_Signature_Mismatch
- analysis[‘StaticSemanticAnalysis’].callgraph_options
.allow_function_pointer_signature_mismatch
IRAnalysis_Assume_Globals_Are_Initialized
- analysis[‘FaultDetection-UninitializedVariable’]
.assume_globals_are_initialized
- (also at other rules checking for uninitialized variables:
MisraC-9.1, MisraC-21.1, MisraC2012Directive-4.1, MisraC2012-9.1, MisraC++-0.3.1, MisraC++-8.5.1, AutosarC++*-M.0.3.1, AutosarC++17_03-M8.5.1, AutosarC++17_10-M8.5.1, CertC-EXP33)
IRAnalysis_Contexts
- analysis[‘StaticSemanticAnalysis’].global_classic_options
.routine_context_granularity
IRAnalysis_Safe_Mode
- analysis[‘StaticSemanticAnalysis’]
.enable_filtering_heuristics (inverted logic)
IRAnalysis_Uses_Uncalled_Entries
- analysis[‘StaticSemanticAnalysis’].callgraph_options
.treat_uncalled_functions_as_alive
IRAnalysis_With_AbstraIR
- analysis[‘StaticSemanticAnalysis’].global_classic_options
.abstract_interpretation
IRAnalysis_With_AbstraIR_Null
- analysis[‘StaticSemanticAnalysis’].global_classic_options
.use_abstract_interpretation_for_null
Local_Effect_Functions
analysis.options.side_effects.local_effect_functions
Misra_Essential_Types_Treat_Char_As_Integer
analysis[‘MisraC2012-10’].treat_char_as_integer
Mixed_Headers_Are_C
analysis[‘Stylechecks’].mixed_headers_are_c
Propagate_Metrics
analysis[‘Metrics’].propagate
Report_All_Metric_Values
analysis[‘Metrics’].report_all_values
Report_Propagated_Metric_Values
analysis[‘Metrics’].report_propagated_values
Run_IRAnalysis_Checks
analysis.activate(‘StaticSemanticAnalysis’)
Side_Effect_Functions
analysis.options.side_effects.side_effect_functions
Use_Bool_Cache
n/a
Use_Comment_Cache
n/a
Use_ConstValue_Cache
n/a
Use_Type_Cache
n/a
User_Bool_Type
analysis.options.types.user_bool_types (is a set now)
Formerly, special flag
CONFIG.Run_IRAnalysis_Checks = Truewas required to activateiranalysis(fault detection). This is now done by activation of the ruleStaticSemanticAnalysis.Save the configuration in the GUI
Remove the
stylecheckconfiguration in yourbuild.confand delete any project-specific filestylecheck.config(in case there is some metric configuration in that file, only do this after metric migration) as well asstylecheck_config.pyif you don’t need it any more
Violations in macros¶
The configuration option report_at_macro_invocation was renamed to
report_at and no longer accepts boolean values.
report_at_macro_invocation = Falsecorresponds toreport_at = 'macro_definition'
report_at_macro_invocation = Truecorresponds toreport_at = 'macro_invocation'
When using the new configuration system, the report_at
option has a new default value: 'automatic'. When using the old configuration
system, the default value was 'macro_invocation'.
In automatic mode, the rule will automatically detect where to report the violation. Violations that occur for every use of the macro independent of the macro arguments or context in which the macro was used, will now be reported at the macro definition. Because multiple violations in the same line are deduplicated, this tends to reduce the number of violations reported. If the file with the macro definition is excluded from analysis (e.g. system header), violations in these macros will not be reported anymore.
Note
If you leave the report_at option at its default value, it is possible
that you once get a large set of added/removed issues when migrating.
1.4.65.10. Migrate Metrics¶
If you’ve got metric enabled, perform the following steps:
Perform the steps shown above for stylecheck migration, this time for
metric_config.pyand rule directories listed instylecheck.configunder theMetrickeyActivate and configure the token metrics formerly listed in
Metrics.configin the rules in rulegroupMetrics/TokenMetricsRemove the
metricconfiguration in yourbuild.confand delete any project-specific fileMetrics.config
1.4.65.11. Migrate Architecture Check and Processline¶
If you’ve got architecture_check and/or processline enabled, perform
the following steps:
In the GUI, select the rule
Architecture-ArchitectureCheckand set its options to the same values as before. There are specific rules now for the import of the architecture specification and to perform certain mappings; activate and configure those rules in groupArchitectureas neededFor the former processline, an intermediate step is possible: You can activate the rule
Architecture-ProcessLinewhich directly corresponds to the processline framework. However, this is just a wrapper to temporarily simplify the migration to version 7.0 and will be dropped some time in the futureIf needed, reorder the activated analyses in group
Architecture(the order is important here as these rules might modify the underlying RFG)Save the configuration in the GUI
Remove the
architecture_checkand/orprocesslineconfiguration in yourbuild.confand delete any project-specific fileprocessline_config.pyonce you’ve fully migrated the contents to the new rules (not using theArchitecture-ProcessLinewrapper)
1.4.65.12. Migrate teecap¶
If you’ve got teecap enabled, perform the following steps:
If you had special teecap formats defined in XML files inside the
teecapconfig subfolder, recreate corresponding format definitions with the rules under the rulegroupAnalysisControl/ExternalAnalysisFormatsIn the GUI, select the rule
ImportExternalAnalysisOutputand set its options to run the external tool of which the output should be captured. You may want to rename the rule (see next point below) as the name will appear as the rule name for the issues produced with this rule. The format of the output can be configured as well (the rule selects the desired format which is defined under the rulegroupAnalysisControl/ExternalAnalysisFormats)If you want to capture the output of more than one external tool, create as many copies of the rule as needed and configure them. Creating copies in the GUI is done by right-clicking on the rule
ImportExternalAnalysisOutputand choosingCopy...Save the configuration in the GUI
Remove the
teecapconfiguration in yourbuild.confand delete any project-specific XML files inside theteecapconfig subfolder
1.4.65.13. Migrate Code Annotations¶
If you are using code annotations (typically through a custom
analysis_config.py), perform the following steps:
Version 7.0.0 allows to reuse a 6.9-style
analysis_config.pywithaxivion_analysis, but this is deprecated. In order to reuse it, set the optionAnalysisControl/CodeAnnotations.use_analysis_config_py. This may be used for a quick initial migration (but follow the note in the chapter above regarding minimal migration, the transition to Python 3 may require updates to theimportstatements).Otherwise, select and activate the desired comment formats under
AnalysisControl/CodeAnnotations. As with other rules, you can copy and rename such formats to create independent copies that have independent configurations. Set the options to match your previous settings. Also use this approach to define your own comment formats.Formats activated in this way are automatically active for all files in the project; the former
initial_formatsis not necessary any more.The former
initial_commentsdictionary is now represented by ruleInitialExternalAnnotations(underAnalysisControl/CodeAnnotations/ExternalCodeAnnotations).The former
project_commentslist is now represented by ruleProjectWideExternalAnnotations(underAnalysisControl/CodeAnnotations/ExternalCodeAnnotations).The former
lint_rule_mapping_filenameis now represented by the optionrule_mapping_filein all formats underAnalysisControl/CodeAnnotations/LegacyFormats/LintFormats. Likewise,prqa_rule_mapping_filenameis now optionrule_mapping_filein all formats underAnalysisControl/CodeAnnotations/LegacyFormats/PRQAFormats.If you had defined a custom parser function to extract the justification, and if that parser used the four-argument version taking not only the comment and the group text, but also the erosion kind and rule name, you should transition to the new form taking three arguments:
def my_parser(comment, text, issue). Theissuehas fieldskind(an enumerator value of typecode_annotations.IssueKind) andrule_name(a string).Replace the old
analysis_config.pywith the new configuration created above.
1.4.65.14. Migrating additional stylechecks and metrics¶
Version 7.0.0 also includes a new analysis framework which now handles all kinds of analyses in a uniform way. If you’ve got stylechecks or metrics in place which are not part of the standard installation (e.g. self-written rules), then they must be updated to fit into this new framework.
A major change in the analysis framework (compared to the former stylecheck framework) is the use of instances of Python classes as rules where the old framework used classes instead. This means there can be multiple instances of a rule now, each with their own, independent configuration.
The migrate tool can migrate Python code from
the old framework to the new framework.
Run it with the -w switch (to write the changes back into the input files)
on the whole directory containing your rules:
migrate 7_0 -w .../your_rules
Please review the code changes made by the tool. In some cases it can be necessary to manually make further adjustments to the rules.
An example for a composite rule (combining multiple existing rules) is the following:
Composite rule to combine different rules under the same name¶# Copyright (C) 2025 Axivion GmbH # Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group # https://www.qt.io from rule1location import rule1 # replace with the proper Python module/package from rule2location import rule2 # replace with the proper Python module/package from axivion import analysis @analysis.rule('SecondName', options={'my_option': True}) @analysis.rule('CommonName') class CommonNameRule(analysis.CompositeRule): # choose a class name _parts = [rule1.Rule1Rule, rule2.Rule2Rule] # use the Python class names title = '''The title for the composite rule''' my_option: bool = False '''Description of the option.'''
Here, the Python class is instantiated by the decorator @analysis.rule,
and the resulting instances are usable as new rules. The decorator can pass in
values for all constructor parameters, and the instance SecondName
shows how to redefine the default value of an option in this way.
For a self-written IR-based rule with its own logic you would typically inherit
from the new class analysis.AnalysisRule and implement at least
the execute method. An example is provided here:
Minimal self-written rule¶# Copyright (C) 2025 Axivion GmbH # Copyright (C) 2025 The Qt Company GmbH, a subsidiary of The Qt Group # https://www.qt.io from axivion import analysis # other imports as required, e.g. from bauhaus.ir.common.output import unparse @analysis.rule('AnotherCopy', options={'some_option': 17}) @analysis.rule('MyRule') class MyRule(analysis.AnalysisRule): # choose a class name title = '''The title for the composite rule''' some_option: int = 42 '''Description of the option.''' _message_descriptions = {'my_message_key': 'This text will be shown'} def execute(self, ir_graph): # ... replace with your logic referencing self.some_option # report your findings one by one as style issues with # self.add_message(node, 'my_message_key', entity=unparse.entity(node)) # you can also report all other kinds of issues with functions # like add_metric_issue, add_cycle_issue etc. pass
Note
Beginning with version 7.0.0, the public API that can be used inside custom
extensions like additional stylechecks will be defined more precisely. For this,
the affected functions, classes etc. are migrated step-by-step from the
bauhaus package into the axivion package. The axivion package
forms the public API. During the transition phase, you can still access the
old entry points which have not yet been migrated, but the access to
bauhaus is deprecated from now on.
1.4.65.15. Migrating Gravis¶
The configuration of gravis differs from that of other parts of the Axivion Suite in that
gravis not only finds configuration files via BAUHAUS_CONFIG, but also looks
for a file gravis2.config in the .bauhaus directory inside your home directory.
This allows user-specific settings without having to set BAUHAUS_CONFIG to a
user-specific value.
The automatic migration migrate gravis behaves like gravis: It first processes all
configuration files referenced via BAUHAUS_CONFIG and writes a single output file (called
gravis_config.json by default, but this can be overridden) that combines all the settings
found via BAUHAUS_CONFIG. Then, it processes the gravis configuration file in the
.bauhaus directory inside your home directory, if present, and writes a file called
gravis.json to the same location. Like the old XML file gravis2.config, this new
file is found automatically by gravis.