Showing 1,982 of 1,982 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.state.inParameters) {
this.raise(node.start, Errors.AwaitExpressionFormalParameter);
} else if (this.state.awaitPos === -1) {
this.state.awaitPos = node.start;
}
- 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 76.
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
Program(path: NodePath) {
path.get("body").forEach(bodyPath => {
if (isPolyfillSource(getRequireSource(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
- 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 76.
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
enter(path: NodePath) {
path.get("body").forEach(bodyPath => {
if (isPolyfillSource(getRequireSource(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
- 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 76.
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 createTemplateBuilder
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createTemplateBuilder<T>(
formatter: Formatter<T>,
defaultOpts?: TemplateOpts,
): TemplateBuilder<T> {
const templateFnCache = new WeakMap();
Function removeTypeDuplicates
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function removeTypeDuplicates(
nodes: Array<Object>,
): Array<Object> {
const generics = {};
const bases = {};
Function getMarkerLines
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMarkerLines(
loc: NodeLocation,
source: Array<string>,
opts: Object,
): { start: number, end: number, markerLines: Object } {
Function buildResult
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildResult(fileResults: Array<Object>): CompilationOutput {
const map = new sourceMap.SourceMapGenerator({
file:
cliOptions.sourceMapTarget ||
path.basename(cliOptions.outFile || "") ||
Function replaceExpressionWithStatements
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function replaceExpressionWithStatements(nodes: Array<Object>) {
this.resync();
const toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
Function splitExportDeclaration
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration()) {
throw new Error("Only export declarations can be splitted.");
}
Function UnaryExpression
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
UnaryExpression(path) {
const { node, parent } = path;
if (node.operator !== "typeof") return;
if (
Consider simplifying this complex logical expression. Open
if (
// for (MEMBER of ARR)
// for (MEMBER in ARR)
parentPath.isForXStatement({ left: node }) ||
// { KEY: MEMBER } = OBJ
Function getTargets
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getTargets(
inputTargets: InputTargets = {},
options: Object = {},
): Targets {
const targetOpts: Targets = {};
Function gatherSequenceExpressions
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function gatherSequenceExpressions(
nodes: Array<Object>,
scope: Scope,
declars: Array<Object>,
): ?Object {
Consider simplifying this complex logical expression. Open
if (
nodeType === "Literal" ||
"StringLiteral" === nodeType ||
"NumericLiteral" === nodeType ||
"NullLiteral" === nodeType ||
Function ForOfStatement
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
ForOfStatement(path, state) {
const right = path.get("right");
if (
right.isArrayExpression() ||
right.isGenericType("Array") ||
Consider simplifying this complex logical expression. Open
if (parentPath.isMemberExpression({ object: node })) {
const grandparentPath = parentPath.parentPath;
const argsOptEligible =
!state.deopted &&
Function ReferencedIdentifier
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReferencedIdentifier(path, state) {
const { node } = path;
// we can't guarantee the purity of arguments
if (node.name === "arguments") {
Function insertAfter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function insertAfter(nodes) {
this._assertUnremoved();
nodes = this._verifyNodeList(nodes);
Function MetaProperty
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
MetaProperty(path) {
const meta = path.get("meta");
const property = path.get("property");
const { scope } = path;
Similar blocks of code found in 2 locations. Consider refactoring. Open
export type EstreeProperty = NodeBase & {
type: "Property",
shorthand: boolean,
key: Expression,
computed: boolean,
- 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 75.
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