Showing 905 of 905 total issues
Avoid deeply nested control flow statements. Open
if (what.loc && what.value[0].loc) {
what.loc.start = what.value[0].loc.start;
}
Function checkInt
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function checkInt (buf, value, offset, ext, max, min) {
Function write
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
Function checkIEEE754
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function checkIEEE754 (buf, value, offset, ext, max, min) {
Avoid deeply nested control flow statements. Open
if (separators.includes(letter)) split = true
Avoid deeply nested control flow statements. Open
if (prev) {
node.source.end = this.getPosition(prev[3] || prev[2])
}
Avoid deeply nested control flow statements. Open
if (type === ';') {
if (colon) {
this.decl(tokens, customProperty)
return
} else {
Avoid deeply nested control flow statements. Open
while (prev && prev[0] === 'space') {
prev = params[--shift]
}
Avoid deeply nested control flow statements. Open
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
Avoid deeply nested control flow statements. Open
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
Avoid deeply nested control flow statements. Open
if (typeof plugin[event] === 'object') {
for (let filter in plugin[event]) {
if (filter === '*') {
add(plugin, event, plugin[event][filter])
} else {
Avoid deeply nested control flow statements. Open
} else if (type === brackets[brackets.length - 1]) {
brackets.pop()
if (brackets.length === 0) bracket = null
}
Avoid deeply nested control flow statements. Open
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
Avoid deeply nested control flow statements. Open
if ((units -= 3) < 0) break
Avoid deeply nested control flow statements. Open
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
Avoid deeply nested control flow statements. Open
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
Avoid deeply nested control flow statements. Open
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
Avoid deeply nested control flow statements. Open
if (str.trim().indexOf('!') === 0 && type !== 'space') {
break
}
Avoid deeply nested control flow statements. Open
if (ignore || ignoreUnclosed) {
next = pos
break
} else {
unclosed('bracket')
Similar blocks of code found in 3 locations. Consider refactoring. Open
(_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);
- 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