主要内容

runChecks

R2026b

运行所有工程检查

描述

checkResults = runChecks(proj) 对指定工程运行检查。这些检查会检测工程完整性方面的问题,例如缺失文件、未保存的文件、未进行源代码管理或过期的派生文件。

示例

示例

全部折叠

打开 Times Table App 工程。使用 currentProject 从当前加载的工程创建一个工程对象。

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

运行所有工程检查

checkResults = runChecks(proj)
 checkResults = 

  12×1 ProjectCheckResult array with properties:

    ID
    Description
    Passed
    ProblemFiles

基于 checkResults 数组创建一个表。

summary = table(checkResults)
 summary =

  12×3 table

    Passed                                  Description                                                               ID                             
    ______    _______________________________________________________________________    ____________________________________________________________

    true      "All files under source control are in the project"                        "Project:Checks:AllFilesUnderSourceControlAreInProject"     
    true      "All project files are under source control"                               "Project:Checks:AllProjectFilesUnderSourceControl"          
    true      "No models in the project have mismatching file formats"                   "Project:Checks:MDLToSLX"                                   
    true     "All project definition files are under source control"                    "Project:Checks:ProjectDefinitionFilesAreUnderSourceControl"
    true      "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 slprj or sfprj folders in the project"                                 "Project:Checks:SLPRJ"                                      
    true      "Project has no duplicates or missing built-in labels"                     "Project:Checks:MissingOrDuplicateLabelsInProject"          
    true      "No out of date P-code files"                                              "Project:Checks:OutdatedPcodedFiles"                        
    true      "No case mismatch detected in project files, paths, and references"        "Project:Checks:PathCaseSensitive"                          
    true      "No project files have unsaved changes"                                    "Project:Checks:UnsavedProjectFiles"                        
                                       
 

注意

运行与源代码管理相关的检查需要对仓库进行完整克隆。在 CI/CD 管道中,一些仓库托管平台(如 GitLab®)默认对每个作业采用深度为 50 的浅克隆。将克隆和提取深度设置为 0 以创建完整克隆。

使用 ID、Passed 和 ProblemFiles 属性获取有关单项检查的信息。

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

输入参数

全部折叠

工程,指定为 matlab.project.Project 对象。使用 currentProject 从当前加载的工程创建一个工程对象。

输出参量

全部折叠

工程检查,以带属性的 ProjectCheckResult 对象数组形式返回。

版本历史记录

在 R2020a 中推出

全部展开