piotrpolak/pepiscms

View on GitHub

Showing 486 of 487 total issues

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

    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

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

          private function buildSubmenuUrl($module, $item, $language_code)
          {
              if (!$module->name) {
                  $submenu_url = admin_url() . $item[self::PROP_CONTROLLER] . '/';
              } elseif (isset($item[self::PROP_MODULE]) && $item[self::PROP_MODULE]) {
      Severity: Minor
      Found in pepiscms/application/libraries/MenuRendor.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 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

            Severity
            Category
            Status
            Source
            Language