crocodic-studio/crudbooster

View on GitHub

Showing 132 of 160 total issues

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

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

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

    public function postActionSelected()
    {
        $this->cbLoader();
        $id_selected = Request::input('checkbox');
        $button_name = Request::input('button_name');
Severity: Minor
Found in src/controllers/CBController.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 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 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 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

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

        public static function get($table, $string_conditions = null, $orderby = null, $limit = null, $skip = null)
    Severity: Minor
    Found in src/helpers/CRUDBooster.php - About 35 mins to fix

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

          public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
      Severity: Minor
      Found in src/helpers/CRUDBooster.php - About 35 mins to fix

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

            public function getPreview($one, $two = null, $three = null, $four = null, $five = null)
        Severity: Minor
        Found in src/controllers/FileController.php - About 35 mins to fix

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

              private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
          Severity: Minor
          Found in src/helpers/CRUDBooster.php - About 35 mins to fix

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

                function min_var_export($input) {
                    if(is_array($input)) {
                        $buffer = [];
                        foreach($input as $key => $value)
                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
            Severity: Minor
            Found in src/helpers/Helper.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

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

                public static function sendEmail($config = [])
                {
            
                    \Config::set('mail.driver', self::getSetting('smtp_driver'));
                    \Config::set('mail.host', self::getSetting('smtp_host'));
            Severity: Minor
            Found in src/helpers/CRUDBooster.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

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

                private function checkHideForm()
                {
                    if ($this->hide_form && count($this->hide_form)) {
                        foreach ($this->form as $i => $f) {
                            if (in_array($f['name'], $this->hide_form)) {
            Severity: Minor
            Found in src/controllers/CBController.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

            Avoid too many return statements within this method.
            Open

                    return $next($request);
            Severity: Major
            Found in src/middlewares/CBBackend.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return new Mailqueues;
              Severity: Major
              Found in src/CRUDBoosterServiceProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return Response::file(storage_path('app/'.$fullFilePath), $headers);
                Severity: Major
                Found in src/controllers/FileController.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $result;
                  Severity: Major
                  Found in src/controllers/ApiController.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return redirect($menus->path);
                    Severity: Major
                    Found in src/middlewares/CBBackend.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language