GrafiteInc/CrudMaker

View on GitHub

Showing 25 of 25 total issues

Method handle has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle()
    {
        $section = '';
        $splitTable = [];

Severity: Major
Found in src/Console/CrudMaker.php - About 3 hrs to fix

    Function createSchema has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createSchema($config, $section, $table, $splitTable, $schema)
        {
            $migrationFiles = $this->filesystem->allFiles($this->getMigrationsPath($config));
    
            if (!empty($section)) {
    Severity: Minor
    Found in src/Generators/DatabaseGenerator.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 configASectionedCRUD has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function configASectionedCRUD($config, $section, $table, $splitTable)
        {
            $appPath = app()->path();
            $basePath = app()->basePath();
            $appNamespace = $this->appService->getAppNamespace();
    Severity: Major
    Found in src/Services/ConfigService.php - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function createController($config)
          {
              $this->fileService->mkdir($config['_path_controller_'], 0777, true);
      
              $request = $this->fileService->get($config['template_source'].'/Controller.txt');
      Severity: Major
      Found in src/Generators/CrudGenerator.php and 1 other location - About 2 hrs to fix
      src/Generators/CrudGenerator.php on lines 236..249

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 122.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function createFacade($config)
          {
              $this->fileService->mkdir($config['_path_facade_'], 0777, true);
      
              $facade = $this->fileService->get($config['template_source'].'/Facade.txt');
      Severity: Major
      Found in src/Generators/CrudGenerator.php and 1 other location - About 2 hrs to fix
      src/Generators/CrudGenerator.php on lines 70..83

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 122.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method basicConfig has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function basicConfig($framework, $appPath, $basePath, $appNamespace, $table, $options)
          {
              $config = [
                  'framework'                  => $framework,
                  'bootstrap'                  => false,
      Severity: Major
      Found in src/Services/ConfigService.php - About 2 hrs to fix

        Method createSchema has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createSchema($config, $section, $table, $splitTable, $schema)
            {
                $migrationFiles = $this->filesystem->allFiles($this->getMigrationsPath($config));
        
                if (!empty($section)) {
        Severity: Minor
        Found in src/Generators/DatabaseGenerator.php - About 1 hr to fix

          Method handle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handle()
              {
                  $filesystem = new Filesystem();
                  $tableService = new TableService();
                  $table = (string) $this->argument('table');
          Severity: Minor
          Found in src/Console/TableCrudMaker.php - About 1 hr to fix

            Function handle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function handle()
                {
                    $section = '';
                    $splitTable = [];
            
            
            Severity: Minor
            Found in src/Console/CrudMaker.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

            Function crudReport has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private function crudReport($table)
                {
                    $this->line("\n");
                    $this->line('Built model...');
                    $this->line('Built request...');
            Severity: Minor
            Found in src/Console/CrudMaker.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

            Method createExampleByType has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createExampleByType($type)
                {
                    $faker = Faker::create();
            
                    $typeArray = [
            Severity: Minor
            Found in src/Services/TableService.php - About 1 hr to fix

              Method crudReport has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function crudReport($table)
                  {
                      $this->line("\n");
                      $this->line('Built model...');
                      $this->line('Built request...');
              Severity: Minor
              Found in src/Console/CrudMaker.php - About 1 hr to fix

                Function createColumnDetailString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createColumnDetailString($columnDetails)
                    {
                        $columnDetailString = '';
                
                        if (count($columnDetails) > 1) {
                Severity: Minor
                Found in src/Generators/DatabaseGenerator.php - About 55 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 validateSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validateSchema($command)
                    {
                        if ($command->option('schema')) {
                            $definitions = $this->calibrateDefinitions($command->option('schema'));
                
                
                Severity: Minor
                Found in src/Services/ValidatorService.php - About 55 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

                Method basicConfig has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function basicConfig($framework, $appPath, $basePath, $appNamespace, $table, $options)
                Severity: Minor
                Found in src/Services/ConfigService.php - About 45 mins to fix

                  Method generateDB has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function generateDB($config, $bar, $section, $table, $splitTable, $command)
                  Severity: Minor
                  Found in src/Services/CrudService.php - About 45 mins to fix

                    Method createMigration has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function createMigration($config, $section, $table, $splitTable, $command)
                    Severity: Minor
                    Found in src/Generators/DatabaseGenerator.php - About 35 mins to fix

                      Method createSchema has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function createSchema($config, $section, $table, $splitTable, $schema)
                      Severity: Minor
                      Found in src/Generators/DatabaseGenerator.php - About 35 mins to fix

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

                                AppService $appService,
                                CrudService $crudService,
                                CrudGenerator $crudGenerator,
                                ConfigService $configService,
                                ValidatorService $validator
                        Severity: Minor
                        Found in src/Console/CrudMaker.php - About 35 mins to fix

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

                              public function getApiTestTemplates($templates, $apiOnly, $withApi)
                              {
                                  $filteredTemplates = [];
                          
                                  foreach ($templates as $template) {
                          Severity: Minor
                          Found in src/Services/TestService.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