Showing 73 of 73 total issues

Function generateClassType has a Cognitive Complexity of 251 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateClassType(array $properties, $typesReference, $typesDescription, ClassConfig $config)
    {
        $phpNamespace = $this->currentClass->getNamespace();
        if ($config->isInterface) {
            $this->info('Passo a interfaccia', [$this->currentClass->getName()]);
Severity: Minor
Found in Generator/ClassGenerator.php - About 5 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

Function generate has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate(Local $directoryOutput)
    {
        //$is_constructor_enable = true;
        //$ddd_is_root_aggregate = false;

Severity: Minor
Found in Generator/DDDGenerator.php - About 2 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 generateClassType has 317 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function generateClassType(array $properties, $typesReference, $typesDescription, ClassConfig $config)
    {
        $phpNamespace = $this->currentClass->getNamespace();
        if ($config->isInterface) {
            $this->info('Passo a interfaccia', [$this->currentClass->getName()]);
Severity: Major
Found in Generator/ClassGenerator.php - About 1 day to fix

    Method generate has 219 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function generate(Local $directoryOutput)
        {
            //$is_constructor_enable = true;
            //$ddd_is_root_aggregate = false;
    
    
    Severity: Major
    Found in Generator/DDDGenerator.php - About 1 day to fix

      File ClassGenerator.php has 451 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Yoghi\Bundle\MaddaBundle\Generator;
      
      /*
      Severity: Minor
      Found in Generator/ClassGenerator.php - About 6 hrs to fix

        Method generateRest has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function generateRest($ramlFile, Local $directoryOutput)
            {
                $parser = new Parser();
                try {
        
        
        Severity: Major
        Found in Generator/RestGenerator.php - About 3 hrs to fix

          The class ClassGenerator has an overall complexity of 83 which is very high. The configured complexity threshold is 50.
          Open

          class ClassGenerator extends AbstractFileGenerator
          {
              /**
               * [$currentClass description].
               *
          Severity: Minor
          Found in Generator/ClassGenerator.php by phpmd

          File DDDGenerator.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Yoghi\Bundle\MaddaBundle\Generator;
          
          /*
          Severity: Minor
          Found in Generator/DDDGenerator.php - About 2 hrs to fix

            Function generateRest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function generateRest($ramlFile, Local $directoryOutput)
                {
                    $parser = new Parser();
                    try {
            
            
            Severity: Minor
            Found in Generator/RestGenerator.php - About 1 hr 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

            Avoid excessively long variable names like $namespaceImplementClass. Keep variable name length under 20.
            Open

                                    $namespaceImplementClass = $this->modelClass[$eventsImplement];
            Severity: Minor
            Found in Generator/DDDGenerator.php by phpmd

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#longvariable

            Avoid variables with short names like $g. Configured minimum length is 3.
            Open

                            $g = new ClassGenerator($namespace, $className, $classComments);
            Severity: Minor
            Found in Generator/DDDGenerator.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#shortvariable

            Avoid variables with short names like $mc. Configured minimum length is 3.
            Open

                    $mc = $this->currentClass->addMethod('__construct');
            Severity: Minor
            Found in Generator/ClassGenerator.php by phpmd

            ShortVariable

            Since: 0.2

            Detects when a field, local, or parameter has a very short name.

            Example

            class Something {
                private $q = 15; // VIOLATION - Field
                public static function main( array $as ) { // VIOLATION - Formal
                    $r = 20 + $this->q; // VIOLATION - Local
                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                        $r += $this->q;
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#shortvariable

            Avoid deeply nested control flow statements.
            Open

                                                if ($defaultValue != null) {
                                                    /* @var $parameter \Nette\PhpGenerator\Parameter */
                                                    $parameter->setDefaultValue(''.$defaultValue);
                                                }
            Severity: Major
            Found in Generator/ClassGenerator.php - About 45 mins to fix

              Blank line found at start of control structure
              Open

                      try {
              Severity: Minor
              Found in Generator/RestGenerator.php by phpcodesniffer

              Missing class import via use statement (line '34', column '20').
              Open

                      $rdi = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
              Severity: Minor
              Found in Finder/Finder.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '35', column '20').
              Open

                      $rit = new \RecursiveIteratorIterator($rdi);
              Severity: Minor
              Found in Finder/Finder.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                  public function search($dir, $extension)
                  {
                      if (isset($this->logger)) {
                          $this->logger->info('Finder invocato su directory : '.$dir);
                      }
              Severity: Minor
              Found in Finder/Finder.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

              The method generate() has 288 lines of code. Current threshold is set to 100. Avoid really long methods.
              Open

                  public function generate(Local $directoryOutput)
                  {
                      //$is_constructor_enable = true;
                      //$ddd_is_root_aggregate = false;
              
              
              Severity: Minor
              Found in Generator/DDDGenerator.php by phpmd

              Avoid unused local variables such as '$infoSecuritySchema'.
              Open

                          $infoSecuritySchema = $this->apiDef->getSecuredBy(); // descrive i vari security schema usati nelle varie risorse
              Severity: Minor
              Found in Generator/RestGenerator.php by phpmd

              UnusedLocalVariable

              Since: 0.2

              Detects when a local variable is declared and/or assigned, but not used.

              Example

              class Foo {
                  public function doSomething()
                  {
                      $i = 5; // Unused
                  }
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

              Avoid unused private methods such as 'removeGraph'.
              Open

                  private function removeGraph(&$str)
                  {
                      $str = str_replace('{', '', $str);
                      $str = str_replace('}', '', $str);
                      $str = ucfirst($str);
              Severity: Minor
              Found in Generator/RestGenerator.php by phpmd

              UnusedPrivateMethod

              Since: 0.2

              Unused Private Method detects when a private method is declared but is unused.

              Example

              class Something
              {
                  private function foo() {} // unused
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

              Severity
              Category
              Status
              Source
              Language