Up User guide

3.3 The Code Checker for MATLAB user interface

The graphical user interface of Code Checker for MATLAB on startup is shown in Figure 3.4↓. It can be opened by entering monkeyproof.cc4m.start() in your command window or using the shortcut. The GUI consists of a number of tabs, each with multiple controls. This section describes all of them.
figure images/newGuiAtStartup.png
Figure 3.3 General tab of the Code Checker for MATLAB GUI on startup

3.3.1 General

The General tab lets you select what files to check. The first step is to select whether you would like to check a file, folder, or MATLAB project. After making a selection, the relevant controls are shown. The controls for each of the options are shown in Figure 3.4↓.
figure images/GeneralTabFile.png figure images/GeneralTabFolder.png figure images/GeneralTabProject.png
Figure 3.4 General tab of the GUI after choosing to check a file, folder or MATLAB project


After clicking File, several controls are shown.


If you would like to check the code of files in a folder, select the Folder at the top.


MATLAB projects provide a convenient way to set the bounds of your code and to define startup and shutdown tasks (among others). By selecting the Project option in Code Checker for MATLAB, you can easily check the files of a project.
After choosing the right options and starting the run, the selected project will be loaded if it is not loaded yet. You will be prompted to agree to this. Please note that because only one MATLAB project can be open at a time, loading a project closes any other open project.
MATLAB projects were introduced in MATLAB R2019a. If you are using a release older than that, the Project option will be disabled.

Starting the run

Once all settings are valid, the figure images/playIcon.png button will be enabled. This button is available on every tab in the GUI. After clicking it, the settings are applied and Code Checker for MATLAB will run the checks on the files you selected using the rule configurations file of your choice. This action hides the GUI. Before running the checks on the files or folders you have selected, the code to check will be temporarily added to the MATLAB path so that the relevant information for properly performing the code analyses is available. During the analysis, property values may be initialized when gathering class information, if the checked code has class definitions among them. This may cause unexpected behaviour if the calculation of the initial values of properties deals with peripherals such as printing to the command window or reading from or writing to files. Potential errors during the initialization of properties are caught and will not interfere with the code analysis.
After analyzing the report and applying changes accordingly, you might want to run Code Checker for MATLAB again to make sure the code satisfies the coding standards. Opening the GUI again using the shortcut or monkeyproof.cc4m.start()within the same MATLAB session restores the selected GUI settings so that the same file(s) can easily be checked again. Alternatively, use the rerun all button in the report that was generated as described in Section 3.10↓.

3.3.2 Configuration

The Configuration tab shown in Figure 3.5↓ is used to select the rule configuration file that is used for checking your code. A rules configuration file is an xml file that can be used to map your own MATLAB coding standards and rules onto the checks and reports of Code Checker for MATLAB. When running the Code Checker for MATLAB for the first time after installation (see Chapter 2↑), the default configuration is created in the default folder that contains the configurations. For Windows this is:
For Mac:
    ~/Library/Application Support/cc4m/cc4m_configurations
for Linux:
After installing the CodeChecker, the predefined configuration MonkeyProofSolutions becomes active. For more information on configuring checks, see Section 3.4↓.
figure images/guiConfiguration.png
Figure 3.5 Configuration tab of the Code Checker for MATLAB GUI
When the top switch is set to Custom, it means that a custom configuration file is selected for use during the checks. When the switch is set to Predefined, a configuration shipped with Code Checker for MATLAB will be used to run the checks. Choosing this option hides the configurations folder selection and Import rules configuration file(s) controls as they are irrelevant for predefined configurations. The window you see will look like the one shown in Figure 3.6↓. For more information on predefined configurations, see Chapter 5↓.
figure images/guiConfigurationPredefined.png
Figure 3.6 Configuration tab of the Code Checker for MATLAB GUI after switching to a predefined configuration

3.3.3 Report

The Report tab as shown in Figure 3.7↓ lets you change the folder in which the HTML reports generated by Code Checker for MATLAB will be stored. If the entered folder does not exist, the folder and at most one parent will be created for you. In addition, there are some options that let you choose what to show in the report that is generated after the run:
figure images/ReportTab.png
Figure 3.7 Report tab of the Code Checker for MATLAB GUI

3.3.4 Preferences

On the Preferences tab, you can turn certain options on or off. The preferences available are listed below. These preferences can also be obtained and changed via the command line interface.
The current value of a preference can be obtained , for example, by the command below where defaultValue is returned if the preference has not been set yet.
monkeyproof.cc4m.getPreference(’FileSizeThresholdKb’, defaultValue)
figure images/PreferencesTab.png
Figure 3.8 Preferences tab of the Code Checker for MATLAB GUI

3.3.5 About

The About tab as shown in Figure 3.9↓ contains information about Code Checker for MATLAB:
figure images/AboutTab.png
Figure 3.9 About tab of the Code Checker for MATLAB GUI
Up User guide