kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Function setupViewModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setupViewModel($forcenew = false)
    {
        if (!is_null($this->frontendModel)) {
            if ($forcenew === false) {
                return $this->frontendModel;
Severity: Minor
Found in core/Panels/AbstractPanel.php - About 35 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 prepareModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareModel()
    {
        $savedData = $this->model->export();
        if ($this->fields) {
            $data = array();
Severity: Minor
Found in core/Panels/OptionPanel.php - About 35 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 prepareModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareModel()
    {
        $savedData = $this->model->export();
        if ($this->fields) {
            $data = array();
Severity: Minor
Found in core/Panels/TermPanel.php - About 35 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 markVisibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function markVisibility(Field $field)
    {

        $field->setVisibility(true);
        $postType = $this->entity->context->get('postType');
Severity: Minor
Found in core/Fields/PostPanelFieldSection.php - About 35 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 collectToForms has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function collectToForms()
    {
        $coll = $this->collectAllFields();

        foreach ($coll as $field) {
Severity: Minor
Found in core/Fields/StandardFieldController.php - About 35 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 setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setValue( $data )
    {
        $forJSON = null;
        if (!empty( $data['images'] ) && is_array( $data['images'] )) {
            foreach ($data['images'] as &$image) {
Severity: Minor
Found in core/Fields/Definitions/Gallery.php - About 35 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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function save($data, $oldData)
    {
        // if this field is not present in the current $_POST array
        // check if old data exists and return that if it is valid
        // else set the value of the checkbox to false instead of null
Severity: Minor
Found in core/Fields/Definitions/Checkbox.php - About 35 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 _save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function _save($data, $oldData)
    {
        $collect = array();
        /** @var Field $field */
        foreach ($this->fields as $field) {
Severity: Minor
Found in core/Fields/FieldSubGroup.php - About 35 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 uploadFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function uploadFilter($file)
    {

        $dimensions = filter_input(INPUT_POST, 'mindimension', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);

Severity: Minor
Found in core/Fields/Definitions/Image.php - About 35 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 too many return statements within this method.
Open

            return new PanelRegistry();
Severity: Major
Found in kontentblocks.php - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return typeData[moduleId][key];
    Severity: Major
    Found in js/src/common/Payload.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in core/Modules/ModuleValidator.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return new EditScreenLayoutsRegistry();
        Severity: Major
        Found in kontentblocks.php - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return []
          Severity: Major
          Found in js/src/common/Payload.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return [];
            Severity: Major
            Found in js/src/common/Payload.js - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return true;
              Severity: Major
              Found in core/Backend/Dynamic/DynamicAreas.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in core/Backend/Environment/Save/SavePost.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return false;
                  Severity: Major
                  Found in core/Backend/Dynamic/GlobalModulesMenu.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return false;
                    Severity: Major
                    Found in core/Backend/Dynamic/DynamicAreas.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return false;
                      Severity: Major
                      Found in core/Utils/ImageResize.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language