Code Analysis with PHP Metrics

Code Analysis with PHP Metrics

Chris Gmyr

July 27, 2017

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

51 slides
  1. Cyclomatic Complexity The cyclomatic complexity of a section of source

    code is the number of linearly independent paths within it. 4 If the source code contained no control flow statements (conditionals or decision points), the complexity would be 1. 4 One IF statement = two paths through the code, complexity would be 2. 4 Two nested single-condition IFs, or one IF with two conditions, would produce a complexity of 3. https://en.wikipedia.org/wiki/Cyclomatic_complexity
  2. Halstead Complexity Measures Observation that metrics of the software should

    reflect the implementation or expression of algorithms in different languages, but be independent of their execution on a specific platform. https://en.wikipedia.org/wiki/ Halstead_complexity_measures http://www.verifysoft.com/en_halstead_metrics.html
  3. Maintainability Index Provides a score between 0 to 118. Halstead's

    metrics, LOC and Cyclomatic complexity number. General scores: 4 <64: low maintainability. The project has probably technical debt. 4 65-84: medium maintainability. The project has problems, but nothing really serious. 4 >85: high maintainability. The project is probably good.

More Decks by Chris Gmyr

Other Decks in Technology