General Information on the Code Analysis Component

Overview

Code Analysis is integrated into EcoStruxure Machine Expert to analyze applications.

Code Analysis focuses on the following key elements:

  • Understanding the structure of the source code. Software developers can visualize, for example, code dependencies and explore it step by step.

  • Identification of code deficiencies to harmonize and improve the source code by defined programming guidelines.

  • Measurement of source code quality and identifying the KPIs (Key Performance Indicators).

  • Reporting the KPIs to the software developers for personal purpose.

System Requirements

Besides the system requirements for EcoStruxure Machine Expert, Code Analysis has additional requirements regarding the hardware and the operating system.

The minimum requirements are:

  • 4-core processor for parallel query execution

  • 4 GB RAM

To analyze projects, the following specifications are suggested:

  • Windows 64 bit

  • ≥ 4-core processor for parallel query execution

  • ≥ 8 GB RAM

Installation

To use Code Analysis in EcoStruxure Machine Expert, the component has to be installed with the Schneider Electric Software Installer.

Code Analysis is under license protection:

Function

Without license

With license

Dependency View

Limited to two diagrams.

Not limited.

Metrics Table

Limited to two objects and three active queries.

Not limited.

Conventions Table

Limited to two objects and three active queries.

Not limited.

Query Editor

Not available.

Available.

Python CodeAnalysis API

Not available.

Available.

NOTE: For more information about product licensing, contact your local Schneider Electric representative.

Code Analysis Editors

With the three code analysis editors in EcoStruxure Machine Expert Logic Builder you can analyze and interpret the results of a code analysis:

  • Conventions Table editor

    Parts of the application that violate the defined coding conventions (based on coding rules).

  • Dependency View editor

    Dependencies between namespaces, libraries, objects (function blocks, POUs, and so on).

  • Metrics Table editor

    Results of code quality figures, like LOC (Lines of Code), complexity, and so on.

Multiple instances of code analysis objects can be added beneath Application, folders, or Code Analysis Manager.

Several code analysis objects can be added to an application.

If a Conventions Table or Metrics Table object is added beneath Application or Code Analysis Manager, the whole application is in the scope of the analysis.

If they are added beneath a folder, only this folder is in the scope of the analysis.

So it is possible to store analysis results for example, for each module/folder of an application in dedicated objects.

Adding a Conventions Table, Dependency View, or a Metrics Table to an application automatically adds a Code Analysis Manager to the Application object.

Block List

A BlockList object can be added beneath a Code Analysis Manager object. The BlockList object contains elements that will not appear in Conventions Table, Metrics Table, or Dashboard results. This, although, is taken into account when you upload a project snapshot into Machine Advisor Code Analysis.

Code Analysis Manager

The Code Analysis Manager provides a quick overview via a dashboard and you can configure analysis depth and the cloud connection.

The Code Analysis Manager provides the tabs:

  • Dashboard tab

    Overview of the analyzed application.

  • Configuration tab

    Analysis depth of code analysis configuration.

  • Cloud Connection tab

    Configuration of the connection to the Machine Advisor Code Analysis.

Code Analysis Query Manager

The Code Analysis Query Manager allows you to create and modify customized rule sets, and to manage your metrics and conventions queries. To open the Code Analysis Query Manager click Tools in the menu bar and select Code Analysis Query Manager from the contextual menu.

The Code Analysis Query Manager provides the tabs:

  • Rule Sets

    Rule sets can be created and modified.

  • Metric Queries tab

    Queries and query chains available in the Metrics Table editor can be created and modified.

  • Convention Queries tab

    Queries and query chains available in the Conventions Table editor can be created and modified.

  • Dependency (Filter) Queries tab

    Queries and query chains available in the Filters of the Dependency View editor can be created and modified.

  • Dependency (Select) Queries tab

    Queries and query chains available in the Select and Add dialog box of the Dependency View editor can be created and modified.

  • Cloud Connection tab

    The connection to Machine Advisor Code Analysis can be configured.