d0x2f/CloverMerge

View on GitHub

Showing 10 of 10 total issues

Function toXml has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function toXml(
        \DomDocument $xml_document,
        string $name
    ) : array {
        $xml_file = $xml_document->createElement('file');
Severity: Minor
Found in src/File.php - About 2 hrs 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 toXml has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function toXml(
        \DomDocument $xml_document,
        string $name
    ) : array {
        $xml_file = $xml_document->createElement('file');
Severity: Minor
Found in src/File.php - About 1 hr to fix

    Method toXml has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function toXml() : array
        {
            // Sort files by name
            $this->files->ksort();
    
    
    Severity: Minor
    Found in src/Accumulator.php - About 1 hr to fix

      Method execute has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute() : bool
          {
              $accumulator = new Accumulator($this->merge_mode);
      
              // Parse
      Severity: Minor
      Found in src/Invocation.php - About 1 hr to fix

        Method __construct has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct(array $argv)
            {
                $cli = Cli::create()
                    ->opt('output:o', 'output file path', true)
                    ->opt('mode:m', 'merge mode: additive, exclusive or inclusive (default)', false)
        Severity: Minor
        Found in src/Invocation.php - About 1 hr to fix

          Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  int $statement_count = 0,
                  int $covered_statement_count = 0,
                  int $conditional_count = 0,
                  int $covered_conditional_count = 0,
                  int $method_count = 0,
          Severity: Major
          Found in src/Metrics.php - About 1 hr to fix

            Function parseChildXML has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function parseChildXML(File &$file, \SimpleXMLElement $child)
                {
                    $name = $child->getName();
                    $attributes = $child->attributes();
                    if ($name === 'class') {
            Severity: Minor
            Found in src/File.php - About 45 mins 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

            Function execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function execute() : bool
                {
                    $accumulator = new Accumulator($this->merge_mode);
            
                    // Parse
            Severity: Minor
            Found in src/Invocation.php - About 35 mins 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

            Function toXml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function toXml() : array
                {
                    // Sort files by name
                    $this->files->ksort();
            
            
            Severity: Minor
            Found in src/Accumulator.php - About 25 mins 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

            Function parseItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function parseItem(
                    \SimpleXMLElement $element,
                    ?string $package_name = null
                ) : void {
                    $name = $element->getName();
            Severity: Minor
            Found in src/Accumulator.php - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language