crocodic-studio/crudbooster

View on GitHub

Showing 132 of 160 total issues

Function getFindData has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFindData()
    {
        $q = request('q');
        $id = request('id');
        $limit = request('limit') ?: 10;
Severity: Minor
Found in src/controllers/CBController.php - About 4 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

Function getPreview has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPreview($one, $two = null, $three = null, $four = null, $five = null)
    {

        if ($two) {
            $fullFilePath = 'uploads'.DIRECTORY_SEPARATOR.$one.DIRECTORY_SEPARATOR.$two;
Severity: Minor
Found in src/controllers/FileController.php - About 4 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

CBController has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class CBController extends Controller
{
    public $data_inputan;

    public $columns_table;
Severity: Minor
Found in src/controllers/CBController.php - About 4 hrs to fix

    Method validation has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function validation($id = null)
        {
    
            $request_all = Request::all();
            $array_input = [];
    Severity: Major
    Found in src/controllers/CBController.php - About 4 hrs to fix

      Method postEditSave has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function postEditSave($id)
          {
              $this->cbLoader();
              $row = DB::table($this->table)->where($this->primary_key, $id)->first();
      
      
      Severity: Major
      Found in src/controllers/CBController.php - About 4 hrs to fix

        Method input_assignment has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function input_assignment($id = null)
            {
        
                $hide_form = (request('hide_form')) ? unserialize(request('hide_form')) : [];
        
        
        Severity: Major
        Found in src/controllers/CBController.php - About 3 hrs to fix

          Method postAddSave has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function postAddSave()
              {
                  $this->cbLoader();
                  if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                      CRUDBooster::insertLog(cbLang('log_try_add_save', [
          Severity: Major
          Found in src/controllers/CBController.php - About 3 hrs to fix

            Function getColumnTable has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                function getColumnTable($table, $type = 'list')
                {
                    $this->cbLoader();
                    $result = [];
            
            
            Severity: Minor
            Found in src/controllers/ApiCustomController.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 postDoImportChunk has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function postDoImportChunk()
                {
                    $this->cbLoader();
                    $file_md5 = md5(request('file'));
            
            
            Severity: Major
            Found in src/controllers/CBController.php - About 3 hrs to fix

              Method getPreview has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPreview($one, $two = null, $three = null, $four = null, $five = null)
                  {
              
                      if ($two) {
                          $fullFilePath = 'uploads'.DIRECTORY_SEPARATOR.$one.DIRECTORY_SEPARATOR.$two;
              Severity: Major
              Found in src/controllers/FileController.php - About 3 hrs to fix

                File MenusController.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php namespace crocodicstudio\crudbooster\controllers;
                
                use CRUDBooster;
                use Illuminate\Support\Facades\Cache;
                use Illuminate\Support\Facades\DB;
                Severity: Minor
                Found in src/controllers/MenusController.php - About 3 hrs to fix

                  Function sidebarMenu has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function sidebarMenu()
                      {
                          $menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
                  
                          foreach ($menu_active as &$menu) {
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 getFindData has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getFindData()
                      {
                          $q = request('q');
                          $id = request('id');
                          $limit = request('limit') ?: 10;
                  Severity: Major
                  Found in src/controllers/CBController.php - About 3 hrs to fix

                    Method postAddSave has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function postAddSave()
                        {
                            $this->cbLoader();
                    
                            if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                    Severity: Major
                    Found in src/controllers/ModulsController.php - About 3 hrs to fix

                      Function checkRequirements has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function checkRequirements()
                          {
                              $this->info('System Requirements Checking:');
                              $system_failed = 0;
                              $laravel = app();
                      Severity: Minor
                      Found in src/commands/CrudboosterInstallationCommand.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

                      Function checkRequirements has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function checkRequirements()
                          {
                              $this->info('System Requirements Checking:');
                              $system_failed = 0;
                              $laravel = app();
                      Severity: Minor
                      Found in src/commands/CrudboosterUpdateCommand.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

                      File ApiCustomController.php has 288 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: Minor
                      Found in src/controllers/ApiCustomController.php - About 2 hrs to fix

                        Method checkRequirements has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function checkRequirements()
                            {
                                $this->info('System Requirements Checking:');
                                $system_failed = 0;
                                $laravel = app();
                        Severity: Major
                        Found in src/commands/CrudboosterInstallationCommand.php - About 2 hrs to fix

                          Method checkRequirements has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function checkRequirements()
                              {
                                  $this->info('System Requirements Checking:');
                                  $system_failed = 0;
                                  $laravel = app();
                          Severity: Major
                          Found in src/commands/CrudboosterUpdateCommand.php - About 2 hrs to fix

                            Method postStep4 has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function postStep4()
                                {
                                    $this->cbLoader();
                            
                                    $post = Request::all();
                            Severity: Major
                            Found in src/controllers/ModulsController.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language