Function setup
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
setup: function() {
var ddTarget = this.config.target;
var ddTargetEl = this.config.targetEl;
var cfg = this.config;
- Read upRead up
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 modx.treedrop.js
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
Ext.dd.DragDropMgr.getZIndex = function(element) {
var body = document.body,
z,
zIndex = -1;
var overTargetEl = element;
Function setup
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup: function() {
var ddTarget = this.config.target;
var ddTargetEl = this.config.targetEl;
var cfg = this.config;
Function InsertElement
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
MODx.window.InsertElement = function(config) {
config = config || {};
var resourceCmp = Ext.get('modx-resource-id');
var resourceId = resourceCmp !== null ? resourceCmp.getValue() : 0;
Ext.applyIf(config,{
Function notifyDrop
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
,notifyDrop: function(ddSource, e, data) {
if (!data.node || !data.node.attributes || !data.node.attributes.type) return false;
if (data.node.attributes.type != 'modResource' && data.node.attributes.leaf != true) return false;
var v = '';
var win = false;
Function submit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
,submit: function() {
var v = '[[';
var n = this.config.record.name;
var f = this.fp.getForm();
- Read upRead up
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 submit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
,submit: function() {
var v = '[[';
var n = this.config.record.name;
var f = this.fp.getForm();
Avoid deeply nested control flow statements. Open
if (p) { p.markDirty(); }
Function insertForRTE
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
MODx.insertForRTE = function(v,cfg) {
var fn = cfg.onInsert || false;
if (fn) {
fn(v,cfg);
} else {
- Read upRead up
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 (v == pf.currentid) {
MODx.msg.alert('',_('resource_err_own_parent'));
return false;
}
Function insertAtCursor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
MODx.insertAtCursor = function(myField, myValue,h) {
if (!Ext.isEmpty(h)) {
var z = h(myValue);
if (z != undefined) {
myValue = z;
- Read upRead up
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 function. Open
return false;
Avoid too many return
statements within this function. Open
return true;