crocodic-studio/crudbooster

View on GitHub

Showing 160 of 160 total issues

Method authAPI has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function authAPI()
    {
        $allowedUserAgent = config('crudbooster.API_USER_AGENT_ALLOWED');
        $user_agent = Request::header('User-Agent');
        $authorization = Request::header('Authorization');
Severity: Minor
Found in src/helpers/CRUDBooster.php - About 1 hr to fix

    Method generateAPI has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function generateAPI($controller_name, $table_name, $permalink, $method_type = 'post')
        {
            $php = '
            <?php namespace App\Http\Controllers;
    
    
    Severity: Minor
    Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

          public function cbInit()
          {
              $this->table = 'cms_logs';
              $this->primary_key = 'id';
              $this->title_field = "ipaddress";
      Severity: Minor
      Found in src/controllers/LogsController.php - About 1 hr to fix

        Method getStep2 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getStep2($id)
            {
                $this->cbLoader();
        
                $module = CRUDBooster::getCurrentModule();
        Severity: Minor
        Found in src/controllers/ModulsController.php - About 1 hr to fix

          Method userControllerRoute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function userControllerRoute() {
                  Route::group([
                      'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'],
                      'prefix' => config('crudbooster.ADMIN_PATH'),
                      'namespace' => 'App\Http\Controllers',
          Severity: Minor
          Found in src/helpers/CBRouter.php - About 1 hr to fix

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

                public function postEditSave($id)
                {
                    $this->cbLoader();
            
                    $row = CRUDBooster::first($this->table, $id);
            Severity: Minor
            Found in src/controllers/PrivilegesController.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 routeController has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function routeController($prefix, $controller, $namespace = null)
                {
            
                    $prefix = trim($prefix, '/').'/';
            
            
            Severity: Minor
            Found in src/helpers/CRUDBooster.php - About 1 hr to fix

              Method postExportData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function postExportData()
                  {
                      ini_set('memory_limit', '1024M');
                      set_time_limit(180);
              
              
              Severity: Minor
              Found in src/controllers/CBController.php - About 1 hr to fix

                Method getImportData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getImportData()
                    {
                        $this->cbLoader();
                        $data['page_menu'] = Route::getCurrentRoute()->getActionName();
                        $data['page_title'] = 'Import Data';
                Severity: Minor
                Found in src/controllers/CBController.php - About 1 hr to fix

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

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

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

                        public static function isCRUD()
                        {
                            if (self::isSuperadmin()) {
                                return true;
                            }
                    Severity: Minor
                    Found in src/helpers/CRUDBooster.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 routeController has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function routeController($prefix, $controller, $namespace = null)
                        {
                    
                            $prefix = trim($prefix, '/').'/';
                    
                    
                    Severity: Minor
                    Found in src/helpers/CRUDBooster.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 postAddSave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function postAddSave()
                        {
                            $this->cbLoader();
                    
                            if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                    Severity: Minor
                    Found in src/controllers/ModulsController.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 getIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getIndex()
                        {
                            $this->cbLoader();
                    
                            $module = CRUDBooster::getCurrentModule();
                    Severity: Minor
                    Found in src/controllers/MenusController.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 userControllerRoute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function userControllerRoute() {
                            Route::group([
                                'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'],
                                'prefix' => config('crudbooster.ADMIN_PATH'),
                                'namespace' => 'App\Http\Controllers',
                    Severity: Minor
                    Found in src/helpers/CBRouter.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

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (! Hash::check($value, $rows->{$name})) {
                                                            $result['api_status'] = 0;
                                                            $result['api_message'] = 'Invalid credentials. Check your username and password.';
                    
                                                            goto show;
                    Severity: Major
                    Found in src/controllers/ApiController.php - About 45 mins to fix

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

                          public static function valid($arr = [], $type = 'json')
                          {
                              $input_arr = Request::all();
                      
                              foreach ($arr as $a => $b) {
                      Severity: Minor
                      Found in src/helpers/CRUDBooster.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 getModulePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function getModulePath()
                          {
                              // Check to position of admin_path
                              if(config("crudbooster.ADMIN_PATH")) {
                                  $adminPathSegments = explode('/', Request::path());
                      Severity: Minor
                      Found in src/helpers/CRUDBooster.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 postStepFinish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function postStepFinish()
                          {
                              $this->cbLoader();
                              $id = Request::input('id');
                              $row = DB::table('cms_moduls')->where('id', $id)->first();
                      Severity: Minor
                      Found in src/controllers/ModulsController.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 postSaveApiCustom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function postSaveApiCustom()
                          {
                              $this->cbLoader();
                              $posts = Request::all();
                      
                      
                      Severity: Minor
                      Found in src/controllers/ApiCustomController.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

                      Severity
                      Category
                      Status
                      Source
                      Language