Wednesday, July 24, 2024
HomeMatlabMeasuring and Monitoring Code High quality » Developer Zone

Measuring and Monitoring Code High quality » Developer Zone


At the moment I’m going to take a look at the Code High quality Dashboard which centralises quite a lot of metrics to your challenge and permits you to reply questions resembling:

  • Does my code have any points recognized by the MATLAB Code Analyzer?
  • Does my challenge meet required protection thresholds?
  • Do I’ve failing checks and if that’s the case, what number of?
  • Are all my necessities linked to checks and have these checks been run?

To discover this extra, I’m going to make use of the instance challenge that comes with MATLAB Check which you’ll entry by working:

openExample(‘matlabtest/CompleteTheVerificationOfAMATLABAlgorithmExample’)

Together with your challenge open, open the Code High quality Dashboard by clicking the icon within the instruments gallery:

codeQuality_toolstrip.png

Open the Code High quality Dashboard from the instruments gallery.

The primary time the dashboard opens it can seem like this:

codeQuality_initialState.png

Preliminary state of Code High quality Dashboard.

There are 4 sections within the dashboard that deliver collectively metrics from the MATLAB Code Analyzer, code protection, checks, and necessities.

We’re at the moment lacking take a look at information as we haven’t run them but – the checks usually are not run mechanically as this might take a big period of time in a big challenge. You possibly can run the checks from the Check Supervisor or you should utilize the button within the dashboard – click on the three dots menu to the fitting of “Protection” or “Assessments” and choose “Run Assessments and Refresh Information”.

codeQuality_runTests.png

Run checks from the Code High quality Dashboard.

The dashboard now seems to be like this:

codeQuality_postRun.png

Code High quality Dashboard after checks have been run.

You need to use this info to evaluate the present state of your challenge. For instance:

  • We have now 1 suggestion recognized by the Code Analyzer that we should always evaluation.
  • Our assertion protection is 88%. This would possibly imply that our code meets our firm specified high quality threshold.
  • Nonetheless, our MC/DC is low so there are particular gaps in our testing regardless of the excessive assertion protection.
  • A few of our checks are failing so we’ll want to repair these.
  • 17.4% of our necessities usually are not linked to checks in our challenge. Both they should be linked to present checks or we might want to write new checks.

To view extra element on any of the sections within the Code High quality Dashboard, click on on a given part and a devoted report can be launched. For instance, clicking on the Code Analyzer part will launch this report:

codeQuality_codeAnalyzer_pre.png

Code Analyzer report launched from the Code High quality Dashboard.

I’ll click on the “Repair All” button to repair the difficulty. At this level a banner seems within the Code High quality Dashboard notifying us that information within the challenge have modified so the dashboard wants refreshing.

codeQuality_codeAnalyzer_post.png

Code Analyzer situation fastened and Code High quality Dashboard indicating {that a} refresh is required.

As soon as we click on the “Replace Artifacts” button within the banner, we then must click on a subsequent “Refresh All” button to refresh the metrics, and our dashboard is updated once more.

codeQuality_noIssues.png

No extra Code Analyzer points following the replace.

In abstract, the Code High quality Dashboard brings collectively key metrics about your challenge in a single place, permitting you to make knowledgeable choices. It serves because the centre level of a “discover and repair” workflow, permitting you to leap to extra detailed views once you want them, after which coming again to the dashboard to view how your modifications have affected the general challenge standing.

Within the subsequent publish I’ll take a look at equivalence testing.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments