piotrpolak/pepiscms

View on GitHub

Showing 482 of 487 total issues

Avoid deeply nested control flow statements.
Open

                            if ($normalize_keys) {
                                foreach ($keys as &$key) {
                                    $key = $this->normalizeKey($key);
                                }
                            }
Severity: Major
Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

    Method dashboard_box has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function dashboard_box($name, $url, $icon_path = false, $description = false, $is_popup = false, $target = false)
    Severity: Minor
    Found in pepiscms/application/helpers/dialog_message_helper.php - About 45 mins to fix

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

          private function renderInput($field, $value, &$object,
                                       \PiotrPolak\PepisCMS\Formbuilder\Component\ComponentInterface $component, $readOnly)
          {
              $extra_css_classes = $this->computeExtraCssClasses($field);
      
      
      Severity: Minor
      Found in pepiscms/application/classes/DefaultFormRenderer.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 addField has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function addField($field, $label = false, $type = false, $default_value = false, $rules = false, $values = false)
      Severity: Minor
      Found in pepiscms/application/libraries/FormBuilder.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (!$key) {
                                            $key = $ki;
                                        }
        Severity: Major
        Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

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

              private function transformDataFeed($data_feed)
              {
                  $final_data_feed = array();
                  if (isset($data_feed[0]) && is_array($data_feed[0])) {
                      foreach ($data_feed[0] as $key => $value) {
          Severity: Minor
          Found in pepiscms/application/libraries/Google_chart_helper.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 module_icon_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              function module_icon_url($module_name = false)
              {
                  $CI = get_instance();
                  if (!$module_name) {
                      if (isset($CI->modulerunner)) {
          Severity: Minor
          Found in pepiscms/application/helpers/PEPISCMS_url_helper.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 readDirectoryContents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function readDirectoryContents($directory = './')
              {
                  $files = array();
          
                  $dir = opendir($directory);
          Severity: Minor
          Found in pepiscms/application/libraries/CachedDirectoryReader.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 module_icon_small_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              function module_icon_small_url($module_name = false)
              {
                  $CI = get_instance();
                  if (!$module_name) {
                      if (isset($CI->modulerunner)) {
          Severity: Minor
          Found in pepiscms/application/helpers/PEPISCMS_url_helper.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 move has 6 arguments (exceeds 4 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');
          Severity: Minor
          Found in pepiscms/application/classes/MoveableInterface.php - About 45 mins to fix

            Method generateXML has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function generateXML($feed, $headers = false, $file_name = false, $send = true, $root_name = false, $item_name = false)
            Severity: Minor
            Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

              Method buildTranslations has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function buildTranslations($module_name, $translations, $module_label, $language_pairs, $directory, $module_name_lower_case)
              Severity: Minor
              Found in pepiscms/modules/development/libraries/ModuleGenerator.php - About 45 mins to fix

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

                    public function moduleLibrary($module_name, $library, $params = null)
                    {
                        if ($library == '') {
                            return false;
                        }
                Severity: Minor
                Found in pepiscms/application/core/PEPISCMS_Loader.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 line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function line($line = '', $default_value = null)
                    {
                        // Changed parameter order - might be problematic
                
                        if ($line == '' || !isset($this->language[$line])) {
                Severity: Minor
                Found in pepiscms/application/core/PEPISCMS_Lang.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function delete()
                    {
                        $id = $this->input->getParam('id');
                
                        if (!$id || !$this->is_deletable) {
                Severity: Minor
                Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 _datagrid_format_item_order_column has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function _datagrid_format_item_order_column($content, &$line)
                    {
                        $id_field_name = &$this->id_field_name;
                
                        $o = $this->datagrid->getOrder();
                Severity: Minor
                Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 getCurrentLanguage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getCurrentLanguage()
                    {
                        $CI = &get_instance();
                        $idiom = false;
                
                
                Severity: Minor
                Found in pepiscms/application/core/PEPISCMS_Lang.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 getModuleTranslationKeys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getModuleTranslationKeys($module, $languages = false, $language_file = false)
                    {
                        $language_file = $this->ensureLanguageFileIsSet($module, $language_file);
                
                        if (!$languages) {
                Severity: Minor
                Found in pepiscms/modules/translator/libraries/LanguageHelper.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 formatCells has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function formatCells($menu, $level, &$lang, &$url_suffix, $site_language, $view)
                Severity: Minor
                Found in pepiscms/modules/pages/views/admin/index.php - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                  <?php if ((SecurityManager::hasAccess('utilities', 'flush_html_cache') || SecurityManager::hasAccess('utilities', 'flush_security_policy_cache') || SecurityManager::hasAccess('utilities', 'flush_system_cache') || SecurityManager::hasAccess('acl') || SecurityManager::hasAccess('logs') || SecurityManager::hasAccess('utilities', 'systeminfo'))): ?>
                  
                          <h1 class="contrasted"><?= $lang->line('utilities_label_cache') ?></h1>
                          <ul class="dashboard_actions clear">
                  
                  
                  Severity: Major
                  Found in pepiscms/application/views/admin/utilities_index.php - About 40 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language