CapsLock-Studio/FilterClass

View on GitHub

Showing 6 of 6 total issues

Function leaveNode has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function leaveNode(Node $node)
    {
        $codeClass = "";
        $codeName  = "";
        $namespace = "";
Severity: Minor
Found in src/Visitor/Method_.php - About 3 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 leaveNode has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function leaveNode(Node $node)
    {
        $codeClass = "";
        $codeName  = "";
        $namespace = "";
Severity: Major
Found in src/Visitor/Method_.php - About 2 hrs to fix

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

        private function analyzeContent($filePath, array &$resource)
        {
            $analyzer    = new CodeAnalyzer($filePath);
            $fileContent = $analyzer->getTrimedCode();
            $code        = $analyzer->getCode();
    Severity: Minor
    Found in src/ClassAnalyzer.php - About 1 hr to fix

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

          public function enterNode(Node $node)
          {
              if ($node instanceof Node\Stmt\Class_) {
                  $this->classname = $node->name;
                  if (isset($node->extends)) {
      Severity: Minor
      Found in src/Visitor.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 analyzeContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function analyzeContent($filePath, array &$resource)
          {
              $analyzer    = new CodeAnalyzer($filePath);
              $fileContent = $analyzer->getTrimedCode();
              $code        = $analyzer->getCode();
      Severity: Minor
      Found in src/ClassAnalyzer.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 getTrimedCode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getTrimedCode()
          {
              $fileStr     = file_get_contents($this->path);
              $fileContent = "";
      
      
      Severity: Minor
      Found in src/CodeAnalyzer.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

      Severity
      Category
      Status
      Source
      Language