KumbiaPHP/KumbiaPHP

View on GitHub

Showing 61 of 65 total issues

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

class Form
{
    /**
     * Utilizado para generar los id de los radio button,
     * lleva un conteo interno.
Severity: Minor
Found in core/extensions/helpers/form.php - About 4 hrs to fix

    Upload has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class Upload {
    
        /**
         * Nombre de archivo subido por método POST
         *
    Severity: Minor
    Found in core/libs/upload/upload.php - About 2 hrs to fix

      Method create has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function create(object $model, string $action = ''): void
          {
              $model_name = $model::class;
              if (!$action) {
                  $action = ltrim(Router::get('route'), '/');
      Severity: Major
      Found in core/extensions/helpers/model_form.php - About 2 hrs to fix

        Date has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Date {
        
            /**
             * Valor interno de fecha
             *
        Severity: Minor
        Found in core/libs/date/date.php - About 2 hrs to fix

          Function create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function create(object $model, string $action = ''): void
              {
                  $model_name = $model::class;
                  if (!$action) {
                      $action = ltrim(Router::get('route'), '/');
          Severity: Minor
          Found in core/extensions/helpers/model_form.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 create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public function create($params, $controller)
              {
                  // nombre de archivo
                  $file = APP_PATH . 'controllers';
          
          
          Severity: Minor
          Found in core/console/controller_console.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 _validates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _validates()
              {
                  // Verifica que se pueda escribir en el directorio
                  if (!is_writable($this->_path)) {
                      Flash::error('Error: no se puede escribir en el directorio');
          Severity: Minor
          Found in core/libs/upload/adapters/image_upload.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 rmdir has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function rmdir($dir)
              {
                  // Obtengo los archivos en el directorio a eliminar
                  if ($files = array_merge(glob("$dir/*"), glob("$dir/.*"))) {
                      // Elimino cada subdirectorio o archivo
          Severity: Minor
          Found in core/libs/file_util/file_util.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 dispatch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function dispatch($argv)
              {
                  // Elimino el nombre de archivo del array de argumentos
                  array_shift($argv);
          
          
          Severity: Minor
          Found in core/kumbia/console.php - About 1 hr to fix

            Method _validates has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _validates()
                {
                    // Verifica que se pueda escribir en el directorio
                    if (!is_writable($this->_path)) {
                        Flash::error('Error: no se puede escribir en el directorio');
            Severity: Minor
            Found in core/libs/upload/adapters/image_upload.php - About 1 hr to fix

              Method kumbia_autoload has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function kumbia_autoload($class)
              {
                  // Optimizando carga
                  static $classes;
                  $classes ??= [
              Severity: Minor
              Found in core/kumbia/autoload.php - About 1 hr to fix

                Method create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function create($params, $controller)
                    {
                        // nombre de archivo
                        $file = APP_PATH . 'controllers';
                
                
                Severity: Minor
                Found in core/console/controller_console.php - About 1 hr to fix

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

                      public function exec(){
                          /*Recorrido por todos los campos*/
                          foreach ($this->rules as $field => $fRule){
                              $value = self::getValue($this->obj, $field);
                              /*Regla individual para cada campo*/
                  Severity: Minor
                  Found in core/libs/validate/validate.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 bindDatePicker has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          bindDatePicker: function () {
                              // Selecciona los campos input
                              let inputs = $("input.js-datepicker");
                              /**
                               * Funcion encargada de enlazar el DatePicker a los Input
                  Severity: Minor
                  Found in default/public/javascript/jquery/jquery.kumbiaphp.js - About 1 hr to fix

                    Function autoload has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            autoload: function () {
                                let elem = $("[class*='jp-']");
                                $.each(elem, function (i) {
                                    let el = $(this); //apunta al elemento con clase jp-*
                                    let classes = el.attr("class").split(" ");
                    Severity: Minor
                    Found in default/public/javascript/jquery/jquery.kumbiaphp.js - About 1 hr to fix

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

                          private function active_session()
                          {
                                  $user_hash = md5(serialize($this->extra_args));
                                  $filename = APP_PATH.'temp/cache/'.base64_encode('auth');
                                  if (is_file($filename)) {
                      Severity: Minor
                      Found in core/libs/auth/auth.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 dispatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected static function dispatch($cont)
                          {
                              // Se ejecutan los filtros initialize y before
                              if ($cont->k_callback(true) === false) {
                                  return $cont;
                      Severity: Minor
                      Found in core/kumbia/router.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 createTagDataProvider has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function createTagDataProvider()
                          {
                              return array(
                                  array(
                                      'a',
                      Severity: Minor
                      Found in core/tests/classes/extensions/helpers/TagTest.php - About 1 hr to fix

                        Method dbSelect has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function dbSelect($field, $show, $data, $update, $action, $blank=null, $class = '', $attrs = '')
                        Severity: Major
                        Found in core/extensions/helpers/ajax.php - About 1 hr to fix

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

                              public static function get($s, $filter, $options = array()) {
                                  if (is_string($options)) {
                                      $filters = func_get_args();
                                      unset($filters[0]);
                          
                          
                          Severity: Minor
                          Found in core/libs/filter/filter.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

                          Severity
                          Category
                          Status
                          Source
                          Language