piotrpolak/pepiscms

View on GitHub

Showing 482 of 487 total issues

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

    public function library($library = '', $params = null, $object_name = null)
    {
        if (empty($library)) {
            return $this;
        } elseif (is_array($library)) {
Severity: Minor
Found in pepiscms/application/core/PEPISCMS_Loader.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 fix_missing_translation_files has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function fix_missing_translation_files()
    {
        $languages = array_keys($this->config->item('languages'));
        $modules = $this->Module_model->getInstalledModulesNames();

Severity: Minor
Found in pepiscms/modules/development/controllers/DevelopmentAdmin.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 revision has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function revision()
    {
        $id = $this->input->getParam('id');
        $revision_id = $this->input->getParam('revision_id');

Severity: Minor
Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 hasAccess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function hasAccess($controller, $method = false, $module = false)
    {
        if (!$method) {
            $method = 'index';
        }
Severity: Minor
Found in pepiscms/application/libraries/SecurityManager.php - About 1 hr to fix

    Method localizeDefinition has 31 lines of code (exceeds 25 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 1 hr to fix

      Function PageEditorUI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function PageEditorUI(translation_map) {
      
          var label_unsaved_changes = "All unsaved changes will be lost. Proceed?";
      
          this.init = function () {
      Severity: Minor
      Found in pepiscms/js/pageeditor.js - About 1 hr to fix

        Method drawSimpleColumnChart has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function drawSimpleColumnChart($data_feed, $collumn1_desc = '', $collumn2_desc = '', $width = 1200, $height = 200, $max_value = 10, $column1_data_type = "string", $column2_datatype = "number")
            {
                $id = $this->generateId('column_chart');
        
                $out = $this->includeJavaScripts();
        Severity: Minor
        Found in pepiscms/application/libraries/Google_chart_helper.php - About 1 hr to fix

          Method getBasicFeed has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getBasicFeed($extra_param)
              {
                  $data = array();
          
                  $pattern = '/\[(?P<datetime>.*)\] (?P<logger>\w+).(?P<level>\w+): (?P<message>.*[^ ]+) (?P<context>[^ ]+) (?P<extra>[^ ]+)/';
          Severity: Minor
          Found in pepiscms/modules/symfony2_bridge/models/Symfony2_log_model.php - About 1 hr to fix

            Method export has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function export()
                {
                    if (!$this->isExportable()) {
                        show_404();
                    }
            Severity: Minor
            Found in pepiscms/modules/crud/libraries/AdminCRUDController.php - About 1 hr to fix

              Method deletemenuelement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function deletemenuelement()
                  {
                      $item_id = $this->input->getParam('item_id');
              
                      $success = false;
              Severity: Minor
              Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

                Method menuedit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function menuedit()
                    {
                        $site_language = $this->getAttribute('site_language');
                        $item_id = $this->input->getParam('item_id');
                
                
                Severity: Minor
                Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

                  Method resetPasswordByUserId has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function resetPasswordByUserId($user_id)
                      {
                          // Reading user info
                          $user = $this->getById($user_id, 'user_email, display_name');
                          if (!$user) {
                  Severity: Minor
                  Found in pepiscms/application/models/User_model.php - About 1 hr to fix

                    Method saveById has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function saveById($id, $data)
                        {
                            foreach ($data as $_param_name => $_param_value) {
                                if (!in_array($_param_name, $this->getAcceptedPostFields())) {
                                    continue;
                    Severity: Minor
                    Found in pepiscms/application/models/Site_language_model.php - About 1 hr to fix

                      Method generateHandleFileUpload has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function generateHandleFileUpload(&$save_array)
                          {
                              if (count($this->file_upload_fields) == 0) {
                                  return;
                              }
                      Severity: Minor
                      Found in pepiscms/application/libraries/FormBuilder.php - About 1 hr to fix

                        Method getDistinctAssoc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getDistinctAssoc($column, $table = false, $pairs = false, $where_conditions = false)
                            {
                                if (!$table) {
                                    $table = $this->getTable();
                                }
                        Severity: Minor
                        Found in pepiscms/application/models/Generic_model.php - About 1 hr to fix

                          Method build has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function build($module_name, $policy_entries)
                              {
                                  $allowed_entity_accesses = array('NONE', 'READ', 'WRITE', 'FULL_CONTROL');
                          
                                  $doc = new DomDocument('1.0', 'UTF-8');
                          Severity: Minor
                          Found in pepiscms/application/libraries/SecurityPolicyBuilder.php - About 1 hr to fix

                            Method genericupload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function genericupload($current_path = '', $file_field_name = 'file')
                                {
                                    $make_filenames_nice = true;
                            
                                    $error = false;
                            Severity: Minor
                            Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 1 hr to fix

                              Method display_steps has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function display_steps($steps, $type)
                                  {
                                      $html = '';
                                      $html .= '<nav class="steps ' . $type . '">' . "\n";
                                      $i = 0;
                              Severity: Minor
                              Found in pepiscms/application/helpers/dialog_message_helper.php - About 1 hr to fix

                                Method admin_account has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function admin_account()
                                    {
                                        if ($this->get_installation_data('authentification_driver') != 'native') {
                                            redirect(admin_url() . 'installer/features');
                                        }
                                Severity: Minor
                                Found in pepiscms/application/controllers/admin/Installer.php - About 1 hr to fix

                                  Method register has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public function register($display_name, $user_email, $user_login = false, $password = false, $group_ids = array(), $is_root = false, $send_email_notification = true, $data = array(), $account_type = 0)
                                  Severity: Major
                                  Found in pepiscms/application/models/User_model.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language