5.9.6. Architecture Analysis Facilities

Architecture analysis checks whether two views match in structure. In this process, one view represents the architecture and the other view represents the implementation of that architecture. Three pieces of input data are required for the check: the two views to be checked and a mapping between them. The mapping is also represented as a view. In the descriptions of the interactive architecture analysis features provided by Gravis, it is assumed that a software architecture is being checked against code. However, architecture analysis can also be used for other purposes, e. g., model-to-model checking.

The Architecture Guide describes the general architecture analysis approach and typical Gravis usage scenarios. This section focuses on the Gravis user interface.

Note

The view representing the implementation can be either a single view in the RFG or a combination of two views: a hierarchy view that specifies the hierarchical nesting of source code entities and a base view that specifies the dependencies between them. Whether a single view or two views are used depends on the programming language from which the RFG was created: source code analysis of C# and Rust produces a single view, whereas analysis of C/C++ code produces separate views for the hierarchy and the dependencies. Two alternative combinations of views can be used: Code Facts as the base view with Module as the hierarchy view or Declaration Facts as the base view with File as the hierarchy view. Similarly, C# analysis produces two alternative views: Code Facts or Assembly. Which of these two views or combinations of views is the most suitable depends on the way the software is designed and the architectural properties to be checked.

The choice of views is discussed in more detail in the section Creating the Mapping in the Architecture Guide.

Views involved in the analysis must be assigned roles:

ic_view_architectureArchitecture, ic_view_mappingMapping, ic_view_hierarchyHierarchy, and ic_view_baseBase. The last two roles are used for the code (the implementation). If only one view represents the code under analysis, the ic_view_hierarchyHierarchy role must be assigned. If two views are used, the ic_view_hierarchyHierarchy role is assigned to the view containing the hierarchy used for mapping, while the ic_view_baseBase role is assigned to the view containing the relationships among the entities in the code.

Hereafter, the view assigned the ic_view_architectureArchitecture role is referred to as the architecture view, the view assigned the ic_view_hierarchyHierarchy role as the hierarchy view, and the view assigned the ic_view_mappingMapping role as the mapping view.

Note

The mapping view contains nodes from the architecture view and the hierarchy view. Additionally, the mapping contains edge-maps-to Maps_To edges from nodes in the hierarchy to nodes in the architecture. Alternatively to the dedicated Mapping Window described in the next section, the mapping view can be reviewed and edited in a standard Graph Window using the menu entry ic_open_view Open → ic_view_open_flat Flat... from the view’s context menu in the graph View Box, or by double-clicking the view while the Mapping role is not assigned to it.

While an architecture project is open, Gravis assigns the roles automatically and the graph View Box does not show them.

5.9.6.1. Architecture Projects

An architecture project contains everything needed to model and check architectures in Gravis. It consists of one or more architecture checks. Each check specifies an architecture view, a mapping view, a layout of the architecture view, a base view, a hierarchy view, and analysis options. The project is stored in a project file with the extension .gaproj. The GXL files of the architecture and mapping views and the layout files of the architecture views are stored in the directory of the project file, the project directory. Keep the project directory under version control together with the configuration of your analysis project.

An architecture project takes care of the files involved in architecture checking:

  • Opening the project loads the RFG and then the architecture views, mapping views, and architecture layouts from the project directory.

  • Gravis tracks which of these views and layouts have been modified and saves them to the project directory on request. There is no need to export views as GXL files or to copy layout files.

  • When the project is closed, Gravis asks you whether to save modified views and layouts of the project. Other changes to the RFG are discarded without a prompt, because the RFG will eventually be replaced by a newer version from the dashboard anyway.

  • Each check is run with a single click, using the options stored in the project. The Analysis dialog is not needed.

  • The rule Architecture-GravisArchitectureProject runs the checks of the project during continuous integration, using the same options as Gravis.

The section Architecture Projects in the Architecture Guide describes how to set up and use an architecture project. This section describes the user interface.

Creating an architecture project

An architecture project is created for the currently loaded RFG. Choose File → ic_new_architecture_project New architecture project... from the main menu. This entry is available only if the current graph was loaded from an RFG file. The New Architecture Project dialog offers the following fields:

Project name

The name of the project. It is also used as the base name of the project file, so it must not contain any of the characters \ / : * ? " < > |.

Location

An existing, writable directory. Browse... opens a directory chooser.

Create project directory

If ticked, a subdirectory named after the project is created in the location and becomes the project directory. Otherwise, the location itself is the project directory.

Below the fields, the dialog shows the path of the project file and of the directory to be created. A path is shown in red if the name or the location is invalid. If the project file exists already, you are asked whether to overwrite it.

Clicking OK closes any open architecture project, creates the project file, and shows the new project in the Architecture Project Tree. The New Architecture Check dialog then opens, because a project needs at least one check to be of any use.

Creating an architecture check

The New Architecture Check dialog opens automatically after creating a project. To add a check to an open project, choose ic_architecture_check New architecture check... from the context menu over the project entry or over the empty space below the entries of the Architecture Project Tree. While a project has no checks, the tree also shows a New architecture check... button below the project entry.

The New Architecture Check dialog.

The New Architecture Check dialog for an RFG created from C/C++ and Rust code.

The dialog offers the following fields:

Check name

The name of the check. The result view created by running the check has the same name.

Check type

Determines the base view and the hierarchy view of the check, which are shown in parentheses after each check type. Only check types whose views exist in the RFG are offered:

  • C/C++ logical language view: Code Facts and Module

  • C/C++ declarations: Declaration Facts and File

  • C/C++ includes: Include and File

  • C# Assemblies: Assembly as both base and hierarchy view

  • C# Namespaces: Code Facts as both base and hierarchy view

  • Rust: Code Facts as both base and hierarchy view

The question mark button opens the section Choosing the source abstraction of the Architecture Guide, which explains the differences.

Architecture view name

The name of an existing view or the name of a new view to be created. The drop-down list contains all views of the RFG.

Layout name

The name of the persistent layout of the architecture view that the project manages. The default is Default. The name must not start with an underscore.

Mapping view name

The name of an existing view or the name of a new view to be created.

The architecture view and the mapping view must not be used by another check of the project, and they must differ from each other, from the base and hierarchy views, and from the check name. Their names must differ in more than just upper and lower case, because their GXL files would clash otherwise. The check name must differ from the base and hierarchy views.

Clicking OK adds the check to the project:

  • An architecture view or mapping view that does not exist yet is created as an empty view.

  • The architecture view and the mapping view are saved as GXL files in the project directory. The file names are derived from the view names.

  • If the architecture view has a persistent layout with the given layout name, this layout is used. Otherwise, a new persistent layout with that name is created. The layout is copied to the project directory; the file name is derived from the architecture view name and the layout name.

Using existing views and layouts allows converting an architecture setup that was created without an architecture project. The new check is part of the project only after the project file has been saved, e. g., using Save all.

Opening and closing an architecture project

An architecture project file is opened like a graph file: using File → ic_open Open... or File → Open recent, by dragging the file onto the Gravis main window, or by passing it on the command line. The project file refers to the RFG file by the path that was loaded when the project was created. Opening the project closes the current graph, loads this RFG, and then performs the following steps for each check:

  • The architecture view, the mapping view, and the result view of the check are deleted from the RFG if present. The RFG downloaded from the dashboard may contain these views, but the versions in the project directory take precedence.

  • The architecture view and the mapping view are imported from their GXL files in the project directory. If a GXL file is missing, you can choose between aborting and starting with an empty view.

  • The architecture layout is copied from the project directory to the persistent layout storage of the RFG (see Persistent layout storage), replacing the layout with the same name.

The RFG is usually not under version control together with the project, so after checking out a project, the RFG may not exist at the path stored in the project file. In this case, a file dialog asks for the RFG, and cancelling it aborts opening the project. After the RFG has been loaded, Gravis asks whether to store its location in the project file. Update project file saves the project file with the new path right away. The path is stored relative to the project file if the previous path was relative. Keep project file uses the location for the current session only. Saving the project later keeps the previous path, so that you can commit other changes to the project without changing a path that applies to other users.

While a project is open, the main menu entries for closing and reloading the graph change to File → Close architecture project and File → Reload architecture project. Closing the project also closes the graph. Reloading the project closes it and opens it again, which also loads the current version of the RFG file. Use it after replacing the RFG file with a newer version downloaded from the dashboard. Closing the graph View Box closes the project, too.

When the project is closed, Gravis checks for unsaved changes:

  • If the project file has unsaved changes, for example a new check or modified check options, a dialog offers Save all (save the project file and all modified views and layouts of the project), Save (save the project file only), Discard, and Cancel.

  • Otherwise, if views or layouts of the project have been modified, a dialog lists the modified views and offers to save them.

Changes to other views of the RFG are discarded without a prompt.

The Architecture Project Tree

While an architecture project is open, the graph View Box is titled Architecture/View Box and shows the Architecture Project Tree above the list of views. The tree contains an entry for the project, an entry for each check, and entries for the architecture view and the mapping view of each check. Each entry has buttons for its operations.

The Architecture Project Tree.

The Architecture Project Tree of a project with two checks. The architecture view and the layout of the first check have been modified, and a window showing the result of the first check is open.

ic_architecture_project Project entry

Shows the project name. The tooltip shows the path of the project file.

  • ic_continue Run all runs all checks of the project.

  • ic_save_flat Save all saves the project file and all modified views and layouts of the project. The button is enabled only if there is anything to save.

ic_architecture_check Check entry

Shows the check name and the names of the base view and the hierarchy view.

ic_ap_architecture Architecture view entry

Shows the name of the architecture view and the name of its layout. The tooltips show the paths of the GXL file and the layout file in the project directory.

  • ic_edit_no_frame opens the architecture view with its layout in a hierarchical graph window. If the window is already open, it becomes the active window. Double-clicking the entry has the same effect. When this window is closed, layout changes are saved to the persistent layout storage of the RFG without a prompt. To discard layout changes, use ic_persistent_layout Layout storage → ic_revert_layout Revert layout '<layout name>' before closing the window.

  • ic_save_flat saves the architecture view to its GXL file and its layout to the project directory, including unsaved layout changes in an open window. Only the modified ones are saved, and the button is enabled only if the view or the layout has been modified.

ic_ap_mapping Mapping view entry

Shows the name of the mapping view. The tooltip shows the path of the GXL file in the project directory.

  • ic_edit_no_frame assigns the roles for the check and opens the Mapping Window with the architecture shown as a tree. Hold down Shift while clicking to show the architecture as a graph. Any other open Mapping Window is closed. Double-clicking the entry has the same effect.

  • ic_save_flat saves the mapping view to its GXL file. The button is enabled only if the view has been modified.

A modified view or layout is shown in blue with an asterisk appended to its name, and its save button changes to ic_save_flat_red. A layout counts as modified if an open window shows it with unsaved changes or if its saved state differs from the copy in the project directory. Layouts are saved to the project directory by the save button of the architecture view entry, by Save all, or when confirming the prompt on closing the project. A check entry is shown in the same way while the options of the check differ from those saved in the project file, and the project entry while checks have been added or deleted since the project file was last saved.

The context menu of the Architecture Project Tree contains the following entries:

ic_architecture_check New architecture check...

Available over the project entry and over the empty space below the entries. Opens the New Architecture Check dialog (see Creating an architecture check).

ic_view_open_violations Open violations...

Available over a check entry. Opens the Violations List of the check or, if it is already open, makes it the active window (see Running architecture checks). The entry is enabled only if the result view of the check exists, that is, after the check has been run.

ic_revert Revert from project

Available over a check entry, an architecture view entry, and a mapping view entry. Discards the unsaved changes of the entry and restores the state saved in the project directory, without reloading the project. Over an architecture view entry, a modified architecture view is imported again from its GXL file together with its layout. If only the layout has been modified, the layout is restored and applied to an open window showing it. Over a mapping view entry, the mapping view is imported again. Over a check entry, the options of the check, its architecture view, its layout, and its mapping view are restored, as far as they have been modified. Importing a view again closes the windows showing it. The window opened by the ic_edit_no_frame button of the architecture view entry and the Mapping Window of the check are reopened at their previous positions in the tabs. The entry is enabled only if there is anything to revert.

ic_architecture_check Delete check '<check name>'

Available over a check entry. After confirmation, removes the check from the project and deletes its architecture view, mapping view, and result view from the RFG, closing any windows showing them. The persistent layouts of the architecture view are deleted from the persistent layout storage of the RFG. If the check has files in the project directory, the confirmation dialog offers to delete them as well. Unless they are deleted, the files remain in the project directory.

While a project is open, views used by the project cannot be deleted from the graph View Box, and the layouts managed by the project cannot be renamed or deleted.

The name, the check type, and the views of an existing check cannot be changed. To change them, create a new check.

Running architecture checks

ic_continue Run in a check entry runs the architecture analysis with the views and options of the check. ic_continue Run all in the project entry runs all checks. Each check creates a result view named after the check and opens it in a hierarchical graph window that uses the architecture layout of the check. The result view contains the violating edges, and both the result edges and the violating edges are lifted (see The graphical Architecture Check result view). The Analysis dialog is not involved.

Running a check again replaces its result view. If a window showing the previous result is open, the new result window takes its place in the tabs and keeps its layout, for example the expanded nodes. This allows you to update the result after changing the architecture or the mapping without having to rearrange the result window.

The Violations List is not opened automatically. To open it, choose ic_view_open_violations Open violations... from the context menu of the check entry. The list is opened in the tab to the right of the result window or, if it is already open, made the active window. Alternatively, choose ic_view_open_violations Open → Violations... from the context menu of the result view in the graph View Box. If the Violations List of a check is open when the check is run again (e. g., via the Update button), it is updated alongside the graphical result window. This only applies to the full Violations List, not to the lists of causing edges opened by double-clicking a result edge.

Architecture check options

The ic_settings button in a check entry opens the Architecture Check Options dialog. These options are stored in the project file and are also used by Architecture-GravisArchitectureProject.

The Architecture Check Options dialog.

The Architecture Check Options dialog.

Type hierarchy

The root of the edge type hierarchy to be checked. The default is edge-source-dependency Source_Dependency.

Declaration forwarding

Enables the special handling of declarations described in Handling C/C++ Declarations. Forwarding type sets the edge type of declaration forwarding dependencies.

Allow dependencies to parents

Permits all dependencies between elements mapped to a component and elements mapped to one of its ancestors without explicit edges in the architecture.

Ignored edge types

Dependencies of these edge types are not reported as divergences or convergences. The button next to the field opens a dialog for choosing the types.

The first three options correspond to the options of the same name in the Analysis dialog (see Performing Architecture Analysis).

5.9.6.2. Mapping Window

The Mapping Window provides convenient facilities for reviewing and editing the mapping between the source code and the architecture. The ic_view_architecture Architecture, ic_view_mapping Mapping, and ic_view_hierarchy Hierarchy roles must be assigned prior to opening the Mapping Window. The window is opened by either double-clicking the view with the role ic_view_mapping Mapping in the graph View Box, or by choosing either Edit → ic_mapping Architectural mapping → ic_view_open_tree Architecture as tree or Edit → ic_mapping Architectural mapping → ic_view_open_hierarchical Architecture as graph from the main menu, or by choosing either ic_show_view Open → ic_view_open_tree Mapping with architecture as tree... or ic_show_view Open → ic_view_open_hierarchical Mapping with architecture as graph... from the context menu of the view with the role ic_view_mapping Mapping in the graph View Box. With an architecture project, use the ic_edit_no_frame button of the mapping view entry in the Architecture Project Tree, which assigns the roles automatically.

The Mapping Window is divided into two sections. The left section displays the hierarchy view as a tree, and the right section displays the architecture view as either a tree or a graph.

Note

If the architecture is displayed as a tree, notes are omitted because their contents cannot be displayed in a tree and mapping source code to a note is not meaningful. They are shown if the architecture is displayed as a graph.

The Mapping Window.

The Mapping Window with the architecture shown as a tree.

The node symbols in both sections are decorated with blue and white icons indicating each node’s mapping state.

Icon

Hierarchy section

Architecture section

ic_mapping_free

lacks a mapping

lacks a mapping

ic_mapping_self

source of a mapping

target of a mapping

ic_mapping_full

itself not mapped but all children are mapped

itself not mapped to but all children are mapped to

ic_mapping_partial

itself not mapped but some children are mapped

itself not mapped to but some children are mapped to

ic_mapping_implicit

implicitly mapped by ancestor node

ancestor node is mapped to

ic_mapping_implicit_and_partial

implicitly mapped by ancestor node and some children are mapped

ancestor node and some children are mapped to

Additionally, any node that is directly mapped (or mapped to) displays a small downward-pointing arrow (ic_mapping_inside) if there are descendant nodes in its subtree with a mapping that overrides this node’s mapping. These can be found using ic_mapping Mapping → ic_select_mapped_descendants Select mapped descendants from the context menu (see the next section). A small upward-pointing arrow (ic_mapping_above) is displayed if there is an ancestor node whose mapping is overridden by this node’s mapping.

Mapping Window context menus

The context menus in the two sections resemble those of tree and graph windows, respectively. In addition, the context menus contain a ic_mapping Mapping submenu with the following operations:

ic_select_mapped_entities Select mapped nodes selects the mapped node(s) on the opposite side to which the clicked node is mapped. The selection in that view is cleared beforehand.

ic_select_mapped_descendants Select mapped descendants selects all nodes in the subtree of the clicked node that are directly mapped to or from a node on the other side. The selection is cleared beforehand and the hierarchy is expanded to reveal the selected nodes. This operation is primarily used to find descendants with a more specific mapping if the small arrow icon (ic_mapping_inside) next to a mapped node indicates that there are mapped nodes in its subtree.

ic_unmap Unmap node (flat) removes the mapping for the clicked node.

ic_unmap_deep Unmap node (deep) removes the mapping for the clicked node and its children recursively.

ic_unmap_selection Unmap selection (flat) removes the mapping for all selected nodes.

ic_unmap_selection_deep Unmap selection (deep) removes the mapping for all selected nodes and their children recursively.

The Mapping Tool

The hierarchy and architecture sections are tree or graph windows themselves, so you can use the full range of tools to navigate or even edit both views. However, the most important tool is the mappingtoolltr1 Mapping Tool, which is available only in the Mapping window and allows you to inspect and change the mapping from nodes in the hierarchy view to nodes in the architecture view.

The mappingtoolltr1 Mapping Tool functions like the Select Tool in that it allows you to select, expand, and collapse nodes (and even move or resize them in a graph window). What makes it different is that it allows you to drag a node or a selection of nodes from the left section of the mapping window (the hierarchy) onto a node in the right section (the architecture) to map the dragged node(s) to the target.

Dragging an unselected node maps only that node to the target. Dragging a selected node maps the entire selection, i. e., all other selected nodes are mapped as well. While dragging a selection of multiple nodes, the cursor changes to mapping_multi_drag_cursor_ltr to indicate this, as opposed to mapping_drag_cursor_ltr when dragging a single node. The curved arrow in the cursor turns green when it points at a valid target node in the architecture section ( mapping_drag_cursor_green_ltr when dragging a single node or mapping_multi_drag_cursor_green_ltr when dragging a selection), and the target node is highlighted.

Reviewing the mapping

The “Mapped to” column in the hierarchy section displays the mapping target of each node. A node has an explicit mapping target (shown in black) if the node itself is mapped. Children of mapped nodes that are not themselves explicitly mapped are implicitly mapped to the same target as their parents. Implicit mappings are shown in gray.

Clicking a node in the hierarchy section that already has a mapping highlights the target node in the architecture view with a flashing purple frame (graph) or a flashing yellow background (tree). If the target node is not visible because it is inside a collapsed parent or ancestor node, the closest visible ancestor node is highlighted instead, though less prominently, to indicate that the mapped node is inside it. In a graph, flashing purple corners appear around the target node, and in a tree, the target node is shown with a flashing pale yellow background.

Similarly, clicking a node in the architecture section highlights all nodes in the hierarchy section that are mapped to this node in yellow (or pale yellow, if the mapped node itself is not visible).

5.9.6.3. Fixing Mapping Problems

When opening the mapping dialog or running architecture analysis, Gravis checks the validity of the mapping view before proceeding. If there are any problems, Gravis displays an alert showing the number of problems that were found:

The Mapping Problems alert.

The Mapping Problems alert.

Clicking Fix problems resolves the issues by deleting the offending elements. This is not always the most appropriate solution; it is recommended to investigate the problems first via Mark offending elements. This marks all the nodes and edges in the mapping view that cause problems and opens the mapping view as a flat diagram to show them. A more detailed summary can be obtained by clicking Details... to open the Mapping Problems Details dialog:

The Mapping Problems Details dialog.

The Mapping Problems Details dialog.

This dialog shows all the details of the mapping problems and allows them to be investigated or fixed individually by selecting the desired resolution in the Action column on the right. The default action is to ignore the problem. Note that you cannot proceed with your original task (opening the mapping dialog or running architecture analysis) while there are still unresolved major problems. The entries Fix and Mark correspond to the buttons in the previous dialog, and the same caveats apply to choosing Fix.

After specifying the actions, click Apply and cancel to apply the actions and review the results, or Apply and continue to apply the actions and proceed with the original task (opening the mapping dialog or running architecture analysis).

5.9.6.4. Performing Architecture Analysis

Note

With an architecture project, run checks from the Architecture Project Tree instead (see Running architecture checks). The project stores the options of each check, so the Analysis dialog described in this section is not needed.

To open the Analysis dialog, choose Edit → ic_analysis Run analysis... from the main menu and select Architecture checking/Perform check in the tree display of available analyses.

The architecture analysis offers the following parameters:

  • The views used as Architecture view, Mapping view, Hierarchy view, and Base view. By default, views with the ic_view_architectureArchitecture,

    ic_view_mappingMapping, ic_view_hierarchyHierarchy, and

    ic_view_baseBase roles assigned in the graph View Box are used.

    If the hierarchy and the relationships to be checked are both present in a single view, both Hierarchy view and Base view must be set to that view.

  • The Type hierarchy parameter defines the root of the edge type hierarchy to be checked. The selected type and all its subtypes are evaluated. The edge types used to model the dependencies in the architecture view must be compatible with those representing the relationships in the base view.

    Note

    For UML users: This is why UML edges from an imported UML architecture model must be interpreted and transformed into source dependency edges.

  • The Declaration forwarding option enables special logic for resolving declaration mapping targets. If enabled, the root of the edge type hierarchy for which this is active can be set up. This mechanism is explained in the section “Handling C/C++-Declarations” in the Architecture Guide Architecture.

  • Allow dependencies to parents: If enabled, all relationships between elements mapped to a child component in the architecture and elements mapped to its parent or ancestor are permitted, without the need to add an explicit dependency edge between the child and parent in the architecture.

  • Result view: The name of the result view that captures the results of the analysis.

  • The remaining checkboxes determine how the result view is structured and opened:

    • Add violating edges: Adds the edges from the Base view that caused violations (edge-absence Absence and edge-divergence Divergence edges) to the result view. This allows edge-absence Absence and edge-divergence Divergence edges to be double-clicked in the result view to display the list of Base view edges that caused them.

    • Add conforming edges: Adds the edges from the Base view that caused conformances (edge-convergence Convergence) to the result view. This allows edge-convergence Convergence edges to be double-clicked in the result view to display the list of Base view edges that caused them. Note that this increases processing time and memory requirements because a large amount of extra information must be stored. Since the number of edges that conform to the architecture is typically much higher than the number of edges that violate it, it is recommended to leave this option disabled unless the ability to check conformances is required.

    • Add all nodes from hierarchy: If enabled, all nodes from the Hierarchy view that are mapped to an architecture component are added as children of that component; otherwise, only the nodes from the Hierarchy view that are endpoints of architecture check result edges (and their ancestors) are added to the result view. Disabling this option minimizes the number of source-related graph elements in the result view by excluding elements that do not contribute to any architecture check result edges.

    • Lift architecture check result edges: If enabled, the edge-absence Absence, edge-divergence Divergence, and edge-convergence Convergence edges are lifted in the result view; i. e., additional summary edges are created between all enclosing ancestor nodes, up to the top level. This option should typically be enabled, as it makes it much easier to find result edges buried deep in the hierarchical structure of the architecture.

    • Lift violating/conforming edges: If enabled, the edges from the Base view that caused architecture check result edges are also lifted in the result view.

    • Open result list: If checked, a window displaying the architecture check result edges as a table is opened (similar to how the dashboard displays the list of issues found in the analyzed system).

    • Open graphical result view: If checked, a hierarchical graph window displaying the architecture check results is opened.

The Run analysis button executes the analysis. A result view is created and the requested result windows are opened once the analysis is complete.

If not opened automatically, the result list can be opened manually using the menu entries ic_view_open_violations Open → Violations..., ic_view_open_conformances Open → Conformances..., or ic_view_open_result_edges Open → Result edges... from the context menu over the result view in the graph View Box, depending on which types of result edges were computed by the analysis (violations only, conformances only, or both).

If not opened automatically, the architecture check result view can be opened manually by double-clicking its entry in the graph View Box.

Depending on the license, the Dependencies group of the Analysis dialog offers two additional analyses:

  • Find cycles detects cycles in the Base view and stores them in a new view with the name specified in Result view. If Include self-loops is selected, nodes with self-loops are also treated as cycles.

  • Dead code identifies code in the Base view that cannot be reached from an entry point. Entry points are all nodes in the Entries view. Dead code is added to a new view with the name specified in Dead view, and alive code to a new view with the name specified in Alive view.

5.9.6.5. Interpreting the Result of Architecture Analysis

The results of Architecture Analysis can be viewed in two ways:

  • As a Violations/Conformances/Result Edges List, which displays architecture check result edges (edge-absence Absence, edge-divergence Divergence and/or edge-convergence Convergence) alongside their causing edges in a table. Each architecture check result edge is caused by one or more source-related edges. If multiple causing edges exist for a given result edge, that result edge appears multiple times in the table.

  • As a graphical representation of the generated Architecture Check view, which shows the Architecture view enhanced with architecture check result edges and a browsable mapping in a graph window (see Section Graphical Windows).

The Violations List

The Violations/Conformances/Result Edges List window displays the following columns (described here for violations; other types are analogous):

Column

Contents

Violation kind

Indicates whether the result edge is an edge-absence Absence, a edge-divergence Divergence, or a edge-convergence Convergence.

Violation source / Violation target

The source and target node of the violation in the ic_view_architectureArchitecture view.

Causing edge count

The number of edges at the source level that lead to the same violation.

Parent of source

The node containing the source node of the violation.

This node is in the ic_view_architectureArchitecture view if the violation is an edge-absence Absence; otherwise, it is in the ic_view_baseBase view.

Causing source

Source node of the violation.

Causing edge

Type of the edge from the Base view that causes the violation.

Parent of target

Node containing the target node of the violation.

Causing target

The target node of the violation. If the edge is a summary, the target node contains the actual targets of the edges at a deeper level.

The Violations List

The Violations List

The first two entries in the Violations List shown above are divergences caused by a single causing edge: the first by a edge-variable-set Variable_Set edge and the second by a edge-static-call Static_Call edge. The subsequent causing edges – starting with the edge-member-set Member_Set edge, followed by a edge-member-use Member_Use edge followed by many edge-enumerator-use Enumerator_Use edges – all contribute to a single edge-divergence Divergence from node-cluster IL to node-cluster Target_Program. This divergence is caused by a total of 58 causing edges, as indicated in the Causing edge count column.

Although the Violations List displays nodes, it is fundamentally a list of edges; each row represents a causing edge. Consequently, when clicking any list entry using the selecttool1 Select Tool or marktool1 Mark Tool, the causing edge is always selected or marked, regardless of the column clicked. Similarly, the selection or marking status is displayed only for the causing edge, and only in the five rightmost columns, which correspond to the causing edge.

Caution

The Violations List is associated with the Architecture Check result view, not the base view. Therefore, selecting a causing edge in the Violations List will not cause it to be shown selected in a graph window showing the base view. You can use marking rather than selection to locate causing edges or their endpoints in a graph window showing the base view. The context menu provides several useful ways to mark causing edges and their endpoints.

Long lists can be reduced in two ways. The Edge Types window applies to the list as it does to any graph window: a row is shown only if both its violation kind and the type of its causing edge are selected. In addition, every column can be filtered individually. Click the filter icon in the column header to set the column’s filter. The header icon indicates whether a filter is active for that column; filters across multiple columns are combined.

For all columns except Causing edge count, the filter is a text pattern. Enter the pattern and press Return. A row is shown only if the text in that column contains the pattern; the comparison ignores case, * matches any sequence of characters, and ? matches any single character. An empty pattern removes the filter.

The Causing edge count column is instead filtered by a range. In the min field, enter the smallest count to show, and in the max field, the largest. Increasing the minimum beyond the maximum automatically increases the maximum. Select Unlimited if you do not want to set an upper limit. The dialog defaults to a minimum of 0 and Unlimited selected, which applies no filter; use Reset to return to that state. Absence entries have no causing edge count, and an empty count is treated as 0.

The two columns displaying edge types – Violation kind and Causing edge – are subject to both types of filtering. Use the Edge Types window to select whole subtrees of the type hierarchy, and a column filter to match the type name as displayed.

The Violations List context menu

The context menu for a Violations List entry consists of two parts: an optional top section, included only if a node column is clicked, and a common section that is always present as it refers to the causing edge represented by the entry. It provides operations to mark the elements involved in that particular violation.

The common part of the Violations List context menu

The common part of the Violations List context menu

ic_mark_architecture Mark architecture elements marks the violation edge and its endpoints in the architecture.

ic_mark_cause Mark causing elements marks the causing edge and its endpoints in the base view.

ic_mark_both Mark architecture and causing elements marks both simultaneously.

ic_element_info Causing edge information... opens the Edge Information windows for the causing edge.

ic_show_source_code Causing edge source code... opens Source Code windows for the causing edge.

ic_accept Accept violation... opens a dialog to help adapt the architecture to fix the clicked violation. See Accepting violations for details on this dialog.

When clicking a node column, the top part of the context menu allows you to open the Node Information and Source Code windows for that node, or to mark the node.

The node-specific top part of the context menu

The node-specific top part of the context menu

Hint

Hovering over an architecture node entry in the Violation Source or Target column displays the node’s full hierarchical path in a tooltip.

The graphical Architecture Check result view

The result view consists of the architecture view enhanced with architecture check result edges and a browsable mapping; that is, each architecture component contains the mapped source code elements as children.

The Architecture Result view

The Architecture Check result view

This arrangement allows navigating from a edge-divergence Divergence summary edge down to its causing edge(s) by drilling down the hierarchy – repeatedly expanding the nodes at both ends of the edge until the source code edges causing the divergence are revealed. This is only possible if both the result edges and the causing edges are lifted in the result view (see the architecture analysis options Lift architecture check result edges and Lift violating/conforming edges in section Performing Architecture Analysis).

The Architecture Result view after drilling down to the causing edge

The Architecture Check result view after drilling down to one of the causing edges

In the figure above, the causing edge of the Divergence from MessageQueue to Driver has been revealed to be a Static_Call edge from message_queue_process to driver_sensor_read. The edge from Main to driver_init is still a summary edge. Further expansion of Main is required to reveal its causing edge.

Double-clicking on architecture check result edges

If the Add violating edges option is enabled, double-clicking a edge-divergence Divergence edge opens a Violation List window displaying all source code edges that caused the violation. If the edge-divergence Divergence is a summary edge, the list contains the causing edges of all actual violations represented by the summary edge. Similarly, if the Add conforming edges option is enabled, double-clicking a edge-convergence Convergence edge opens a Conformances List window displaying all source code edges that caused the conformance. If the edge-convergence Convergence is a summary edge, the list contains the causing edges of all actual conformances represented by the summary edge.

The Result view context menu

The ic_accept Accept violation... entry in the context menu opens a dialog that helps adapt the architecture to fix the clicked violation. This entry is available only if the context menu is opened over a edge-divergence Divergence or edge-absence Absence edge.

Note

This entry is not available when opening the context menu over a summary edge. To use it, you must drill down until the actual violation edges are revealed.

Accepting Violations

A violation in the architecture analysis results can mean one of two things:

  • The architecture model is correct, but there is an unwanted or missing dependency in the source code (unwanted in the case of a divergence or missing in the case of an absence). To fix this, you must adapt the source code and then re-run the architecture analysis.

  • The source code is correct, but there is a missing or superfluous dependency in the architecture model (missing in the case of a divergence or superfluous in the case of an absence).

If the latter is true, the dialog opened via the ic_accept Accept violation... menu entry provides an easy way to adapt the architecture model to fix the violation.

Caution

Using this feature updates the architecture view in the currently loaded RFG. While this change can be saved by saving the RFG, in a typical CI workflow the RFG is only a transient end product of the analysis. During each analysis run, the RFG is created from scratch and the architecture is typically imported from a GXL file. To use the updated architecture in the next CI analysis run, the updated architecture view must be exported as a GXL file to replace the CI architecture input file.

This applies only if you do not use an architecture project. With an architecture project, the modified architecture view is marked in the Architecture Project Tree and saved to the project directory using its save button or Save all.

Accepting a Divergence

A divergence can be fixed by adding a suitable dependency to the architecture model. In theory, adding an edge of the closest common supertype of all edges contributing to the divergence would suffice. However, if the architecture model uses a more general type throughout – for example, edge-source-dependency Source_Dependency – it is usually better to use that type for consistency.

The dialog to accept a divergence

The dialog to accept a divergence

The dropdown menu of the Type combo box lists all possible edge types that would fix the divergence. The default is the most general type, typically edge-source-dependency Source_Dependency. Clicking Update architecture adds an edge of the selected type to the architecture view.

Accepting an Absence

An absence can be fixed by either removing the unmatched dependency from the architecture or keeping it and making it optional. The latter fixes the absence violation while still allowing future software revisions to use the dependency.

The dialog to accept an absence

The dialog to accept an absence

The dialog offers both possible fixes. Clicking Update architecture performs the selected action.