kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

Function send has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  send: function (data, callback, scope, options) {
    var pid;
    var addPayload = options || {};

    if (data.postId) {
Severity: Minor
Found in js/src/common/Ajax.js - 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 init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function init()
    {
        if (is_admin()) {
            $postType = $this->environment->getPostType();
            if (function_exists('get_current_screen')) {
Severity: Minor
Found in core/Panels/PostPanel.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 parseOverrides has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseOverrides($overrides)
    {
        $whitelist = array('name', 'loggedinonly', 'wrapperclasses');

        foreach ($overrides as $key => $value) {
Severity: Minor
Found in core/Modules/ModuleProperties.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 getTemplatesforContext has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTemplatesforContext(ModuleContext $context)
    {
        $collection = array();
        $collection += $this->getSingles($this->views);
        $areaContext = $context->areaContext;
Severity: Minor
Found in core/Modules/ModuleViewFilesystem.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 get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function get($key, $default = null, $group = null)
    {
        $value = $default;

        $isPrivate = false;
Severity: Minor
Found in core/Common/Data/ValueObject.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 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($echo)
    {
        $concater = ConcatContent::getInstance();
        if (!$this->validate()) {
            return false;
Severity: Minor
Found in core/Frontend/Renderer/AreaRenderer.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 initialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initialize: function () {
    // Setup Elements
    this.open = false;
    if (this.model.get('globalModule') === true) {
      this.open = true;
Severity: Minor
Found in js/src/backend/Views/ModuleView.js - About 1 hr to fix

    Method setupSettings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function setupSettings($file, $classname)
        {
    
            $args = Module::getDefaultSettings();
            if (property_exists($classname, 'settings')) {
    Severity: Minor
    Found in core/Modules/ModuleRegistry.php - About 1 hr to fix

      Function MediaWorkflow has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      KB.Utils.MediaWorkflow = function (args) {
        var _frame, options;
      
        var defaults = {
          buttontext: 'Buttontext',
      Severity: Minor
      Found in js/src/common/MediaWorkflow.js - About 1 hr to fix

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

            geocode: function(query, cb, context) {
              var params = this.options.geocodingQueryParams;
              if (
                params.proximity !== undefined &&
                params.proximity.lat !== undefined &&
        Severity: Minor
        Found in js/third-party/leaflet.js - About 1 hr to fix

          Method filterForPost has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function filterForPost(PostEnvironment $environment)
              {
          
                  $pageTemplate = $environment->getPageTemplate();
                  $postType = $environment->getPostType();
          Severity: Minor
          Found in core/Areas/AreaRegistry.php - About 1 hr to fix

            Function ViewsCollection has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            KB.ViewsCollection = function () {
              this.views = {};
              this.lastViewAdded = null;
              this.add = function (id, view) {
                if (!this.views[id]) {
            Severity: Minor
            Found in js/src/shared/ViewsCollection.js - About 1 hr to fix

              Method action has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected static function action(Request $request)
                  {
                      $delete = false;
                      $data = $request->request->get('data');
                      $target = filter_var($data['targetPid'], FILTER_SANITIZE_NUMBER_INT);
              Severity: Minor
              Found in core/Ajax/Actions/HandleClipboard.php - About 1 hr to fix

                Function factorNewItem has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  factorNewItem: function (data, obj) {
                    var uid = obj['_meta'].uid || null;
                    var title = obj['_meta'].title || null;
                    var type = obj['_meta'].type;
                    var status = obj['_meta'].status || 'visible';
                Severity: Minor
                Found in js/src/fields/controls/flexfields/FlexFieldsFactory.js - About 1 hr to fix

                  Function _keydown has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _keydown: function(e) {
                        var _this = this,
                          select = function select(dir) {
                            if (_this._selection) {
                              L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected');
                  Severity: Minor
                  Found in js/third-party/leaflet.js - About 1 hr to fix

                    Method getCoreActions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getCoreActions()
                        {
                            return apply_filters(
                                'kb.ajax.core.actions',
                                array(
                    Severity: Minor
                    Found in core/Ajax/AjaxCallbackHandler.php - About 1 hr to fix

                      Method addField has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function addField($type, $key, $args = array())
                          {
                      
                              if (is_string($key) && empty($key)) {
                                  return $this;
                      Severity: Minor
                      Found in core/Fields/StandardFieldSection.php - About 1 hr to fix

                        Function getFieldData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          getFieldData: function (type, moduleId, key, arrayKey) {
                            var typeData;
                            if (this._typeExists(type)) {
                              typeData = KB.payload.fieldData[type];
                              // no data for module id
                        Severity: Minor
                        Found in js/src/common/Payload.js - 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 addByFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addByFile($file)
                            {
                                include_once $file;
                                $classname = str_replace('.php', '', basename($file));
                                $modelArg = '';
                        Severity: Minor
                        Found in core/Panels/PanelRegistry.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 saveModules has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function saveModules($modules)
                            {
                        
                                /** @var \Kontentblocks\Modules\Module $module */
                                foreach ($modules as $module) {
                        Severity: Minor
                        Found in core/Backend/Environment/Save/SaveRevision.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

                        Severity
                        Category
                        Status
                        Source
                        Language