runChecks - Run all project checks - MATLAB (original) (raw)

Main Content

Syntax

Description

[checkResults](#mw%5F7fe9dba5-7821-43b3-86ac-29a910fb2dbe) = runChecks([proj](#mw%5Fd22b41c0-64f9-4f35-8bf0-aaa2eafe3b47)) runs checks on the specified project. The checks detect problems with the project integrity such as missing files, unsaved files, files not under source control, or out-of-date derived files.

You must update the project dependencies if you want to check derived files are up to date. This can be time-consuming for larger projects. To exclude the derived files check do not update dependencies before callingrunChecks.

example

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object from the currently loaded project.

openExample("matlab/TimesTableProjectExample") proj = currentProject;

For large projects, run all the project checks except the derived files check, as it can be time-consuming.

checkResults = runChecks(proj)

checkResults =

11×1 ProjectCheckResult array with properties:

ID
Description
Passed
ProblemFiles

Create a table from the checkResults array. The table shows that the derived files check did not run.

summary = table(checkResults)

summary =

11×3 table

Passed                                  Description                                                               ID                             
______    _______________________________________________________________________    ____________________________________________________________

true      "All project definition files are under source control"                    "Project:Checks:ProjectDefinitionFilesAreUnderSourceControl"
true      "All project files are under source control"                               "Project:Checks:AllProjectFilesUnderSourceControl"          
false     "All files under source control are in the project"                        "Project:Checks:AllFilesUnderSourceControlAreInProject"     
false     "All project files and folders exist on the file system"                   "Project:Checks:ProjectFilesExist"                          
true      "All project folders on the MATLAB search path are on the project path"    "Project:Checks:ProjectPath"                                
true      "All projects in sub-folders are referenced by this project"               "Project:Checks:ReferencedSubprojects"                      
true      "No duplicates or missing default labels"                                  "Project:Checks:MissingOrDuplicateLabelsInProject"          
true      "No out of date P-code files"                                              "Project:Checks:OutdatedPcodedFiles"                        
true      "No project files with unsaved changes"                                    "Project:Checks:UnsavedProjectFiles"                        
true      "No models in the project have mismatching file formats"                   "Project:Checks:MDLToSLX"                                   
true      "No slprj or sfprj folders in the project"                                 "Project:Checks:SLPRJ"                                          

Note

Running source control related checks requires a full clone of the repository. In a CI/CD pipeline, some repository hosting platforms such as GitLab® default to a shallow clone with a depth of50 per job. Set the clone and fetch depth to0 to create a full clone instead.

Open the Times Table App project. Use currentProject to create a project object from the currently loaded project.

openExample("matlab/TimesTableProjectExample") proj = currentProject;

You must first update the project dependencies if you want to check derived files are up to date.

updateDependencies(proj);

Run all the project checks.

checkResults = runChecks(proj)

checkResults =

11×1 ProjectCheckResult array with properties:

ID
Description
Passed
ProblemFiles

Note

Running source control related checks requires a full clone of the repository. In a CI CD pipeline, some repository hosting platforms such as GitLab, default to a shallow clone with a depth of50 per job. Set the clone and fetch depth to0 to create a full clone instead.

Use the ID, Passed, andProblemFiles properties to get information about the first check. The first check passed and found no problems. All project definition files are under source control.

id = checkResults(1).ID status = checkResults(1).Passed problems = checkResults(1).ProblemFiles

id =

"Project:Checks:ProjectDefinitionFilesUnderSourceControl"

status =

logical

1

problems =

0×0 empty string array

The check for derived files passed and detected no problem files. All derived files are up to date.

id = checkResults(9).ID status = checkResults(9).Passed problems = checkResults(1).ProblemFiles

id =

"Project:Checks:OutOfDateDerivedFiles"

status =

logical

1

problems =

0×0 empty string array

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Output Arguments

collapse all

Project checks, returned as an array ofProjectCheckResult objects with properties.

Version History

Introduced in R2020a

expand all

Starting in R2025a, the runChecks function runs a check to detect duplicates and missing default labels.