wikimedia/mediawiki-core

View on GitHub
includes/media/PNGMetadataExtractor.php

Summary

Maintainability
F
5 days
Test Coverage

Function getMetadata has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getMetadata( $filename ) {
        self::$pngSig = pack( "C8", 137, 80, 78, 71, 13, 10, 26, 10 );
        self::$crcSize = 4;
        /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
         * and https://www.w3.org/TR/PNG/#11keywords
Severity: Minor
Found in includes/media/PNGMetadataExtractor.php - About 3 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method getMetadata has 268 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getMetadata( $filename ) {
        self::$pngSig = pack( "C8", 137, 80, 78, 71, 13, 10, 26, 10 );
        self::$crcSize = 4;
        /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
         * and https://www.w3.org/TR/PNG/#11keywords
Severity: Major
Found in includes/media/PNGMetadataExtractor.php - About 1 day to fix

    File PNGMetadataExtractor.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * PNG frame counter and metadata extractor.
     *
     * Slightly derived from GIFMetadataExtractor.php
    Severity: Minor
    Found in includes/media/PNGMetadataExtractor.php - About 3 hrs to fix

      There are no issues that match your filters.

      Category
      Status