Showing 1,229 of 1,229 total issues
Avoid deeply nested control flow statements. Open
if (opts[methodName]) {
throw new Error(methodName + ' method can be called just once per query');
} else {
opts[methodName] = args; //we shall add it to the options, this object will be used when reiterating on LQ
}
Avoid deeply nested control flow statements. Open
if (tree.dep[j].to === tree.ids[i].id) {
// console.log(" + ", tree.dep[j]);
_up.push(j);
}
Function redTree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function redTree() {
var _ids = [];
for (var j = 0; j < this.dep.length; j++) {
var index = undefined;
- 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 ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
Function extractUp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function extractUp(tree, id) {
var _n = {};
var __n = {};
var _d = {};
- 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 (_handlers[event][j].handler !== handler)
a.push(_handlers[event][j]);
Avoid deeply nested control flow statements. Open
if (typeof v1[i] === 'function')
_addJob(i, __extend({
job: v1[i]
}, v2));
else
Function post
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function post(msg) {
function postMsg(type, body, ctx) {
var msg = MSG[type].flx.call(ctx, body);
- 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 (_parameters.history) {
job.status = 'done';
_doneJobs.push(job);
}
Avoid deeply nested control flow statements. Open
if (this._handlers[event][j].handler !== handler)
a.push(this._handlers[event][j]);
Avoid deeply nested control flow statements. Open
if (n.size > selected[j].size) {
selected.splice(j, 0, n);
inserted = true;
break;
}
Avoid deeply nested control flow statements. Open
for (k3 in this.allNeighborsIndex[k1][k2])
if (!localEdgesIndex[k3]) {
localEdgesIndex[k3] = true;
graph.edges.push(this.edgesIndex[k3]);
}
Avoid deeply nested control flow statements. Open
if (typeof job.end === 'function')
job.end();
Avoid deeply nested control flow statements. Open
for (var k = 0; k < graphParts.length; k++) {
for (var m = 0; m < graphParts[i].names.length; m++) { var name = graphParts[i].names[m];
if (name === graphParts[k].to) {
console.log(name + " === " + graphParts[k].to)
graphParts[k].index = m;
Avoid deeply nested control flow statements. Open
for (i2 = 0; i2 < i1; i2++)
if ((n2 = nodes[i2]).fa2)
Repulsion.apply_nn(n1, n2);
Function enter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
enter: function(n, c) {
// TODO this is bad design
var _c = {id: ""};
map(n.callee, _getId(_c));
- 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 (this.settings('verbose'))
console.log(
'Warning: The renderer "' +
a[i].id +
'" crashed on ".render()"'
Function ASCIIgraph
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function ASCIIgraph(name, mean, median, min, max, length) {
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (i === edges.length)
self.state = {
step: 4,
index: 0
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
return tree.nodes.some(function(node) {
return dep.id === node.id || dep.to === node.to
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76