packages/babel-generator/src/generators/flow.js

Summary

Maintainability
F
4 days
Test Coverage

File flow.js has 543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as t from "@babel/types";
import { ExportAllDeclaration } from "./modules";

export function AnyTypeAnnotation() {
  this.word("any");
Severity: Major
Found in packages/babel-generator/src/generators/flow.js - About 1 day to fix

    Function ObjectTypeAnnotation has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    export function ObjectTypeAnnotation(node: Object) {
      if (node.exact) {
        this.token("{|");
      } else {
        this.token("{");
    Severity: Minor
    Found in packages/babel-generator/src/generators/flow.js - About 2 hrs to fix

    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"

    Further reading

    Function ObjectTypeAnnotation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function ObjectTypeAnnotation(node: Object) {
      if (node.exact) {
        this.token("{|");
      } else {
        this.token("{");
    Severity: Minor
    Found in packages/babel-generator/src/generators/flow.js - About 1 hr to fix

      Function FlowExportDeclaration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function FlowExportDeclaration(node: Object) {
        if (node.declaration) {
          const declar = node.declaration;
          this.print(declar, node);
          if (!t.isStatement(declar)) this.semicolon();
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js - About 45 mins to fix

      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"

      Further reading

      Function FunctionTypeAnnotation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function FunctionTypeAnnotation(node: Object, parent: Object) {
        this.print(node.typeParameters, node);
        this.token("(");
        this.printList(node.params, node);
      
      
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js - About 35 mins to fix

      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"

      Further reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        if (node.mixins && node.mixins.length) {
          this.space();
          this.word("mixins");
          this.space();
          this.printList(node.mixins, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/flow.js on lines 319..324
      packages/babel-generator/src/generators/flow.js on lines 353..358

      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 70.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        if (node.extends && node.extends.length) {
          this.space();
          this.word("extends");
          this.space();
          this.printList(node.extends, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/flow.js on lines 313..318
      packages/babel-generator/src/generators/flow.js on lines 319..324

      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 70.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        if (node.implements && node.implements.length) {
          this.space();
          this.word("implements");
          this.space();
          this.printList(node.implements, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/flow.js on lines 313..318
      packages/babel-generator/src/generators/flow.js on lines 353..358

      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 70.

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function TypeAnnotation(node) {
        this.token(":");
        this.space();
        if (node.optional) this.token("?");
        this.print(node.typeAnnotation, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 1 other location - About 1 hr to fix
      packages/babel-generator/src/generators/typescript.js on lines 1..6

      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 68.

      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

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      export function QualifiedTypeIdentifier(node: Object) {
        this.print(node.qualification, node);
        this.token(".");
        this.print(node.id, node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 4 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/expressions.js on lines 224..228
      packages/babel-generator/src/generators/expressions.js on lines 257..261
      packages/babel-generator/src/generators/jsx.js on lines 13..17
      packages/babel-generator/src/generators/jsx.js on lines 19..23

      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 61.

      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

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

        if (node.default) {
          this.space();
          this.token("=");
          this.space();
          this.print(node.default, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 10 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/classes.js on lines 41..46
      packages/babel-generator/src/generators/classes.js on lines 94..99
      packages/babel-generator/src/generators/classes.js on lines 110..115
      packages/babel-generator/src/generators/flow.js on lines 237..242
      packages/babel-generator/src/generators/flow.js on lines 465..470
      packages/babel-generator/src/generators/modules.js on lines 129..134
      packages/babel-generator/src/generators/statements.js on lines 163..168
      packages/babel-generator/src/generators/statements.js on lines 295..300
      packages/babel-generator/src/generators/typescript.js on lines 19..24
      packages/babel-generator/src/generators/typescript.js on lines 26..31

      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 58.

      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

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

          if (node.source) {
            this.space();
            this.word("from");
            this.space();
            this.print(node.source, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 10 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/classes.js on lines 41..46
      packages/babel-generator/src/generators/classes.js on lines 94..99
      packages/babel-generator/src/generators/classes.js on lines 110..115
      packages/babel-generator/src/generators/flow.js on lines 445..450
      packages/babel-generator/src/generators/flow.js on lines 465..470
      packages/babel-generator/src/generators/modules.js on lines 129..134
      packages/babel-generator/src/generators/statements.js on lines 163..168
      packages/babel-generator/src/generators/statements.js on lines 295..300
      packages/babel-generator/src/generators/typescript.js on lines 19..24
      packages/babel-generator/src/generators/typescript.js on lines 26..31

      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 58.

      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

      Further Reading

      Similar blocks of code found in 11 locations. Consider refactoring.
      Open

        if (node.impltype) {
          this.space();
          this.token("=");
          this.space();
          this.print(node.impltype, node);
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 10 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/classes.js on lines 41..46
      packages/babel-generator/src/generators/classes.js on lines 94..99
      packages/babel-generator/src/generators/classes.js on lines 110..115
      packages/babel-generator/src/generators/flow.js on lines 237..242
      packages/babel-generator/src/generators/flow.js on lines 445..450
      packages/babel-generator/src/generators/modules.js on lines 129..134
      packages/babel-generator/src/generators/statements.js on lines 163..168
      packages/babel-generator/src/generators/statements.js on lines 295..300
      packages/babel-generator/src/generators/typescript.js on lines 19..24
      packages/babel-generator/src/generators/typescript.js on lines 26..31

      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 58.

      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

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      export function TupleTypeAnnotation(node: Object) {
        this.token("[");
        this.printList(node.types, node);
        this.token("]");
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 3 other locations - About 1 hr to fix
      packages/babel-generator/src/generators/expressions.js on lines 27..31
      packages/babel-generator/src/generators/jsx.js on lines 32..36
      packages/babel-generator/src/generators/jsx.js on lines 89..93

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function TypeParameterInstantiation(node): void {
        this.token("<");
        this.printList(node.params, node, {});
        this.token(">");
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 1 other location - About 1 hr to fix
      packages/babel-generator/src/generators/typescript.js on lines 8..12

      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

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function TypeofTypeAnnotation(node: Object) {
        this.word("typeof");
        this.space();
        this.print(node.argument, node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 1 other location - About 1 hr to fix
      packages/babel-generator/src/generators/expressions.js on lines 21..25

      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 55.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        if (node.kind === "get" || node.kind === "set") {
          this.word(node.kind);
          this.space();
        }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 50 mins to fix
      packages/babel-generator/src/generators/modules.js on lines 4..7
      packages/babel-generator/src/generators/modules.js on lines 144..147

      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 52.

      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

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        if (node.declaration) {
          const declar = node.declaration;
          this.print(declar, node);
          if (!t.isStatement(declar)) this.semicolon();
        } else {
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js and 1 other location - About 50 mins to fix
      packages/babel-generator/src/generators/modules.js on lines 88..137

      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 51.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function InterfaceDeclaration(node: Object) {
        this.word("interface");
        this.space();
        this._interfaceish(node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 45 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 67..71
      packages/babel-generator/src/generators/flow.js on lines 92..96

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function DeclareTypeAlias(node: Object) {
        this.word("declare");
        this.space();
        this.TypeAlias(node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 45 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 67..71
      packages/babel-generator/src/generators/flow.js on lines 339..343

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function DeclareInterface(node: Object) {
        this.word("declare");
        this.space();
        this.InterfaceDeclaration(node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 45 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 92..96
      packages/babel-generator/src/generators/flow.js on lines 339..343

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function EnumStringBody(node: Object) {
        const { explicitType } = node;
        enumExplicitType(this, "string", explicitType);
        enumBody(this, node);
      }
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 40 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 172..176
      packages/babel-generator/src/generators/flow.js on lines 178..182

      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 48.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function EnumBooleanBody(node: Object) {
        const { explicitType } = node;
        enumExplicitType(this, "boolean", explicitType);
        enumBody(this, node);
      }
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 40 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 178..182
      packages/babel-generator/src/generators/flow.js on lines 184..188

      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 48.

      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

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      export function EnumNumberBody(node: Object) {
        const { explicitType } = node;
        enumExplicitType(this, "number", explicitType);
        enumBody(this, node);
      }
      Severity: Minor
      Found in packages/babel-generator/src/generators/flow.js and 2 other locations - About 40 mins to fix
      packages/babel-generator/src/generators/flow.js on lines 172..176
      packages/babel-generator/src/generators/flow.js on lines 184..188

      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 48.

      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

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      export function NullableTypeAnnotation(node: Object) {
        this.token("?");
        this.print(node.typeAnnotation, node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 3 other locations - About 30 mins to fix
      packages/babel-generator/src/generators/expressions.js on lines 263..266
      packages/babel-generator/src/generators/flow.js on lines 592..595
      packages/babel-generator/src/generators/types.js on lines 14..17

      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 45.

      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

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      export function ObjectTypeSpreadProperty(node: Object) {
        this.token("...");
        this.print(node.argument, node);
      }
      Severity: Major
      Found in packages/babel-generator/src/generators/flow.js and 3 other locations - About 30 mins to fix
      packages/babel-generator/src/generators/expressions.js on lines 263..266
      packages/babel-generator/src/generators/flow.js on lines 375..378
      packages/babel-generator/src/generators/types.js on lines 14..17

      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 45.

      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

      Further Reading

      There are no issues that match your filters.

      Category
      Status