crocodic-studio/crudbooster

View on GitHub

Showing 132 of 160 total issues

Function execute_api has a Cognitive Complexity of 316 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute_api($output = 'JSON')
    {

        // DB::enableQueryLog();

Severity: Minor
Found in src/controllers/ApiController.php - About 6 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

File CBController.php has 1424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace crocodicstudio\crudbooster\controllers;

error_reporting(E_ALL ^ E_NOTICE);


Severity: Major
Found in src/controllers/CBController.php - About 3 days to fix

    Function getIndex has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getIndex()
        {
            $this->cbLoader();
    
            $module = CRUDBooster::getCurrentModule();
    Severity: Minor
    Found in src/controllers/CBController.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

    File CRUDBooster.php has 1377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace crocodicstudio\crudbooster\helpers;
    
    use Cache;
    Severity: Major
    Found in src/helpers/CRUDBooster.php - About 3 days to fix

      Method getIcons has 696 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getIcons() {
              return [
                  "glass",
                  "music",
                  "search",
      Severity: Major
      Found in src/fonts/Fontawesome.php - About 3 days to fix

        Method execute_api has 457 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute_api($output = 'JSON')
            {
        
                // DB::enableQueryLog();
        
        
        Severity: Major
        Found in src/controllers/ApiController.php - About 2 days to fix

          Method getIndex has 346 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getIndex()
              {
                  $this->cbLoader();
          
                  $module = CRUDBooster::getCurrentModule();
          Severity: Major
          Found in src/controllers/CBController.php - About 1 day to fix

            Function input_assignment has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
            Open

                public function input_assignment($id = null)
                {
            
                    $hide_form = (request('hide_form')) ? unserialize(request('hide_form')) : [];
            
            
            Severity: Minor
            Found in src/controllers/CBController.php - About 1 day 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

            File Fontawesome.php has 702 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php 
            namespace crocodicstudio\crudbooster\fonts;
            
            class Fontawesome {
                public static function getIcons() {
            Severity: Major
            Found in src/fonts/Fontawesome.php - About 1 day to fix

              Function validation has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function validation($id = null)
                  {
              
                      $request_all = Request::all();
                      $array_input = [];
              Severity: Minor
              Found in src/controllers/CBController.php - About 1 day 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

              CRUDBooster has 73 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CRUDBooster
              {
                  /**
                   *    Comma-delimited data output from the child table
                   */
              Severity: Major
              Found in src/helpers/CRUDBooster.php - About 1 day to fix

                File ModulsController.php has 617 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php namespace crocodicstudio\crudbooster\controllers;
                
                use CRUDBooster;
                use Illuminate\Support\Facades\DB;
                use Illuminate\Support\Facades\Excel;
                Severity: Major
                Found in src/controllers/ModulsController.php - About 1 day to fix

                  Method generateController has 258 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function generateController($table, $name = null)
                      {
                  
                          $exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
                          $image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
                  Severity: Major
                  Found in src/helpers/CRUDBooster.php - About 1 day to fix

                    Function postEditSave has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function postEditSave($id)
                        {
                            $this->cbLoader();
                            $row = DB::table($this->table)->where($this->primary_key, $id)->first();
                    
                    
                    Severity: Minor
                    Found in src/controllers/CBController.php - About 1 day 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 generateController has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function generateController($table, $name = null)
                        {
                    
                            $exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
                            $image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
                    Severity: Minor
                    Found in src/helpers/CRUDBooster.php - About 1 day 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 postAddSave has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function postAddSave()
                        {
                            $this->cbLoader();
                            if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                                CRUDBooster::insertLog(cbLang('log_try_add_save', [
                    Severity: Minor
                    Found in src/controllers/CBController.php - About 1 day 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

                    File ApiController.php has 546 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php namespace crocodicstudio\crudbooster\controllers;
                    
                    use CRUDBooster;
                    use Illuminate\Support\Facades\DB;
                    use Illuminate\Support\Facades\Hash;
                    Severity: Major
                    Found in src/controllers/ApiController.php - About 1 day to fix

                      Function postDoImportChunk has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function postDoImportChunk()
                          {
                              $this->cbLoader();
                              $file_md5 = md5(request('file'));
                      
                      
                      Severity: Minor
                      Found in src/controllers/CBController.php - About 1 day 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 cbInit has 197 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function cbInit()
                          {
                              $this->table = "cms_menus";
                              $this->primary_key = "id";
                              $this->title_field = "name";
                      Severity: Major
                      Found in src/controllers/MenusController.php - About 7 hrs to fix

                        Method cbInit has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function cbInit()
                            {
                                $this->table = 'cms_moduls';
                                $this->primary_key = 'id';
                                $this->title_field = "name";
                        Severity: Major
                        Found in src/controllers/ModulsController.php - About 6 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language