Artifact Relaxation
In order to allow users to relax or exclude artifacts from the project Artifact Tree, you need to reserve one measure that uses a special attribute used for relaxation and specify to which artifact types it applies.
Defining relaxation measure
The following is a basic example of how to allow users to relax folders and files in your model:
<!-- myModel/Analysis/Bundle.xml -->
<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" />
<Measure measureId="RELAX" targetArtefactTypes="RELAXABLE" defaultValue="0" usedForRelaxation="true" />
Only one measure in your model may use the |
By adding these two lines in your model, you allow users whose role grant the View Drafts of Projects and Modify Artifacts privileges to use the relaxation mechanism. For more information about using artifact relaxation from the web UI, consult the Getting Started Guide.
Any type of artifacts can be relaxed, except source code artifacts below the file level (functions, classes, etc…) for which relaxation will not be considered.
Impact on computations
When an artifact is relaxed, its metrics are ignored when computing metrics for other artifacts.
For example, this makes sense when relaxing a folder full of third-party code, because you may not want the total number of software lines of code to include third-party code. In other situations, it does not make sense to exclude all metrics from relaxed artifacts.
Like if you are analysing components of a system and aggregating memory usage information up to the application level, then third-party components for which you relax source code issues should still be part of the total memory usage for the system.
In the latter case, you can use the continueOnRelaxed
attribute to indicate that some or all measures should be included in computations even if the artifact has been relaxed.
This is explained in the two examples below.
Keep in mind that relaxation status is not known to any Data Providers except Squore Analyzer. Therefore, when manipulating and computing data in custom Data Providers, some artifacts metrics might still be considered even though these artifacts have been relaxed. |
- Example 1
-
In the following code
continueOnRelaxed
is set to true for the metric used to mark artifacts as relaxed (usedForRelaxation
). As a result, all measures of the relaxed artifact are included in computations for other artifacts:<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" /> <Measure measureId="RELAX" targetArtefactTypes="RELAXABLE" usedForRelaxation="true" continueOnRelaxed="true" defaultValue="0" />
- Example 2
-
In the following code,
continueOnRelaxed
is set to true at computation-level. As a result, the measure MEMORY is included in computations even when the artifact is relaxed. No other measures are included in computations for relaxed artifacts, sincecontinueOnRelaxed
is omitted from the definition of RELAX:<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" /> <Measure measureId="RELAX" targetArtefactTypes="RELAXABLE" usedForRelaxation="true" defaultValue="0" /> <Measure measureId="MEMORY" defaultValue="0"> <Computation targetArtefactTypes="APPLICATION;FOLDER" result="SUM FILE.MEMORY FROM DESCENDANTS" continueOnRelaxed="true"/> </Measure>
If you need to find out if an artifact is relaxed in your model, you can use the |