Main Content

Working with the Static Code Metrics Report

You can use the information in the Static Code Metrics Report to assess the generated code and make model changes before code implementation in your target IDE.

Before starting, familiarize yourself with potential code limitations of your IDE. For example, some IDEs have limits on the number of variables or lines of code in a function block.

For detailed instructions on generating the report, see Generate Static Code Metrics Report.

Workflow for Static Code Metrics Report

This workflow is the basic workflow for using the Static Code Metrics Report with your model.

Report Contents

The Static Code Metrics Report is divided into these sections:

  • File Information: Reports high-level information about generated files, such as lines and lines of code.

  • Global Variables: Reports information about global variables defined in the generated code.

  • Global Constants: Reports information about global constants defined in the generated code.

  • Function Block Information: Reports a table of metrics for each function block generated from your model.

Function Block Information

You can use the information in the Function Block Information table to assess the generated code before implementation in your IDE. The leftmost column of the table lists function blocks with hyperlinks. Clicking a function block name leads you to the function block location in the generated code. You can then trace from the code to the model. For more information, see Verify Generated Code by Using Code Tracing.