Showing 1,982 of 1,982 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
getBlockParent() {
let scope = this;
do {
if (scope.path.isBlockParent()) {
return scope;
- 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 62.
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 (isPattern) {
this.next();
// Don't use parseRestBinding() as we only allow Identifier here.
prop.argument = this.parseIdentifier();
this.checkCommaAfterRest(charCodes.rightCurlyBrace);
- 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 62.
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
getProgramParent() {
let scope = this;
do {
if (scope.path.isProgram()) {
return scope;
- 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 62.
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
Consider simplifying this complex logical expression. Open
} else if (
prevType.beforeExpr &&
prevType !== tt.semi &&
prevType !== tt._else &&
!(
Consider simplifying this complex logical expression. Open
if (
nodeType === "UserWhitespacable" ||
"ObjectMethod" === nodeType ||
"ObjectProperty" === nodeType ||
"ObjectTypeInternalSlot" === nodeType ||
Consider simplifying this complex logical expression. Open
if (
// If the current active position is forced, we only want to reactivate
// the old position if it is different from the newest position.
(!this._sourcePosition.force ||
this._sourcePosition.line !== originalLine ||
Consider simplifying this complex logical expression. Open
if (
(str === "--" && this.endsWith("!")) ||
// Need spaces for operators of the same kind to avoid: `a+++b`
(str[0] === "+" && this.endsWith("+")) ||
(str[0] === "-" && this.endsWith("-")) ||
Function buildBrowserInit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildBrowserInit(
browserGlobals,
exactGlobals,
filename,
moduleName,
Function resolveId
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
resolveId(importee) {
if (importee === "@babel/runtime/regenerator") {
return path.join(
dirname,
"packages",
Function translateEnumValues
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function translateEnumValues(path, t) {
const seen: PreviousEnumMembers = Object.create(null);
// Start at -1 so the first enum member is its increment, 0.
let prev: number | typeof undefined = -1;
return path.node.members.map(member => {
Function isAssignable
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
isAssignable(node: N.Node, isBinding?: boolean): boolean {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
Function parseForIn
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseForIn(
node: N.ForInOf,
init: N.VariableDeclaration | N.AssignmentPattern,
awaitAt: number,
): N.ForInOf {
Function parseBlockOrModuleBlockBody
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseBlockOrModuleBlockBody(
body: N.Statement[],
directives: ?(N.Directive[]),
topLevel: boolean,
end: TokenType,
Function ForOfStatement|ForInStatement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
"ForOfStatement|ForInStatement"(path) {
const { scope, node } = path;
const { left } = node;
const { exported, scope: programScope } = this;
Function toAssignableList
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
toAssignableList(
exprList: Expression[],
trailingCommaPos?: ?number,
): $ReadOnlyArray<Pattern> {
let end = exprList.length;
Function removeTypeDuplicates
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function removeTypeDuplicates(
nodes: Array<Object>,
): Array<Object> {
const generics = {};
const bases = {};
Function _printComment
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
_printComment(comment, skipNewLines?: boolean) {
if (!this.format.shouldPrintComment(comment.value)) return;
// Some plugins use this to mark comments as removed using the AST-root 'comments' property,
// where they can't manually mutate the AST node comment lists.
Function assertVersion
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function assertVersion(range: string | number): void {
if (typeof range === "number") {
if (!Number.isInteger(range)) {
throw new Error("Expected string or integer value.");
}
Function makeCachedFunction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeCachedFunction<ArgT, ResultT, SideChannel, Cache: *>(
CallCache: Class<Cache>,
handler: (ArgT, CacheConfigurator<SideChannel>) => Handler<ResultT> | ResultT,
): (ArgT, SideChannel) => Handler<ResultT> {
const callCacheSync = new CallCache();
Function BreakStatement|ContinueStatement|ReturnStatement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
"BreakStatement|ContinueStatement|ReturnStatement"(path, state) {
const { node, scope } = path;
if (node[this.LOOP_IGNORE]) return;
let replace;