modxcms/revolution

View on GitHub

Showing 4,334 of 7,873 total issues

Function resolve has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve(& $transport, & $object, $options = array ()) {
        $resolved = false;
        if (isset ($this->payload['resolve'])) {
            foreach ($this->payload['resolve'] as $rKey => $r) {
                $type = $r['type'];
Severity: Minor
Found in core/xpdo/transport/xpdovehicle.class.php - About 1 day 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 TV has 364 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MODx.panel.TV = function(config) {
    config = config || {};
    config.record = config.record || {};
    config = MODx.setStaticElementsConfig(config, 'tv');
    Ext.applyIf(config,{
Severity: Major
Found in manager/assets/modext/widgets/element/modx.panel.tv.js - About 1 day to fix

    Smarty_Internal_Templatelexer has 93 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Smarty_Internal_Templatelexer
    {
        const TEXT               = 1;
        const TAG                = 2;
        const TAGBODY            = 3;
    Severity: Major
    Found in core/model/smarty/sysplugins/smarty_internal_templatelexer.php - About 1 day to fix

      Function decode has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
      Open

          function decode($str)
          {
              $str = $this->reduce_string($str);
      
              switch (strtolower($str)) {
      Severity: Minor
      Found in core/xpdo/json/JSON.php - About 1 day 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

      Method parseTree has 351 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parseTree($n, $noBlockGrouping = false)
          {
              $s = '';
      
              switch ($n->type)
      Severity: Major
      Found in manager/min/lib/JSMinPlus.php - About 1 day to fix

        Function makeUrl has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
        Open

            public function makeUrl($id, $args = '', $scheme = -1, array $options = array()) {
                $url = '';
                $found = false;
                if ($id= intval($id)) {
                    if ($this->config === null) {
        Severity: Minor
        Found in core/model/modx/modcontext.class.php - About 1 day 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 diff has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
        Open

            function diff($text1, $text2) {
                $array1= $this->_split($text1);
                $array2= $this->_split($text2);
        
                /* Build up array with the line as key and a list of line numbers as value */
        Severity: Minor
        Found in core/xpdo/revision/xpdorevisioncontrol.class.php - About 1 day 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 Event has 343 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Ext.lib.Event = function() {
            var loadComplete = false,
                listeners = [],
                unloadListeners = [],
                retryCount = 0,
        Severity: Major
        Found in setup/assets/js/ext-core-debug.js - About 1 day to fix

          Function authenticate has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
          Open

              public function authenticate($bucket, $opt = null, $location = null, $redirects = 0, $nothing = null)
              {
                  /*
                   * Overriding or extending this class? You can pass the following "magic" keys into $opt.
                   *
          Severity: Minor
          Found in core/model/aws/services/s3.class.php - About 1 day 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

          xPDO has 89 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class xPDO {
              /**#@+
               * Constants
               */
              const OPT_AUTO_CREATE_TABLES = 'auto_create_tables';
          Severity: Major
          Found in core/xpdo/xpdo.class.php - About 1 day to fix

            Function setupSources has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
            Open

                public function setupSources($options) {
                    // filter controller options
                    $cOptions = array_merge(
                        array(
                            'allowDirs' => '//'
            Severity: Minor
            Found in manager/min/lib/Minify/Controller/MinApp.php - About 1 day 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 84 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get($chunksize = 1000)
                {
                    while($this->lookahead)
                    {
                        $this->lookahead--;
            Severity: Minor
            Found in manager/min/lib/JSMinPlus.php - About 1 day 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

            File package.browser.panels.js has 723 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * The package browser home card
             *
             * @class MODx.panel.PackageBrowserHome
             * @extends MODx.TemplatePanel
            Severity: Major
            Found in manager/assets/modext/workspace/package.browser.panels.js - About 1 day to fix

              modX has 88 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class modX extends xPDO {
                  /**
                   * The parameter for when a session state is not able to be accessed
                   * @const SESSION_STATE_UNAVAILABLE
                   */
              Severity: Major
              Found in core/model/modx/modx.class.php - About 1 day to fix

                Function onGridRender has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                Open

                Ext.namespace('Ext.ux.dd');Ext.ux.dd.GridDragDropRowOrder=Ext.extend(Ext.util.Observable,{copy:false,scrollable:false,constructor:function(config){if(config)Ext.apply(this,config);this.addEvents({beforerowmove:true,afterrowmove:true,beforerowcopy:true,afterrowcopy:true});Ext.ux.dd.GridDragDropRowOrder.superclass.constructor.call(this)},init:function(grid){this.grid=grid;grid.enableDragDrop=true;grid.on({render:{fn:this.onGridRender,scope:this,single:true}})},onGridRender:function(grid){var self=this;this.target=new Ext.dd.DropTarget(grid.getEl(),{ddGroup:grid.ddGroup||'GridDD',grid:grid,gridDropTarget:this,notifyDrop:function(dd,e,data){if(this.currentRowEl){this.currentRowEl.removeClass('grid-row-insert-below');this.currentRowEl.removeClass('grid-row-insert-above')}var t=Ext.lib.Event.getTarget(e);var rindex=this.grid.getView().findRowIndex(t);if(rindex===false||rindex==data.rowIndex){return false}if(this.gridDropTarget.fireEvent(self.copy?'beforerowcopy':'beforerowmove',this.gridDropTarget,data.rowIndex,rindex,data.selections,123)===false){return false}var ds=this.grid.getStore();var selections=new Array();var keys=ds.data.keys;for(var key in keys){for(var i=0;i<data.selections.length;i++){if(keys[key]==data.selections[i].id){if(rindex==key){return false}selections.push(data.selections[i])}}}if(rindex>data.rowIndex&&this.rowPosition<0){rindex--}if(rindex<data.rowIndex&&this.rowPosition>0){rindex++}if(rindex>data.rowIndex&&data.selections.length>1){rindex=rindex-(data.selections.length-1)}if(rindex==data.rowIndex){return false}if(!self.copy){for(var i=0;i<data.selections.length;i++){ds.remove(ds.getById(data.selections[i].id))}}for(var i=selections.length-1;i>=0;i--){var insertIndex=rindex;ds.insert(insertIndex,selections[i])}var sm=this.grid.getSelectionModel();if(sm){sm.selectRecords(data.selections)}this.gridDropTarget.fireEvent(self.copy?'afterrowcopy':'afterrowmove',this.gridDropTarget,data.rowIndex,rindex,data.selections);return true},notifyOver:function(dd,e,data){var t=Ext.lib.Event.getTarget(e);var rindex=this.grid.getView().findRowIndex(t);var ds=this.grid.getStore();var keys=ds.data.keys;for(var key in keys){for(var i=0;i<data.selections.length;i++){if(keys[key]==data.selections[i].id){if(rindex==key){if(this.currentRowEl){this.currentRowEl.removeClass('grid-row-insert-below');this.currentRowEl.removeClass('grid-row-insert-above')}return this.dropNotAllowed}}}}if(rindex<0||rindex===false){this.currentRowEl.removeClass('grid-row-insert-above');return this.dropNotAllowed}try{var currentRow=this.grid.getView().getRow(rindex);var resolvedRow=new Ext.Element(currentRow).getY()-this.grid.getView().scroller.dom.scrollTop;var rowHeight=currentRow.offsetHeight;this.rowPosition=e.getPageY()-resolvedRow-(rowHeight/2);if(this.currentRowEl){this.currentRowEl.removeClass('grid-row-insert-below');this.currentRowEl.removeClass('grid-row-insert-above')}if(this.rowPosition>0){this.currentRowEl=new Ext.Element(currentRow);this.currentRowEl.addClass('grid-row-insert-below')}else{if(rindex-1>=0){var previousRow=this.grid.getView().getRow(rindex-1);this.currentRowEl=new Ext.Element(previousRow);this.currentRowEl.addClass('grid-row-insert-below')}else{this.currentRowEl.addClass('grid-row-insert-above')}}}catch(err){console.warn(err);rindex=false}return(rindex===false)?this.dropNotAllowed:this.dropAllowed},notifyOut:function(dd,e,data){if(this.currentRowEl){this.currentRowEl.removeClass('grid-row-insert-above');this.currentRowEl.removeClass('grid-row-insert-below')}}});if(this.targetCfg){Ext.apply(this.target,this.targetCfg)}if(this.scrollable){Ext.dd.ScrollManager.register(grid.getView().getEditorParent());grid.on({beforedestroy:this.onBeforeDestroy,scope:this,single:true})}},getTarget:function(){return this.target},getGrid:function(){return this.grid},getCopy:function(){return this.copy?true:false},setCopy:function(b){this.copy=b?true:false},onBeforeDestroy:function(grid){Ext.dd.ScrollManager.unregister(grid.getView().getEditorParent())}});
                Severity: Minor
                Found in manager/assets/modext/util/utilities.js - About 1 day 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 WatermarkText has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color='000000', $ttffont='', $opacity=100, $margin=5, $angle=0, $bg_color=false, $bg_opacity=0, $fillextend='', $lineheight=1.0) {
                        // text watermark requested
                        if (!$text) {
                            return false;
                        }
                Severity: Minor
                Found in core/model/phpthumb/phpthumb.filters.php - About 1 day 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

                Method process has 331 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function process() {
                        $charsets = array(
                            array(
                                'value' => 'ASMO-708',
                                'text' => 'Arabic (ASMO 708) - ASMO-708',
                Severity: Major
                Found in core/model/modx/processors/system/charset/getlist.class.php - About 1 day to fix

                  File SMTP.php has 718 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * PHPMailer RFC821 SMTP email transport class.
                   * PHP Version 5.5.
                  Severity: Major
                  Found in core/model/modx/mail/phpmailer/src/SMTP.php - About 1 day to fix

                    File xpdocachemanager.class.php has 713 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /*
                     * Copyright 2010-2015 by MODX, LLC.
                     *
                     * This file is part of xPDO.
                    Severity: Major
                    Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 day to fix

                      Function _initSession has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function _initSession($options = null) {
                              $contextKey= $this->context instanceof modContext ? $this->context->get('key') : null;
                              if ($this->getOption('session_enabled', $options, true) || isset($_GET['preview'])) {
                                  if (!in_array($this->getSessionState(), array(modX::SESSION_STATE_INITIALIZED, modX::SESSION_STATE_EXTERNAL, modX::SESSION_STATE_UNAVAILABLE), true)) {
                                      $sh = false;
                      Severity: Minor
                      Found in core/model/modx/modx.class.php - About 1 day 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