6.2.5.49. Architecture-Reengineering¶
Use an architecture and mapping initially generated from code information to do architecture verification
Required inputs: RFG
-
An initial architecture model and mapping is automatically generated from code by this rule
(specified by
generated_architecture_view_nameandgenerated_mapping_view_name). Both generated architecture and mapping adhere to a meta model specification given by the rules in configuration optiontransformation. These views represent the current state of the code, there are no divergences if they are used for architecture verification. The user can use them as an (initial) architecture model for architecture verification. For this the architecture view can either- be exported into a GXL file and later modified in Gravis, or
- exported and imported into Enterprise Architect using the importer resp. exporter rules for Enterprise Architect models.
transformationif the model is intended to be checked using the architecture verification feature. This architecture model is called an "external architecture", since it might be modified by the user. -
An external architecture view named EXT_ARCH can also be specified as input for the rule,
using the config option
external_architecture_view_name. The rule then checks whether the code structure matches the hierarchical structure of elements in EXT_ARCH (using the rules specified by the config optiontransformation), and issues warnings if there are discrepancies. If this check succeeds, a view named "EXT_ARCH Mapping" and a view named "EXT_ARCH for check" are created, which represent mapping view and architecture view that are transformed to be used in the actual architecture check (e.g., potentially created UML dependency edges are transformed into source dependency edges). They can then be used by Architecture-ArchitectureCheck for performing architecture verification.
Architecture-Reengineering.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:
{}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:
{ 'Directory': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='IDENTICAL', node_type='Package' ), 'File': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='STRIP_FILE_EXTENSION', node_type='Component' ), 'Module': bauhaus.architecture.reengineering.config.NodeTransformConfig( name_provider='STRIP_FILE_EXTENSION', node_type='Component' ) }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 : ArchitectureNodeType =
Node type of the architecture root'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 : NodeNameProvider = 'IDENTICAL'
node_type : ArchitectureNodeType = 'Component'