runChecks
运行所有工程检查
说明
对指定工程运行检查。这些检查会检测工程完整性方面的问题,例如缺失文件、未保存的文件、未进行源代码管理或过期的派生文件。checkResults = runChecks(proj)
如果要检查派生文件是否为最新,您必须更新工程依存关系。对于大型工程来说,这可能非常耗时。要避免检查派生文件,在调用 runChecks 之前不要更新依存关系。
示例
打开 Times Table App 工程。使用 currentProject 从当前加载的工程创建一个工程对象。
openExample("matlab/TimesTableProjectExample")
proj = currentProject;对于大型工程,运行除派生文件检查之外的所有工程检查,因为派生文件检查可能很耗时。
checkResults = runChecks(proj)
checkResults =
11×1 ProjectCheckResult array with properties:
ID
Description
Passed
ProblemFiles基于 checkResults 数组创建一个表。该表显示派生文件检查未运行。
summary = table(checkResults)
summary =
11×3 table
Passed Description ID
______ ____________________________________________________________________________________________________________________________________ ________________________________________________________
true "All project definition files are under source control." "Project:Checks:ProjectDefinitionFilesUnderSourceControl"
true "All files in the project are under source control." "Project:Checks:AllProjectFilesUnderSourceControl"
true "All files under source control are in the project." "Project:Checks:AllFilesUnderSourceControlInProject"
true "All project folders exist." "Project:Checks:ProjectFoldersExist"
true "All project files 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 "Check for project files with unsaved changes." "Project:Checks:UnsavedProjectFiles"
false "All derived files in the project are up-to-date." "Project:Checks:OutOfDateDerivedFiles"
true "There are no slprj or sfprj folders in the project." "Project:Checks:SLPRJ"
true "Model files saved in a different format (MDL or SLX) are added to the project.↵The original files are not currently in the project." "Project:Checks:MDLToSLX" 注意
运行与源代码管理相关的检查需要对存储库进行完整克隆。在 CI/CD 管道中,一些存储库托管平台(如 GitLab®)默认对每个作业采用深度为 50 的浅克隆。将克隆和提取深度设置为 0 以创建完整克隆。
打开 Times Table App 工程。使用 currentProject 从当前加载的工程创建一个工程对象。
openExample("matlab/TimesTableProjectExample")
proj = currentProject;如果要检查派生文件是否为最新,您必须首先更新工程依存关系。
updateDependencies(proj);
运行所有工程检查。
checkResults = runChecks(proj)
checkResults =
11×1 ProjectCheckResult array with properties:
ID
Description
Passed
ProblemFiles注意
运行与源代码管理相关的检查需要对存储库进行完整克隆。在 CI/CD 管道中,一些存储库托管平台(如 GitLab)默认对每个作业采用深度为 50 的浅克隆。将克隆和提取深度设置为 0 以创建完整克隆。
使用 ID、Passed 和 ProblemFiles 属性获取有关第一项检查的信息。第一项检查通过,没有发现任何问题。所有工程定义文件都在源代码管理之下。
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
对派生文件的检查通过,未检测到任何问题文件。所有派生文件均为最新的。
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
输入参数
工程,指定为 matlab.project.Project 对象。使用 currentProject 从当前加载的工程创建一个工程对象。
输出参量
工程检查,以带属性的 ProjectCheckResult 对象数组形式返回。
版本历史记录
在 R2020a 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)