Showing 905 of 905 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
function isASCIIAlpha(c) {
return ((c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||
(c >= CharCodes.UpperA && c <= CharCodes.UpperZ));
}
- 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 56.
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 2 locations. Consider refactoring. Open
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar(true);
chunkStart = this.pos;
} else if (isNewLine(ch)) {
- 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 56.
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
Function error
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
parser.prototype.error = function(expect) {
var msg = 'Parse Error : syntax error';
token = this.getTokenName(this.token);
if (this.token !== this.EOF) {
if (isNumber(this.token)) {
Function read_trait
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
,read_trait: function(flag) {
var result = this.node('trait'),
propName = null,
propExtends = null,
propImplements = null,
Function <
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
'<': function() {
var nchar = this._input[this.offset];
if (nchar === '<') {
nchar = this._input[this.offset + 1];
if (nchar === '=') {
Function read
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
Function normalize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalize(plugins) {
let normalized = []
for (let i of plugins) {
if (i.postcss === true) {
i = i()
Function getProxyProcessor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getProxyProcessor() {
return {
get(node, prop) {
if (prop === 'proxyOf') {
return node
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(processor, css, opts) {
css = css.toString()
this.stringified = false
this._processor = processor
Function parseFunction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
this.initFunction(node);
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
{ this.unexpected(); }
Function regexp_classSetExpression
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
pp$1.regexp_classSetExpression = function(state) {
var result = CharSetOk, subResult;
if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
if (subResult === CharSetString) { result = CharSetString; }
// https://tc39.es/ecma262/#prod-ClassIntersection
Function _createListEntry
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function _createListEntry(name, args, vis, level, isClass, isStatic, line, ch) {
Function _createListEntry
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function _createListEntry(name, type, isPrivate, isStatic, isRegion, args, line, ch) {
Consider simplifying this complex logical expression. Open
if (
escape &&
code !== SLASH &&
code !== SPACE &&
code !== NEWLINE &&
Consider simplifying this complex logical expression. Open
if (!this.htmlMode || this.options.recognizeCDATA) {
(_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);
(_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
(_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
}
Function parsePropertyValue
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
Consider simplifying this complex logical expression. Open
if ((match[1] || match[2]) === "use strict") {
skipWhiteSpace.lastIndex = start + match[0].length;
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
var next = this.input.charAt(end);
return next === ";" || next === "}" ||
Consider simplifying this complex logical expression. Open
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
var isConstructor = !node.static && checkKeyName(node, "constructor");
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
Consider simplifying this complex logical expression. Open
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
(next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
return i + 1
}
Consider simplifying this complex logical expression. Open
if (isExpression) {
node.body = this.parseMaybeAssign(forInit);
node.expression = true;
this.checkParams(node, false);
} else {