kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Function prepareFromModule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function prepareFromModule()
    {
        /** @var \Kontentblocks\Modules\Module $fModule */
        $fModule = new $this->moduleattrs['class']( $this->getPropertiesObject(), null, $this->environment );
        if (!$fModule->fields && !method_exists( $this->module, 'defaultData' )) {
Severity: Minor
Found in core/Modules/ModuleWorkshop.php - About 1 hr 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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($echo = false)
    {
        $concater = ConcatContent::getInstance();

        if (!is_null($this->path)) {
Severity: Minor
Found in core/Utils/CommonTwig/SimpleView.php - About 1 hr 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 createOrGetFieldDataArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function createOrGetFieldDataArray($modid, $type, $key, $arrayKey = null)
    {


        if (!isset($this->fieldData[$type])) {
Severity: Minor
Found in core/Utils/JSONTransport.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function save($new, $old)
    {
        $new = array_values($new);
        if (is_array($new) && is_array($old)) {
            $nc = count($new);
Severity: Minor
Found in core/Fields/Definitions/DateMultiple.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function save($new, $old)
    {
        if (is_array($new) && is_array($old)) {
            $nc = count($new);
            $oc = count($old);
Severity: Minor
Found in core/Fields/Definitions/TextMultiple.php - About 1 hr 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 evaluateGroupKey has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function evaluateGroupKey($args, &$key)
    {
        //check for special key syntax like group::key
        if (preg_match("/^(.*?)::/i", $key, $out)) {
            if (is_array($out) && count($out) == 2) {
Severity: Minor
Found in core/Fields/StandardFieldSection.php - About 1 hr 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 prepareAttachment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function prepareAttachment($att)
    {
        $attachment = null;

        if ((is_string($att) && is_numeric($att)) || is_int($att)) {
Severity: Minor
Found in core/Fields/Returnobjects/Utilities/ImageObjectDeprecated.php - About 1 hr 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 recalibrate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  recalibrate: function () {
    var winH,
      conH,
      position,
      winDiff;
Severity: Minor
Found in js/src/frontend/Views/EditModalModules.js - About 1 hr to fix

    Function sync has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      sync: function (context) {
        var that = this;
        KB.Events.trigger('field.before.sync', this.model);
    
        var clone = that.toJSON();
    Severity: Minor
    Found in js/src/fields/FieldControlModel.js - About 1 hr to fix

      Function createModule has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        createModule: function (module) {
          var Area, data;
          // check if capability is right for this action
          if (Checks.userCan('create_kontentblocks')) {
          } else {
      Severity: Minor
      Found in js/src/shared/ModuleBrowser/ModuleBrowserController.js - About 1 hr to fix

        Function bindHandlers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            bindHandlers: function () {
              var handlers, checkCounts;
        
              media.view.MediaFrame.Select.prototype.bindHandlers.apply(this, arguments);
        
        
        Severity: Minor
        Found in js/src/wpMediaExt/KB.media.Gallery.js - About 1 hr to fix

          Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            init: function () {
              var that = this;
              var $body = $('body');
              // init general ui components
              this.initTabs();
          Severity: Minor
          Found in js/src/common/UI.js - About 1 hr to fix

            Method prepareFormValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function prepareFormValue($val)
                {
                    if (is_numeric($val)) {
                        return filter_var($val, FILTER_SANITIZE_NUMBER_INT);
                    } else if (is_string($val)) {
            Severity: Minor
            Found in core/Fields/Definitions/Select.php - About 1 hr to fix

              Method markVisibility has 27 lines of code (exceeds 25 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 1 hr to fix

                Method resize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function resize($args = array())
                    {
                        if ($this->isSVG) {
                            $this->src = $this->attachment['url'];
                            return $this;
                Severity: Minor
                Found in core/Fields/Definitions/ReturnObjects/ImageReturn.php - About 1 hr to fix

                  Method setupMediaElements has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function setupMediaElements()
                      {
                          $images = [];
                          foreach ($this->value['images'] as $k => $attId) {
                              if (is_numeric($attId['id'])) {
                  Severity: Minor
                  Found in core/Fields/Definitions/ReturnObjects/GalleryExtReturn.php - About 1 hr to fix

                    Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render: function () {
                        // append wrapper element
                        this.ModuleView.$el.append(tplModuleControls({
                          model: this.ModuleView.model.toJSON(),
                          i18n: KB.i18n.jsFrontend
                    Severity: Minor
                    Found in js/src/frontend/Views/ModuleControls/ModuleControls.js - About 1 hr to fix

                      Function geocode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            geocode: function(query, cb, context) {
                              getJSON(
                                this.options.serviceUrl + '/address',
                                {
                                  key: this._key,
                      Severity: Minor
                      Found in js/third-party/leaflet-geocoder.js - About 1 hr to fix

                        Function create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          create: function (ui) {
                            var Area, data, module;
                            // check if capability is right for this action
                            if (Checks.userCan('create_kontentblocks')) {
                            } else {
                        Severity: Minor
                        Found in js/src/frontend/Views/Sidebar/AreaDetails/ModuleDragItem.js - About 1 hr to fix

                          Function geocode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              geocode: function(query, cb, context) {
                                getJSON(
                                  this.options.serviceUrl + '/address',
                                  {
                                    key: this._key,
                          Severity: Minor
                          Found in js/third-party/leaflet.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language