symphonycms/symphony-2

View on GitHub

Showing 714 of 844 total issues

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

    protected static function renderText($e)
    {
        $message = $e->getMessage() . ($e->getPrevious()
            ? PHP_EOL . __('Previous exception: ') . $e->getPrevious()->getMessage()
            : '');
Severity: Minor
Found in symphony/lib/core/class.exceptionrenderer.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 convertToXML has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function convertToXML($json, $standalone = true)
    {
        self::$dom = new DOMDocument('1.0', 'utf-8');
        self::$dom->formatOutput = true;

Severity: Minor
Found in symphony/lib/toolkit/class.json.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 (is_array($fields) && !empty($fields)) {
                            foreach ($fields as $position => $data) {
                                if (isset($data['id'])) {
                                    $id_list[] = (int)$data['id'];
                                }
Severity: Major
Found in symphony/content/content.blueprintssections.php - About 45 mins to fix

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

        public static function buildTableHeaders($columns, $sort, $order, $extra_url_params = null)
        {
            $aTableHead = array();
    
            foreach ($columns as $c) {
    Severity: Minor
    Found in symphony/content/class.sortable.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 (!empty($id_list)) {
                                $missing_cfs->where(['id' => ['not in' => $id_list]]);
                            }
    Severity: Major
    Found in symphony/content/content.blueprintssections.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if ($newField) {
                                      $field->set('id', false);
                                  }
      Severity: Major
      Found in symphony/content/content.blueprintssections.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (!empty($entry_ids)) {
                                        $pagination->entries($entry_ids);
                                    }
        Severity: Major
        Found in symphony/content/content.publish.php - About 45 mins to fix

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

              public function __actionEdit()
              {
                  if (array_key_exists('save', $_POST['action'])) {
                      return $this->__formAction();
                  } elseif (array_key_exists('delete', $_POST['action'])) {
          Severity: Minor
          Found in symphony/content/content.blueprintsevents.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 (is_array($missing_cfs) && !empty($missing_cfs)) {
                                      foreach ($missing_cfs as $id) {
                                          FieldManager::delete($id);
                                      }
                                  }
          Severity: Major
          Found in symphony/content/content.blueprintssections.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ($field_id) {
                                            if ($newField) {
                                                /**
                                                 * After creation of a Field.
                                                 *
            Severity: Major
            Found in symphony/content/content.blueprintssections.php - About 45 mins to fix

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

                  public function parseContext(array &$context, array $parts)
                  {
                      if (isset($parts[1])) {
                          if ($parts[1] === 'retrieve-password') {
                              $context['action'] = $parts[1];
              Severity: Minor
              Found in symphony/content/content.login.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

              Consider simplifying this complex logical expression.
              Open

                                  if(
                                      (context.top >= 0 && context.top <= windowHeight) || // Element top in sight
                                      (context.bottom >= 0 && context.bottom <= windowHeight) || // Element bottom in sight
                                      (context.top <= 0 && context.bottom >= windowHeight) // Element overflowing viewport
                                  ) {
              Severity: Major
              Found in symphony/assets/js/src/symphony.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (path && route) {
                            var contextId = (path + route).split('/').filter(function(part) {
                                return (part != 'edit' && part != 'new' && part != 'created' && part != 'saved' && part != '');
                            }).join('.');
                            Symphony.Context.add('context-id', contextId);
                Severity: Major
                Found in symphony/assets/js/src/backend.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if (
                                  ($file == '.' || $file === '..')
                                  || ($ignore_hidden && $file{0} === '.')
                                  || in_array($file, $exclude)
                                  || in_array("$dir/$file", $exclude)
                  Severity: Major
                  Found in symphony/lib/toolkit/class.general.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (!isset($item_limit) || $item_limit === 'author') {
                                $can_access = true;
                            } elseif ($item_limit === 'developer' && Symphony::Author()->isDeveloper()) {
                                $can_access = true;
                            } elseif ($item_limit === 'manager' && (Symphony::Author()->isManager() || Symphony::Author()->isDeveloper())) {
                    Severity: Major
                    Found in symphony/lib/toolkit/class.administrationpage.php - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                  if (48 <= $ascii && $ascii <= 57 || 65 <= $ascii && $ascii <= 90 || 97 <= $ascii && $ascii <= 122) {
                                      $replace_length = 1;
                                      $replace_char = $char;
                      
                                      // Encode space as underscore (means better readability for humans)
                      Severity: Major
                      Found in symphony/lib/toolkit/class.emailhelper.php - About 40 mins to fix

                        Method displayDatasourceFilterPanel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = null, $errors = null, $fieldnamePrefix = null, $fieldnamePostfix = null)
                        Severity: Minor
                        Found in symphony/lib/toolkit/class.field.php - About 35 mins to fix

                          Method buildValidationSelect has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function buildValidationSelect(XMLElement &$wrapper, $selected = null, $name = 'fields[validator]', $type = 'input', array $errors = null)
                          Severity: Minor
                          Found in symphony/lib/toolkit/class.field.php - About 35 mins to fix

                            Method processRawFieldData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null)
                            Severity: Minor
                            Found in symphony/lib/toolkit/class.field.php - About 35 mins to fix

                              Method appendFormattedElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null)
                              Severity: Minor
                              Found in symphony/lib/toolkit/class.field.php - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language