piotrpolak/pepiscms

View on GitHub

Showing 486 of 487 total issues

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

    public static function applyFilters($db, $filters)
    {
        $allowed_conditions = array(
            'eq' => '=',
            'ne' => '!=',
Severity: Minor
Found in pepiscms/application/models/Generic_model.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 Setup.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * PepisCMS
 *
Severity: Minor
Found in pepiscms/application/controllers/admin/Setup.php - About 2 hrs to fix

    Method index has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function index()
        {
            $this->installer_helper->buildFileStructure(INSTALLATIONPATH);
    
            // When the Symfony2 configuration is not present, display the native connection only
    Severity: Major
    Found in pepiscms/application/controllers/admin/Installer.php - About 2 hrs to fix

      Method index has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function index()
          {
              if (!$this->auth->getDriver()->isPasswordChangeSupported()) {
                  show_404();
              }
      Severity: Major
      Found in pepiscms/application/controllers/admin/Changepassword.php - About 2 hrs to fix

        DefaultFormRenderer has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class DefaultFormRenderer extends ContainerAware implements FormRenderableInterface
        {
            protected $is_js_included = false;
            protected $validation_message_prefix = false;
            protected $validation_message_suffix = false;
        Severity: Minor
        Found in pepiscms/application/classes/DefaultFormRenderer.php - About 2 hrs to fix

          Method send has 70 lines of code (exceeds 25 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: Major
          Found in pepiscms/application/libraries/EmailSender.php - About 2 hrs to fix

            Method edit has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function edit()
                {
                    $group_id = $this->input->getParam('id');
            
                    $add_new = !($group_id > 0);
            Severity: Major
            Found in pepiscms/modules/cms_groups/controllers/Cms_groupsAdmin.php - About 2 hrs to fix

              Function parseExcel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function parseExcel($path, $first_row_as_keys = true, $normalize_keys = true)
                  {
                      if (!$this->isFullyEnabled()) {
                          throw new \RuntimeException("PhpSpreadsheet is not enabled. Please refer to README.md");
                      }
              Severity: Minor
              Found in pepiscms/application/libraries/Spreadsheet.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 getjsonfilelist has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getjsonfilelist()
                  {
                      $files = $dirs = array();
                      $user_files_dir = $this->uploadsPath;
                      $current_path = isset($_POST['path']) ? str_replace('//', '/', str_replace('../', '', $_POST['path'] . '/')) : '/';
              Severity: Minor
              Found in pepiscms/application/controllers/admin/Ajaxfilemanager.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 fix_autoincrement_on_cms_tables has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fix_autoincrement_on_cms_tables()
                  {
                      $tables = array(
                          'database_table_users' => array('user_id', 'INT UNSIGNED'),
                          'database_table_group_to_entity' => array('id', 'INT'),
              Severity: Minor
              Found in pepiscms/modules/development/controllers/DevelopmentAdmin.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 _model has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function _model($model, $name = '', $db_conn = false, $hardfail = true)
                  {
                      if (is_array($model)) {
                          foreach ($model as $babe) {
                              $this->model($babe);
              Severity: Minor
              Found in pepiscms/application/core/PEPISCMS_Loader.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

              Method getjsonfilelist has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getjsonfilelist()
                  {
                      $files = $dirs = array();
                      $user_files_dir = $this->uploadsPath;
                      $current_path = isset($_POST['path']) ? str_replace('//', '/', str_replace('../', '', $_POST['path'] . '/')) : '/';
              Severity: Major
              Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 2 hrs to fix

                Method edit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function edit()
                    {
                        $section = $this->input->getParam('section');
                        $is_editable = ($section != 'system' && !$this->Module_model->isCoreModule($section)) || !PEPISCMS_PRODUCTION_RELEASE;
                
                
                Severity: Major
                Found in pepiscms/application/controllers/admin/Acl.php - About 2 hrs to fix

                  Method generateCSV has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function generateCSV($feed, $headers = false, $file_name = false, $send = true, $separator = false, $print_headers = true)
                      {
                          if (!$separator) {
                              $separator = ',';
                          }
                  Severity: Major
                  Found in pepiscms/application/libraries/Spreadsheet.php - About 2 hrs to fix

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

                    class Auth extends ContainerAware
                    {
                        const LOGGED_COOKIE_NAME = 'pepiscms_logged';
                        /**
                         * Auth update timeout in seconds
                    Severity: Minor
                    Found in pepiscms/application/libraries/Auth.php - About 2 hrs to fix

                      Method parseCSV has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function parseCSV($path, $first_row_as_keys = true, $normalize_keys = true, $separator = false)
                          {
                              $lines = array();
                              $keys = array();
                              if (file_exists($path)) {
                      Severity: Major
                      Found in pepiscms/application/libraries/Spreadsheet.php - About 2 hrs to fix

                        Method module_make has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function module_make()
                            {
                                $this->assign('title', $this->lang->line('development_make_a_new_module'));
                                $this->assign('success', false);
                        
                        
                        Severity: Major
                        Found in pepiscms/modules/development/controllers/DevelopmentAdmin.php - About 2 hrs to fix

                          Function makeConfigurationTestsAngGetErrors has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function makeConfigurationTestsAngGetErrors()
                              {
                                  $cache_path = $this->config->item('cache_path');
                                  $cache_path = ($cache_path === '') ? 'application/cache/' : $cache_path;
                                  if ($cache_path[0] !== '/') {
                          Severity: Minor
                          Found in pepiscms/application/models/Siteconfig_model.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 localizeDefinition has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function localizeDefinition(&$definition, TranslateableInterface $object)
                              {
                                  $this->load->model('Site_language_model');
                                  $languages = $this->Site_language_model->getLanguages();
                                  if (count($languages) == 1) {
                          Severity: Minor
                          Found in pepiscms/application/libraries/Localization.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 journalingPersistPreSave has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function journalingPersistPreSave($id, $data)
                              {
                                  if (!$id || !$this->getJournalingIsEnabled()) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in pepiscms/application/models/Generic_model.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

                          Severity
                          Category
                          Status
                          Source
                          Language