piotrpolak/pepiscms

View on GitHub

Showing 482 of 487 total issues

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

    function display_breadcrumb($breadcrumb_array, $icon = false)
    {
        $count = count($breadcrumb_array);

        $o = '';
Severity: Minor
Found in pepiscms/application/helpers/dialog_message_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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct()
    {
        // Getting cache path from configuration
        $path = $this->config->raw_item('cache_path');
        $this->is_enabled = $this->config->raw_item('cache_object_is_enabled');
Severity: Minor
Found in pepiscms/application/libraries/Cachedobjectmanager.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

Avoid deeply nested control flow statements.
Open

                            for ($i = 0; $i < 99; $i++) {
                                $keys[] = $i;
                            }
Severity: Major
Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

    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

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

          function google_maps_locate($address)
          {
              $url = 'http://maps.google.com/maps/api/geocode/json?address=' . urlencode($address) . '&components=country:PL&sensor=false';
              $contents = file_get_contents($url);
              if (!$contents) {
      Severity: Minor
      Found in pepiscms/application/helpers/google_maps_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_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

      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

      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

        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 getTranslatedValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getTranslatedValue(array $definition, $fieldKey, $suffix = '')
            {
        
                $translatedValue = false;
                if ($this->lang !== null) {
        Severity: Minor
        Found in pepiscms/application/classes/CrudFieldDefinitionBuilder.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 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 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

        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 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 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

        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 _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

          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