piotrpolak/pepiscms

View on GitHub

Showing 481 of 486 total issues

Method render has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
    {
        $menu = $this->config->item('menu');

        $pull_submenu_from_controller = $this->ensurePulledSumbenuFromControllerIsSet($controller, $pull_submenu_from_controller);
Severity: Major
Found in pepiscms/application/libraries/MenuRendor.php - About 3 hrs to fix

    File TableUtility.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * PepisCMS
     *
    Severity: Minor
    Found in pepiscms/modules/crud/libraries/TableUtility.php - About 3 hrs to fix

      File Module_model.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * PepisCMS
       *
      Severity: Minor
      Found in pepiscms/application/models/Module_model.php - About 3 hrs to fix

        Function makeInterfaceButtonsToWork has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            makeInterfaceButtonsToWork: function () {
                $('input[type=submit].button:visible').each(function () { // a.button:visible
        
                    var $button = $(this);
        
        
        Severity: Minor
        Found in pepiscms/js/jquery.frontend.js - 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

        Function generate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function generate()
            {
                $this->generateSetNoCacheHeaders();
        
                // Default value
        Severity: Minor
        Found in pepiscms/application/libraries/FormBuilder.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 __construct has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct()
            {
                parent::__construct();
        
                // Overwriting uploads base path
        Severity: Major
        Found in pepiscms/modules/siteconfig/controllers/SiteconfigAdmin.php - About 3 hrs to fix

          Function importFrameworkLogs has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function importFrameworkLogs()
              {
                  // Reading logs from the given location
                  $log_path = $this->config->item('log_path');
                  $logs = glob($log_path . '*.php');
          Severity: Minor
          Found in pepiscms/application/models/Log_model.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

          Function send has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function send($to, $from, $from_name, $subject, $message,
                                   $html = false, $attachments = array(), $reply_to = false, $reply_to_name = false)
              {
                  if (!$html) {
                      $message = str_replace("\r\n", "\n", $message);
          Severity: Minor
          Found in pepiscms/application/libraries/EmailSender.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 _datagrid_format_id_metadata_column has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _datagrid_format_id_metadata_column($content, &$line)
              {
                  // TODO move HTML out of this method
          
                  // $content is usually meta_order_field
          Severity: Major
          Found in pepiscms/modules/crud/libraries/AdminCRUDController.php - About 3 hrs to fix

            Method generateFilters has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function generateFilters($page = false, $order_by = false, $order = false, $applied_filter_values = -1)
                {
                    $filters_output = '';
            
                    if ($applied_filter_values == -1) {
            Severity: Major
            Found in pepiscms/application/libraries/DataGrid.php - About 3 hrs to fix

              Module_model has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Module_model extends PEPISCMS_Model
              {
                  /**
                   * Module_model constructor.
                   */
              Severity: Minor
              Found in pepiscms/application/models/Module_model.php - About 3 hrs to fix

                Method applyFilters has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function applyFilters(&$output, $filters)
                    {
                        $output_new = array();
                
                        // Reading the original feed line by line
                Severity: Major
                Found in pepiscms/application/models/Array_model.php - About 3 hrs to fix

                  Method do_setup has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function do_setup()
                      {
                          $view = $this->_get_view();
                  
                          $module = $this->input->getParam('module');
                  Severity: Major
                  Found in pepiscms/application/controllers/admin/Module.php - About 3 hrs to fix

                    Method move has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function move($id, $direction, $table = false, $constraint_field_name = false,
                                             $item_order_field_name = 'item_order', $id_field_name = 'id')
                        {
                            // When no table is specified, taking table from the object
                            if (!$table) {
                    Severity: Major
                    Found in pepiscms/application/models/Generic_model.php - About 3 hrs to fix

                      Method _on_page_save_callback has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function _on_page_save_callback(&$data)
                          {
                              /*
                               * TESTS
                               * Update page contents
                      Severity: Major
                      Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 3 hrs to fix

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

                            private function generatePagination($no_of_pages, $order_by, $order, $applied_filter_values, $page)
                            {
                                if ($no_of_pages < 1) {
                                    return '';
                                }
                        Severity: Minor
                        Found in pepiscms/application/libraries/DataGrid.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

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

                            private function execute($language_code = '', $uri = '')
                            {
                                $this->load->library('ModuleRunner');
                                $this->load->library('Widget');
                        
                        
                        Severity: Minor
                        Found in pepiscms/application/controllers/public/Displaypage.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

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

                            protected function _run_hook($data)
                            {
                                // Closures/lambda functions and array($object, 'method') callables
                                if (is_callable($data)) {
                                    is_array($data)
                        Severity: Minor
                        Found in pepiscms/application/core/PEPISCMS_Hooks.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 writeConfigFiles has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function writeConfigFiles($data, $base_path)
                            {
                                list($hostname, $port) = $this->explodeHostname($data['hostname']);
                        
                                $templates_base_path = realpath(dirname(realpath(__FILE__)) . '/../../resources/config_template/') . '/';
                        Severity: Major
                        Found in pepiscms/application/libraries/Installer_helper.php - About 3 hrs to fix

                          File Ajaxfilemanager.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          /**
                           * PepisCMS
                           *
                          Severity: Minor
                          Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language