Main Content

runChecks

すべてのプロジェクト チェックを実行します

R2020a 以降

説明

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 から table を作成します。この table は、派生ファイルのチェックが実行されなかったことを示しています。

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 に設定してフル クローンを作成してください。

IDPassed、および 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 で導入