Script Catalog#
The number of scripts has grown over the last few years. As a result, starting from Version 11.0, we have reduced the number of scripts that are included in the install binaries.
The scripts that are used most frequently continue to be included in the install binaries. Upon installation you can find them in the scripts directory within the install directory. The other scripts can be downloaded from the CodeClinic Software Delivery Portal.
To run a script that is not already in the scripts directory, just copy your script file into the scripts directory. You can also use View –> Preferences –> Scripting, to configure script directories where user created scripts can be inserted.
All of the scripts can be run either through LDM or through LDCScript.
List of Currently Available Scripts#
Android JNI#
Purpose: Generate dependencies from Java to C/C++ using naming conventions that are typically employed in Android. Note that the normal JNI mapping is done automatically when a multi-module project is created with Java and C/C++ modules.
This script is is included in Lattix versions 7.3+.
Modules: Java, C/C++ (Understand).
Created on Lattix Version: Lattix 7.2
Creation Date: January 31, 2012
Collapse Partition#
Purpose: Collapse selected partitions by moving all the atoms in each of the partition trees into the selected partitions. This can be done to selectively prune the partition tree and thereby reduce the memory footprint of a project.
Modules: All
Created on Version: Lattix 6.7
Creation Date: July 19, 2011
Combine Partitions for Source and Header Files#
Purpose: Create a single partition for source and header files, if they have the same name. For instance if there are partitions for files A.c and A.h, they will moved inside a new partition A. This new partition will be created in the parent partition of A.c.
Created on Lattix Version: Lattix 5.6
Modules: C/C++.
Extensions: It can be extended to ADA adb and ads files easily.
Combine Partitions for Source and Header Files Per Folder#
Purpose: Create a single partition for source and header files, if they have the same name. For instance if there are partitions for files A.c and A.h, they will moved inside a new partition A. This new partition will be created in the parent partition of A.c. This version of the script will only combine the header and source if they are in the same folder.
Created on Lattix Version: Lattix 11.5
Modules: C/C++.
Extensions: It can be extended to ADA adb and ads files easily.
Create Work Item From Violation#
Purpose: Creates a menu item on a subsystem, cell or a violation that allows you to add those violations as a WorkItem in the WorkList. Once that is done, another script (such as Jira Integration) can be used to send WorkItems to an issue tracking system.
Modules: All
Created on Version: Lattix 8.2.8
Creation Date: March 14, 2013
Installation: This script is part of Lattix 8.3. If you have an earlier version of Lattix, please contact us to obtain the script. Add the script to the Lattix/scripts directory in order to use it.
Data Coupling Report#
Purpose: Generate a report that shows cross-module dependencies to global variables.
Modules: C/C++ (Understand). C/C++ (Clang)
Created on Lattix Version: Lattix 11.6
Creation Date: March 26, 2019
The user must first tag all subsystems that are considered “modules”.
The report will prompt the user for the name of the tag that defines the modules in the system. The script will then find all the dependencies to global variables that cross module boundaries.
Delete Partitions with Atoms#
Purpose: Deletes all the subsystems within a subsystem that have an atom associated with them. On a Java project, this leaves you with the Package hierarchy; on a .NET project this leaves you with the name space hierarchy. You can then export the hierarchy to an excel spreadsheet.
Modules: Java and .NET.
Extensions: None suggested.
Created on Version: Lattix 6.5.7
Creation Date: June 17, 2011
Dump Dependencies for Selected Subsystem#
Purpose: This script will dump out all the dependencies within a selected subsystem. To dump out all dependencies select $root. The output format consists of two columns separated by a tab, allowing you to import into Excel or read it in a text editor.
This script currently does not ship with Lattix. You can download it from here: DumpDependencies.groovy
.
To install, download the file DumpDependencies.groovy and copy to the scripts directory in your Lattix installation.
Modules: All
Created on Version: Lattix 7.3
Creation Date: March 16, 2012
Dump Model Kinds#
Purpose: Dump all the Dependency Kinds and Atom Kinds in a Model.
Modules: All
Created on Lattix Version: Lattix 6.7.1
Creation Date: August 8, 2011
Export Project Atoms to Excel / LDI#
Purpose:
This script, implemented in ExportProjectAtoms.groovy, exports the atoms of a project or a selection of partitions to either an LDI file or an Excel file. This script is useful for extracting parts of a project. You can also combine parts of different projects in a single project by first exporting parts from different projects and then loading the resulting ldi/excel files into a single project.
Optionally, the script can also load the resulting output back into Lattix.
Created on Version: Lattix 8.2.6
Running the script
(Optionally) Select the partitions to export
Select Export Project Atoms to Excel / LDI
Lattix displays a dialog box that allows you to configure the export. The dialog box has these options:
Select format - The exporter supports exporting to Excel, Excel 2007 or LDI
Select delimiter - The exporter can be configured to export with dot (i.e. A.B) or forward slash (i.e. A/B) or dollar (i.e. A$B)
Output File - The name of the file the exporter generates
Use Selection - When checked, the export will export the selected partitions and their descendants, otherwise the exporter exports the entire model.
Create New Model from Extracted Content - When checked, the exporter will create and load a new project from the output.
Caveats / Limitations
There are some limitations that will be addressed in future revisions:
Export does not expand collapsed members. Only expanded members appear in the exported data
Export does not preserve partition order when using LDI export
The exporter preserves atom kinds from the original model. However, the type information is raw and does not display icons and localized atom kinds and dependency kinds from the original model.
Find Archive to Archive Dependencies#
Purpose: For a Java project, it allows you to see which jar file depends on other jar files. For a DotNet project, it allows you to see which dll/exe file depends on other dll/exe files. A text output is generated in the console.
Modules: Java and .NET.
Created on Version: Lattix 5.6
Extensions: The script can be extended to apply to any module where subsystem names can be selected based on a common naming pattern.
Alternatives: Expand the DSM so that the subsystems for the archive files are displayed. Now you can export the data to xls format. You can also export the data to xml and then process the resulting data.
Flatten Selected Partitions#
Purpose: Allows you to delete the entire hierarchy tree within the selected partitions so that you are left with only the the leaf partitions in the selected partitions. Another, command in this script allows you to delete the selected partitions also so that you are left with only the leaf partitions.
Modules: Any.
Extensions: None suggested.
Alternatives: You can achieve the same effect by progressively applying the command “Delete Partition Retain Children” on each non-leaf partition. The script automates the process.
Created on Version: Lattix 6.5.7
Creation Date: June 17, 2011
Generate Class View#
Purpose: Create a pure object oriented view of a C++ project. The output is an LDI file that can be loaded to generate a new project. The script also provides an option for the user to generate the LDI file and to load that file into a new project.
The elements of this new project are all classes and members of classes. The new project does not contain source files and header files while maintaining the current directory structure. In C++, often the definition of a class and its implementation are in two different classes. This script combines those elements together and coalesces their dependencies.
There are several benefits of this approach. It helps object oriented programmers understand their code from the perspective of classes. Cycles between classes can now be accurately identified and categorized in terms of high level and low level cycles. Object Oriented metrics can also be calculated meaningfully.
This script (like other scripts) can be run in batch mode also. Therefore, it is possible to automate the creation, updating and publishing of this project.
Created on Lattix Version: Lattix 9.0
Modules: C/C++
Creation Date: Sept 30, 2013
Generate Excel/LDI from Project#
Purpose:
Those users who are simultaneously using LDI and manually editing the project to generate a single LDI source that corresponds to the project.
Those users who are simultaneously using Excel input and manually editing the project to generate a single Excel source that corresponds to the project.
Note that if you have manually changed the hierarchy, you will see that the element names in LDI will reflect the hierarchy.
Created on Version: Lattix 6.0.6
Creation Date: March 17, 2010
Last Modification Date: Sept 3, 2010
Modules: LDI. Note that the script will work with any project but the intended use is for users of LDI/Excel.
Graph Elements listed in File with GraphViz#
Purpose: The elements listed in an input file are displayed in a network diagram that shows the dependencies between them. The Graphviz programs circo, dot, and fdp can be used to generate the network diagram image. The script then calls the registered browser on your desktop to display the image.
Configuration: Note that you must have Graphviz installed on your system and your path must include the binary directory of Graphviz.
Created on Version: Lattix 5.5
Modules: All.
Link: http://www.graphviz.org
Graph Selected Subsystem with Graphviz#
Purpose: The children of a selected subsystem are displayed in a network diagram that shows the dependencies between them. The Graphviz programs circo, dot, and fdp can be used to generate the network diagram image. The script then calls the registered browser on your desktop to display the image.
Configuration: Note that you must have Graphviz installed on your system and your path must include the binary directory of Graphviz.
Created on Version: Lattix 5.5
Modules: All.
Link: http://www.graphviz.org
Graph Selected Subsystem with Pajek#
Purpose: The children of a selected subsystem are displayed in a network diagram that shows the dependencies between them. This script generates a file that can then be displayed with Pajek.
Configuration: Note that you must have Pajek installed on your system.
Modules: All.
Created on Version: Lattix 5.5
Graph Subsystems with Hierarchy#
Purpose: Purpose: The selected subsystems are displayed in a network diagram, with bounded boxes to show hierarchy. The Graphviz programs circo, dot, and fdp can be used to generate the network diagram image.
Note that it works only on the selected partitions. To apply to the entire project, select $root and then invoke the script. Note, however, that doing so can take a long time because Graphviz can be slow to layout hundreds or thousands of elements.
Modules: All.
Configuration: Graphviz must be installed on your system and your path must include the binary directory of Graphviz.
Created on Version: Lattix 6.7
Creation Date: August 9, 2011
Link: http://www.graphviz.org
Import/Export Rules#
Purpose: Allows importing/exporting of architecture rules from a project.
Modules: All.
Created on Version: Lattix 8.3
Creation Date: May 24, 2013
This script has two actions:
Import Rules: Imports rules from a file or another project
Export Rules: Exports rules to a file
Examples using ldcscript:
Exporting rules from a Lattix project to a file
Importing rules from a rules file into a Lattix project
Infer Dependency to Methods in Concrete Class#
Purpose: Generate dependencies to concrete implementations of interfaces and abstract classes. Often, classes have dependencies to interfaces and abstract classes. Sometimes, it is useful to understand the actual concrete classes that these classes depend on. The script will generate the dependencies to the concrete classes that extend or implement abstract classes and interfaces.
Note that it works only on the selected partitions. To apply to the entire project, select $root and then invoke the script. Note, however, that doing so can generate a large number of dependencies.
You must have members enabled for this script to work.
Modules: Java, .NET, C/C++ (using Understand).
Created on Lattix Version: Lattix 6.7
Creation Date: August 9, 2011
Inferred Dependencies#
Purpose:
This script infers dependencies between elements in one domain based on the dependency of these elements on elements of another domain and the dependencies between elements of that other domain.
For example:
Person A works on Component 1, Person B works on Component 2, Component 1 uses Component 2. The inferred dependency is Person A has a dependency on Person B.
Created on Version: Lattix 6.4
Creation Date: March 15, 2011
Jira Issue#
Purpose: Allow user to create JIRA issues from Lattix Work Items. This script configures Jira configuration options in View Preference. It adds a menu item that allows a user to send a WorkList Item to Jira.
Modules: All
Created on Version: Lattix 8.2.7
Creation Date: March 14, 2013
Installation: This script is preliminary. Please be prepared to modify the script to work in your own environment. Contact Lattix to obtain the script. Add the script to the Lattix/scripts directory in order to use it.
Configure JIRA connection#
Go to the menu View->Preferences. You should see a section called JIRA config.
Enter the JIRA connection information there
Create JIRA issue#
Right click on a Work Item in the Work List pane and you should see a menu item called JIRA Issue. Choose this work item to create a Jira issue. If there is no existing JIRA issue associated with this Workitem it will let you to create a new Jira Issue.
List Dependency Paths#
Purpose: Show all dependency paths between two partitions. Since the number of paths can be exponentially large, the number is limited to maximum.
Created on Version: Lattix 5.6
Modules: All.
Load Partition Properties#
Purpose: Load a file that specifies the values of named partition properties, which can be used in the heatmap metrics.
Created on Version: Lattix 12.1.3
Modules: All.
The partition properties json file has 3 main sections:
clear_properties - remove the values for the given named properties for all partitions
set_properties - set the heatmap,error,warning values for the metrics
file_properties/partition_properties - map file/partition names to partition property values
Generally only one of file_properties or partition_properties is used:
Property name
Typical modules
Description
file_properties
Used for C/C++ projects
The data key is the name of the file. The import process attempts to match paths as closely as possible for relative path names
partition_properties
Used for Java projects
The data key is the name of the class (atom)
Note: The actual metrics specified by this file can be defined via scripts. This page describes the syntax for defining a new metric: Custom Metric using partition properties
Example with file_properties#
{
"clear_properties": ["violation.misra", "violation.autosar"],
"set_properties": {
"violation.autosar": {
"heatmap": true,
"warning": 12,
"error": 14
},
"violation.misra": {
"heatmap": true,
"warning": 10,
"error": 12
}
},
"file_properties": {
"library\\xgpl_src\\IsoAgLib\\comm\\Part5_NetworkManagement\\impl\\isoitem_c.h": {
"violation.autosar": {
"value": 12,
"description": "Sample Description"
},
"violation.misra": {
"value": 2,
"description": "Sample Description"
}
},
"library\\xgpl_src\\IsoAgLib\\comm\\Part5_NetworkManagement\\impl\\isomonitor_c.cpp": {
"violation.autosar": {
"value": 55,
"description": "Sample Description"
},
"violation.misra": {
"value": 22,
"description": "Sample Description"
}
}
}
}
Example with partition_properties#
{
"clear_properties": ["coverage.decision", "coverage.statement", "coverage.entryPoint"],
"set_properties": {
"coverage.decision": {
"heatmap": true
},
"coverage.statement": {
"heatmap": true
},
"coverage.entryPoint": {
"heatmap": true
}
},
"partition_properties": {
"org.apache.tools.ant.Main" : {
"coverage.decision": {
"value": .5,
"description": ""
},
"coverage.statement": {
"value": .8,
"description": ""
},
"coverage.entryPoint": {
"value": .7,
"description": ""
}
}
}
}
Open Project#
Purpose: Opens a Lattix Project that in the input file name. The purpose of the script is to illustrate how to open projects from within a script.
Modules: All.
Created on Version: Lattix 5.6
Organize Project#
Purpose: This script allows a user to input a specification for re-organizing the project. The input specification allows the user to move partitions specified by name to new parent partitions. The script takes the following inputs:
Input Parameters#
Input File |
The name of input file containing the re-organization specification |
File Format |
Two Column Format or Header and Line Format |
Tag instead of Organize |
Partitions are tagged with parent partition name (no re-organization is done) |
Generate Hierarchy |
If Parent-Partition name contains dots (.) multiple partitions are generated and organized in a hierarchy |
Save Project |
The project is saved at the completion of the script (useful for LDC) |
Input File Formats#
Modules: All.
Created on Version: Lattix 7.8.
Creation Date: October 24, 2012
Remove Selected Atom Kinds#
Purpose: Remove all atoms of specified kinds from a project. The subsystem tree is left intact. The purpose of the script is to allow computation of metrics that does not include certain metrics.
Modules: All, XMI
Created on Version: Lattix 6.7 (this script was first shipped with Lattix 7.1)
Creation Date: December 1, 2011
Resolve .NET to C/C++#
Purpose: Resolve Exported Methods from a native DLL to C/C++. This script creates a dependency from a method in a native DLL to a method in C/C++. Typically, the Lattix project would be composed of .NET and C/C++ modules. The .NET module can display dependencies from managed to unmanaged code. The script now gives the user a further capability to map in C/C++ implementation of the native methods.
Modules: .NET, C/C++ using Understand
Created on Version: Lattix 7.1
Creation Date:October 29, 2011 (improved further in November, 2011)
Save Project#
Purpose: Saves an open Lattix Project. The purpose of the script is to illustrate how to save projects from within a script.
Modules: All.
Created on Version: Lattix 6.7
Creation Date: August 9, 2011
Tag Elements listed in File#
The Organize Project script subsumes this capability. This script will be removed in a future release.
Purpose: This script tags elements in a DSM from an external list. Once those elements are tagged they may be used for impact analysis or a subsystem may be created for them.
The format of the input file is as follows:
Modules: All.
Created on Version: Lattix 5.5