Building your Model

Bundle Files

A model is a collection of several Bundle.xml files where your entire model is described. A model folder normally contains the following bundles:

  • MyModel/Analysis/Bundle.xml, where artefact types, metrics, indicators and rules are defined

  • MyModel/Dashboard/Bundle.xml, where the charts displayed in the web interface are defined

  • MyModel/Decision/Bundle.xml, where you define the action items for your model

  • MyModel/Description/Bundle.xml, where you translate all the elements of your model into several languages

  • MyModel/Exports/Bundle.xml, where you define the type of information that users can export from the web UI

  • MyModel/Highlights/Bundle.xml, where the different types of highlight categories are defined

  • MyModel/Properties/Bundle.xml, where optional properties about your model are defined

  • MyModel/Reports/Bundle.xml, where you define the type of reports that can be created from the web UI

  • MyModel/Wizards/Bundle.xml, where you define the parameters to be used when creatign a project with your model

More information about each type of bundle is available in this manual. Note that a Bundle.xml file normally includes external files located elsewhere in the standard Squore configuration. This allows reusing modules between models.

The following is an (incomplete) example of a Bundle.xml file that includes other files from the Squore configuration. Note that the xmlns:xi declaration in the Bundle element is mandatory if you want to include external files.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Bundle xmlns:xi="http://www.w3.org/2001/XInclude" >
    <!-- Aliases -->
    <ArtefactType id="CODE" heirs="PACKAGES;FILES;CLASSES;MODULES" />
    <ArtefactType id="PACKAGES" heirs="APPLICATION;SOURCE_CODE;FOLDER" />
    <ArtefactType id="FILES" heirs="FILE" />
	<ArtefactType id="CLASSES" heirs="CLASS" />

	<xi:include href="../../Shared/Analysis/SQuORE_BasicScales.xml" />	   
	
		<!-- SQuORE Base Measures -->
	<xi:include 
	  href="../../Shared/Analysis/product_quality/code/line_counting/line_counting.xml" />
	<xi:include 
	  href="../../Shared/Analysis/Code/ObjectOrientation/squore_java_oo_basemeasures.xml" />
	<xi:include 
	  href="../../Shared/Analysis/Code/ObjectOrientation/SQuORE_Inheritance.xml" />

		<!-- Rule Checking -->
	<xi:include 
	  href="../../Shared/Analysis/Code/RuleSet/SQuORE_Java_RuleSet.xml" />

		<!-- SQALE Analysis Model -->
	<xi:include 
	  href="../../Shared/Analysis/Code/SQALE/SQALE_Characteristics.xml" />
	<xi:include href="SQALE_Requirement.xml" />

	<RootIndicator indicatorId="SQALE_INDEX_DENSITY" artefactTypes="APPLICATION;FOLDER;SOURCE_CODE" />
	<RootIndicator indicatorId="SQALE_INDEX" artefactTypes="FUNCTION;CLASS;FILE" />
	<Measure measureId="COST" targetArtefactTypes="APPLICATION" defaultValue="0" />
</Bundle>

Tip

All paths in a Bundle.xml are relative to Bundle.xml.

Warning

The bundle file is an xml file, which means that you must respect the XML syntax, otherwise Squore will not be able to read it. This means for example that the following characters are forbidden, and must be replaced by their corresponding entity reference:

  • & needs to be replaced by &amp;

  • < needs to be replaced by &lt;

  • > is preferably replaced by &gt;, but this is not mandatory

  • " needs to be replaced by &quot; (only when used inside an attribute value)

  • ' needs to be replaced by &apos; (only when used inside an attribute value)

To learn more about entities, visit en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

Descriptions

In order to provide a simple way to display dashboards in multiple languages in the Squore web interface, all strings have been externalised to .properties files . A .properties file contains translations for all the metrics, rules, action items, charts and other objects described in your model. A model contains a Bundle.xml that lists all the .properties files that need to be loaded for this model.

In your description bundle, inlude a .properties file by adding a Properties element. Squore will select the appropriate display language for this model according to the language options defined in the available and default attributes, as shown below:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Bundle available="fr,en" default="en">
	<Properties src="../../Shared/data_provider/squan_sources/descriptions" />
</Bundle>

In the example above, it is assumed that two files exist with the names Shared/data_provider/squan_sources/descriptions_en.properties and Shared/data_provider/squan_sources/descriptions_fr.properties, since you declared both languages in the available attribute. Users are free to switch between the English and French languages using the flag icons in the Squore web interface. By default, Squore will display the descriptions from descriptions_en.properties, since you set the default language to "en" using the default attribute.

Properties files are simple text files containing key-value pairs to associate text to a property of an element of your model.

For example, the metric SLOC is translated using this line in a .properties file:

SLOC.DESCRIPTION=The number of source line of codes

If we need the desctiption of SLOC to be different for artefact of type CPP_FUNCTION and APPLICATION, we can use a more advanced definition:

M.SLOC.DESCRIPTION.APPLICATION=The number of source line of codes in the application
M.SLOC.DESCRIPTION.CPP_FUNCTION=The number of source line of codes in the function

The convention for this syntax is as follows:

[PREFIX.]IDENTIFIER.PROPERTY[.ARTEFACT_TYPE]=My localised text

where:

  • PREFIX is a prefix used to indicate which type of object the localised text applies to. If no prefix is specified, then the localised text is used for all objects in the model with this identifier. The supported values for PREFIX are:

    • M for measures

    • I for indicators

    • C for charts

    • EVO for trend icons

    • EX for exports

    • FA for families

    • FI for findings

    • G for groups

    • HI for highlights

    • LOP for scale levels (levels of performance)

    • MO for models

    • PERM for permissions

    • PRO for profiles

    • RO for roles

    • RE for reports

    • SC for scales

    • ST for action item statuses

    • T for artefact types

    • TA for tables

    • TA#IN for links tables displaying inbound links

    • TA#OUT for links tables displaying outbound links

    • TST for action item tests

    • TUTO for tutorial descriptions

    • WI for wizards

    • MIL for milestones

  • IDENTIFIER is the ID of the object as described in the model.

  • PROPERTY is the property being set. It is one of:

    • MNEMO to specify a mnemonic, i.e. a short representation of the object that is used where space needs to be preserved. Note that if no mnemonic is specified, the raw identifier will be used instead in the UI.

    • NAME to specify a name, i.e. the common, human-understandable representation of an object.

    • DESCR to specify a description for the object.

    • JUSTIF to specify a justification for a rule. This is displayed in the Findings pane and allows you to provide more details about why a rule is used.

    • URL to specify a URL associated with the object. This URL is displayed below the description of a rule on the Findings tab, or in any popup that shows the full description of a measure or indicator on the Dashboard. This URL is clickable and opens in a new browser window. This is usually useful if you want to link to the definition of a coding standard ourside of Squore.

    • ICON to specify an icon for a scale level (LOP), a trend icon in the artefact tree (EVO) or a group icon (G) in the project portfolios.

    • IMAGE to specify an image for a scale level (LOP) when displayed as a KPI on the dashbaord.

    • COLOR to specify the colour to represent a metric (M, I), a scale level (LOP) or a milestone (MIL) on a chart or a popup describing a scale. For more information about the supported colour formats, consult [colour syntax] .

    • NODATA to specify a text to be displayed in a chart (C) on the dashboard when no data can be displayed on the chart.

    • TREE_NAME to specify a name for a chart (C) that is used in the Dashboard Editor's tree of charts.

  • ARTEFACT_TYPE is used to restrict the scope of the property to the specified type of artefact. If no ARTEFACT_TYPE is specified, then the property applies for all artefact types.

Tip

Properties files are also used to customise tooltips appearing on the dashboard, as described in the section called “Using Tooltips”

Examples

  1. Usual set of properties for a measure or an indicator:

    STATUS.MNEMO=Status
    STATUS.NAME=Requirement Status
    STATUS.DESCR=Status (draft or final)
    
  2. Usual set of properties for a rule to display in the Findings tab:

    R_NOGOTO.MNEMO=NOGOTO
    R_NOGOTO.NAME=No GOTO
    R_NOGOTO.DESCR=A unconditional GOTO shall not be used to jump outside the paragraph.
    R_NOGOTO.JUSTIF=GOTO statements should be avoided because they complicated the task of analyzing and verifying the correctness of programs (particularly those involving loops).
    R_NOGOTO.URL=https://xkcd.com/292/
  3. Usual set of properties for a scale:

    SC.STATUS.NAME=Requirement Readiness Assessment
    LOP.UNKNOWN.MNEMO=Unknown
    LOP.UNKNOWN.NAME=Unknown
    LOP.UNKNOWN.DESCR=Unknown
    LOP.UNKNOWN.IMAGE=../Shared/Images/images/questionmark.png
    LOP.UNKNOWN.ICON=../Shared/Images/icons/questionmark.png
    LOP.UNKNOWN.COLOR=#C11B17
    
    LOP.DRAFT.MNEMO=Draft
    LOP.DRAFT.NAME=Draft
    LOP.DRAFT.DESCR=Draft
    LOP.DRAFT.IMAGE=../Shared/Images/icons/wip.png
    LOP.DRAFT.ICON=../Shared/Images/icons/wip.png
    LOP.DRAFT.COLOR=#FFDB58
    
    LOP.FINAL.MNEMO=Final
    LOP.FINAL.NAME=Final
    LOP.FINAL.DESCR=Final
    LOP.FINAL.IMAGE=../Shared/Images/icons/final.png
    LOP.FINAL.ICON=../Shared/Images/icons/final.png
    LOP.FINAL.COLOR=#41A317
    

    Tip

    The path to an image or icon file is relative to the root of the folder containing the model.

  4. Using a different description for a metric when using it on the Action Items tab with the TST prefix:

    OVERPERFORMANCE.MNEMO=Over-Performance
    OVERPERFORMANCE.NAME=Over-Performance
    OVERPERFORMANCE.DESCR=You are over-performing at this time.
    TST.OVERPERFORMANCE.DESCR=Your current progress of {2}% is exceeding your objective for the next milestone by over 20% ({0}% in {1} days). /Either you are pretty good, or you underestimated yourself when setting your goals. Consider revising your objectives.
    

    Tip

    In the example above, / is used to indicate a new line in the description.

    Note

    {0}, {1} and {2} are parameters that are dynamically filled in when viewing the action item. For more information, consult the section called “Trigger-Based Action Plans”.

  5. Overriding a name and description for a specific type of artefact:

    RAM.MNEMO=RAM
    RAM.NAME=Used RAM 
    RAM.NAME.APPLICATION=Sum of Used RAM 
    RAM.DESCR=Used RAM
    RAM.DESCR.APPLICATION=Sum of Used RAM
    

    Tip

    Squore resolves properties from the more specific to the more abstract, as shown below:

    1. PREFIX.IDENTIFIER.PROPERTY.ARTEFACT_TYPE
    2. PREFIX.IDENTIFIER.PROPERTY
    3. IDENTIFIER.PROPERTY.ARTEFACT_TYPE
    4. IDENTIFIER.PROPERTY

    Note that aliases are not supported, only real artefact types. If you want to specify a description for functions in all languages, you have to add a line for each of the function types: CPP_FUNCTION, C_FUNCTION, ADA_FUNCTION...

  6. Setting a chart's name and description

    C.PERFORMANCE_TREND.NAME=Performane Trend
    C.PERFORMANCE_TREND.DESCR=<h1>Reading the Performance Trend Chart</h1><p>This chart shows a history of the performance trend for our application, as recorded nightly by our performance tests.</p><p>If you see any variation, you should perform the following three checks</p><ol><li>Is it a false positive, See if an error was reported in Jenkins</li><li>Check the machine logs for an explanation</li><li>Has someone already reported a bug? If not, <b>please do!</b></li></ol>

    Tip

    You can use the following HTML tags in chart descriptions: h1, h2, h3, h4, h5, h6, p, span, div, br, i, b, u, a, pre, hr, ul, ol, li

  7. Setting help text for tutorials. Note that only .DESCR is supported:

    TUTO.WELCOME_TUTORIAL_RISK.DESCR=Understanding the Risk Index Model
    TUTO.WELCOME_TUTORIAL_RISK_DESCRIPTION.DESCR=This tutorial takes you around the dashboard of the Squore Risk Index model to explain the concepts behind the ranking and help you understand how to improve your project based on the specific action plan generated by this model.
    TUTO.EXPLAIN_TRENDS.DESCR=<b>Warning!</b><br/>Pay attention to this trend icon: <img src="dashboard_tour/tree_up.png" />
    

    Tip

    HTML is supported in help text, but not in the main description of the tutorial that appears in the tutorial selection popup. You can insert images in the help text, using the relative path to the image file from Bundle.xml.

Overriding Default Descriptions

Here are the locations of the default types, permissions, roles and profiles, and statuses:

  • Types: <SQUORE_HOME>/configuration/models/Shared/Analysis/Code/Types/rights_en.properties

  • Permissions: <SQUORE_HOME>/configuration/models/Shared/Description/rights_en.properties

  • Roles and profiles: <SQUORE_HOME>/configuration/models/Shared/Description/roles_en.properties

  • Statuses: <SQUORE_HOME>/configuration/models/Shared/Description/status_en.properties

You are free to override or extend these defaults in your own .properties file in your model.

Tip

In order to set an icon for a type, create an image called identifier.png (the identifier must be lowercase) in your configuration under models/Shared/Images/icons/types.