6.2.5.51. Architecture-ReengineeringEACodeEngineering¶
Generate UML-based Architecture from RFG representation of code
Required inputs: RFG
- A class is mapped to an EA Class
- A class with Element.Is_Enum is mapped to an EA Class with stereotype «enumeration»
- A class with Element.Is_Union is mapped to an EA Class with stereotype «union»
- A class with Element.Is_Struct is mapped to an EA Class with stereotype «struct»
- A class with Element.Is_Struct and Element.Is_Typedef_To_Anonymous is mapped to an EA class with stereotype «struct».
- A class with Element.Is_Abstract and Element.Is_Interface is translated to an EA «interface».
- Methods are translated to EA Operations with the visibility being set to either Element.Is_Public_Visibility or Element.Is_Private_Visibility.
- Namespaces are translated to EA Packages
- Constants are translated to EA attributes
Architecture-Reengineering. If you require a customized model representation, use
rule Architecture-Reengineering (see also additional documentation there).Possible Messages
This rule has no predefined messages.
Options¶
This rule shares the following common options: exclude_messages_in_system_headers, excludes, includes, justification_checker, post_processing, provider, severity
The following places define options that affect this rule: Analysis-GlobalOptions
base_view_name¶
base_view_name : str = 'Declaration Facts'
export_warnings¶
export_warnings : bool = True
external_architecture_view_name¶
external_architecture_view_name : str | None = None
None, the view V having name
external_architecture_view_name is treated as architecture view given
from outside. The rule then checks, after creating the generated architecture view and
mapping view, whether the code structure matches the hierarchical structure
of elements in V (using the rules specified by the config option transformation). If
this check succeeds, a view "NAME Mapping" and a view "NAME for check" are created, which represent
mapping view and architecture view that is transformed to be used in the actual architecture check (e.g.,
UML dependency edges are transformed into source dependency edges).
generated_architecture_view_name¶
generated_architecture_view_name : str = 'Generated Architecture'
hierarchy_view_name) and base_view_name, respectively.
generated_mapping_view_name¶
generated_mapping_view_name : str = 'Generated Mapping'
hierarchy_view_name.
hierarchy_view_name¶
hierarchy_view_name : str = 'File'
external_architecture_view_name
is set, for checking the hierarchical consistency of the external architecture view.
loglevel¶
loglevel : LogLevel = 'WARNING'
transformation¶
Configuration settings for architecture meta model, defining how information from hierarchy and base view is transformed into architecture and mapping view.
transformation.advanced_node_translation
Rules for translating single nodes. Keys are type names, values specify how a node of the given node type should be translated into an architecture node. Values are given in form of callables having signatureType: dict[str, typing.Callable[[_dg.Node, _dg.View, bauhaus.architecture.reengineering.nodes.GenArchNode, bauhaus.architecture.reengineering.config.Code2ArchTransformConfig], bauhaus.architecture.reengineering.nodes.GenArchNode]]
Default:
{ 'Class': <function bauhaus.rules.axivion.architecture.architecture_reengineering.class_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode>, 'Method': <function bauhaus.rules.axivion.architecture.architecture_reengineering.method_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode>, 'Type': <function bauhaus.rules.axivion.architecture.architecture_reengineering.type_translation(code_node: _dg.Node, _: _dg.View, parent: bauhaus.architecture.reengineering.nodes.GenArchNode, transformation_config: bauhaus.architecture.reengineering.config.Code2ArchTransformConfig) -> bauhaus.architecture.reengineering.nodes.GenArchNode> }This option allows for a more refined translation rule than the one given in
(node: rfg.Node, view: rfg.View, parent: reengineering.GenArchNode, transformation_config: Code2ArchTransformConfig) -> GenArchNode.node_translation. The entries innode_translationtake precedence when looking for a translation of a node: If e.g. the translation rule of a node of typeClasshas to be determined, first a lookup is done innode_translation. If there is no entry specified there withClassas key, another lookup is done inadvanced_node_translation. If no matching translation rule is found, then the node is not represented in the architecture.
transformation.annotate_dependency_counts : str | None =
If set to a type nameNonetypename(e.g.Call): Adds a tagged valueUML:taggedValue:typename:Countthat counts the number of summarized dependency edges of the given type. Only added if the count is greater than 0.
transformation.dependency_lift : typing.Callable[[_dg.Edge, _dg.View], typing.Optional[typing.Tuple[_dg.Node, _dg.Node]]] | None =
If specified, the function returns the desired source and target node that should represent the given dependency, orNoneNoneif no dependency should be generated. In most cases, the nodes will be parent nodes relative to the given (hierarchy) view. If this option is specified,node_types_with_dependencieshas no effect.
transformation.detailed_dependencies : bool =
If set toFalseFalse, every generated dependency will be of the most general source dependency typeSource_Dependency; otherwise, the dependencies will be exactly the type they are in the base view (e.g.Type_Of,Direct_Call.
transformation.excluded_source_names : list[str] =
Do not translate source entities (files or directories) having one of the names given here. Only used if['src', 'inc', 'include']advanced_node_translationis set toNone.
transformation.ignored_dependencies : set[str] =
These dependencies will not be modelled and therefore are implicitly always allowed in the resulting architecture.set()
transformation.level_restriction : int =
Only descend to code entities of this depth level for generating model elements. If e.g.0level_restriction= 2, the directorysrc/appis still separately modeled, but notsrc/app/internal. If set to 0: no level restriction.
transformation.node_translation
Rules for translating single nodes. Keys are type names, values specify how a node of the given node type should be translated into an architecture node. Node types have to match exactly (so e.g. a node of typeType: dict[str, NodeTransformConfig]
Default:
{ 'Class_Template': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='IDENTICAL', node_type='Class' ), 'Constant': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='IDENTICAL', node_type='Attribute' ), 'Member': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='IDENTICAL', node_type='Attribute' ), 'Namespace': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='IDENTICAL', node_type='Package' ) }Classdoes not match a translation rule havingSource_Entityas key). The default translates nodes of typeDirectoryinto packages and nodes of typeFileorModuleinto components. If there is no entry given for the type of the node, a translation is searched for inadvanced_node_translation(this option allows for a more refined translation rule if needed). The entries innode_translationtake precedence when looking for a translation of a node: If e.g. the translation rule of a node of typeClasshas to be determined, first a lookup is done innode_translation. If there is no entry specified there withClassas key, another lookup is done inadvanced_node_translation. If no matching translation rule is found, then the node is not represented in the architecture.
transformation.node_types_with_dependencies : set[str] =
Only from nodes of this type there will be outgoing / incoming dependencies. Dependencies from nodes of different type are lifted to the nearest parent node having one of those types, and are not represented if no such parent exists. Default is{'Component', 'Package'}ComponentandPackage. Only used whenlift_dependenciesis not specified (None).
transformation.root_name : str =
Name of the architecture root in the generated architecture view'Model'
transformation.root_type
Node type of the architecture rootType: ArchitectureNodeType
Default:
'Package'
transformation.skipped_root_paths : list[str] =
Do not generate architecture representation for these code parts.['/', 'c:', 'C:', 'd:', 'D:', '']
transformation.transferable_attributes
Set of attributes for various architecture nodes that are transferred from the code view. Only used ifType: set[str]
Default:
{'Element.Has_Private_Visibility', 'Element.Has_Public_Visibility', 'Element.Is_Abstract', 'Element.Is_Static', 'Element.Is_Virtual_Method'}advanced_node_translationis set toNone.
transformation.treat_dependencies_as_optional : bool =
Generated dependencies will be marked as optional if set toTrueTrue. This can be useful e.g. if an architecture for multiple product variants has to be created and certain parts of the project are only used in certain project variants.
Option Types¶
These types are used by options listed above:
ArchitectureNodeType¶
An enumeration.None
Attribute
Class
Component
Operation
Package
LogLevel¶
An enumeration.WARNING
INFO
DEBUG
NodeNameProvider¶
An enumeration.IDENTICAL
STRIP_FILE_EXTENSION
NodeTransformConfig¶
NodeTransformConfig(node_type: 'ArchitectureNodeType' =name_provider
Type: NodeNameProvider
Default:
'IDENTICAL'
node_type
Type: ArchitectureNodeType
Default:
'Component'