Showing 1,982 of 1,982 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
prop(superMember) {
const { property } = superMember.node;
if (this.memoiser.has(property)) {
return t.cloneNode(this.memoiser.get(property));
}
- 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 79.
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
receiver(member) {
const { object } = member.node;
if (this.memoiser.has(object)) {
return t.cloneNode(this.memoiser.get(object));
- 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 79.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else {
this.scope.enter(SCOPE_TS_MODULE);
this.prodParam.enter(PARAM);
node.body = this.tsParseModuleBlock();
this.prodParam.exit();
- 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 79.
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
Referencer
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Referencer extends OriginalReferencer {
// inherits.
visitPattern(node, options, callback) {
if (!node) {
return;
Function tsParseNonArrayType
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
tsParseNonArrayType(): N.TsType {
switch (this.state.type) {
case tt.name:
case tt._void:
case tt._null: {
Function parseObjectMember
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseObjectMember(
isPattern: boolean,
refExpressionErrors?: ?ExpressionErrors,
): N.ObjectMember | N.SpreadElement | N.RestElement {
let decorators = [];
Function CallExpression
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
CallExpression(path) {
if (!injectCoreJS) return;
const { node } = path;
const { callee } = node;
Function enter
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
enter(path) {
if (!injectCoreJS) return;
if (!path.isReferenced()) return;
// skip transforming `delete something.includes`
if (path.parentPath.isUnaryExpression({ operator: "delete" })) return;
File xhtml.js
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
const entities: { [name: string]: string } = {
quot: "\u0022",
amp: "&",
File import-injector.js
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import assert from "assert";
import * as t from "@babel/types";
import ImportBuilder from "./import-builder";
import isModule from "./is-module";
Function Class
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Class(path) {
const { node } = path;
let comments = [];
if (node.typeParameters) {
const typeParameters = path.get("typeParameters");
Function plainFunction
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function plainFunction(path: NodePath, callId: Object) {
const node = path.node;
const isDeclaration = path.isFunctionDeclaration();
const functionId = node.id;
const wrapper = isDeclaration
Function flowParseDeclareExportDeclaration
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
flowParseDeclareExportDeclaration(
node: N.FlowDeclareExportDeclaration,
insideModule: ?boolean,
): N.FlowDeclareExportDeclaration {
this.expect(tt._export);
Function enableFeature
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function enableFeature(file, feature, loose) {
// We can't blindly enable the feature because, if it was already set,
// "loose" can't be changed, so that
// @babel/plugin-class-properties { loose: true }
// @babel/plugin-class-properties { loose: false }
Function walk
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function walk(filenames: Array<string>): Promise<void> {
const _filenames = [];
filenames.forEach(function (filename) {
if (!fs.existsSync(filename)) return;
Function readConfigJS
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const readConfigJS = makeStrongCache(function* readConfigJS(
filepath: string,
cache: CacheConfigurator<{
envName: string,
caller: CallerMetadata | void,
Function isPure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
isPure(node, constantsOnly?: boolean) {
if (t.isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (!binding) return false;
if (constantsOnly) return binding.constant;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (context[context.length - 1] === ct.j_oTag) {
context.length -= 2;
} else if (context[context.length - 1] === ct.j_expr) {
context.length -= 1;
}
- 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 77.
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 (context[context.length - 1] === tc.j_oTag) {
context.length -= 2;
} else if (context[context.length - 1] === tc.j_expr) {
context.length -= 1;
}
- 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 77.
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 removeTypeDuplicates
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export default function removeTypeDuplicates(
nodes: Array<Object>,
): Array<Object> {
const generics = {};
const bases = {};
- 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"