Showing 1,982 of 1,982 total issues

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

export default function getBindingIdentifiers(
  node: Object,
  duplicates?: boolean,
  outerOnly?: boolean,
): { [string]: Object | Array<Object> } {
Severity: Minor
Found in packages/babel-types/src/retrievers/getBindingIdentifiers.js - About 1 hr to fix

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

    function extractElementDescriptor(/* this: File, */ classRef, superRef, path) {
      const { node, scope } = path;
      const isMethod = path.isClassMethod();
    
      if (path.isPrivate()) {

      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

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

        export function JSXSpreadChild(node: Object) {
          this.token("{");
          this.token("...");
          this.print(node.expression, node);
          this.token("}");
        Severity: Major
        Found in packages/babel-generator/src/generators/jsx.js and 1 other location - About 1 hr to fix
        packages/babel-generator/src/generators/jsx.js on lines 25..30

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

        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

          if (isGetter) {
            privateNamesMap.set(prop.node.key.id.name, {
              ...privateName,
              getterDeclared: true,
            });
        packages/babel-helper-create-class-features-plugin/src/fields.js on lines 594..602

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

        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 JSXSpreadAttribute(node: Object) {
          this.token("{");
          this.token("...");
          this.print(node.argument, node);
          this.token("}");
        Severity: Major
        Found in packages/babel-generator/src/generators/jsx.js and 1 other location - About 1 hr to fix
        packages/babel-generator/src/generators/jsx.js on lines 38..43

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

        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

          if (isSetter) {
            privateNamesMap.set(prop.node.key.id.name, {
              ...privateName,
              setterDeclared: true,
            });
        packages/babel-helper-create-class-features-plugin/src/fields.js on lines 585..593

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

        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

        Function create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          create(context) {
            return {
              CallExpression(node) {
                const { callee } = node;
                const scope = context.getScope();

        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 push has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function push(
          mutatorMap: Object,
          node: Object,
          kind: string,
          file,
        Severity: Minor
        Found in packages/babel-helper-define-map/src/index.js - About 1 hr 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 parseObj has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          parseObj<T: N.ObjectPattern | N.ObjectExpression>(
            close: TokenType,
            isPattern: boolean,
            isRecord?: ?boolean,
            refExpressionErrors?: ?ExpressionErrors,
        Severity: Minor
        Found in packages/babel-parser/src/parser/expression.js - About 1 hr 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 parseLabeledStatement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          parseLabeledStatement(
            node: N.LabeledStatement,
            maybeName: string,
            expr: N.Identifier,
            context: ?string,
        Severity: Minor
        Found in packages/babel-parser/src/parser/statement.js - About 1 hr 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 parseBlockOrModuleBlockBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          parseBlockOrModuleBlockBody(
            body: N.Statement[],
            directives: ?(N.Directive[]),
            topLevel: boolean,
            end: TokenType,
        Severity: Minor
        Found in packages/babel-parser/src/parser/statement.js - About 1 hr 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 validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function validate(opts: mixed): TemplateOpts {
          if (opts != null && typeof opts !== "object") {
            throw new Error("Unknown template options.");
          }
        
        
        Severity: Minor
        Found in packages/babel-template/src/options.js - About 1 hr 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 matchesPattern has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function matchesPattern(
          member: Object,
          match: string | Array<string>,
          allowPartial?: boolean,
        ): boolean {
        Severity: Minor
        Found in packages/babel-types/src/validators/matchesPattern.js - About 1 hr 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 ForOfStatement|ForInStatement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          "ForOfStatement|ForInStatement"(path) {
            const { scope, node } = path;
            const { left } = node;
            const { exported, scope: programScope } = this;
        
        

        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 expandAliases has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function expandAliases(obj) {
          const newObj = {};
        
          function add(type, func) {
            const fn = newObj[type];
        Severity: Minor
        Found in packages/babel-generator/src/node/index.js - About 1 hr 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 mergeSourceMap has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function mergeSourceMap(
          inputMap: SourceMap,
          map: SourceMap,
        ): SourceMap {
          const input = buildMappingData(inputMap);
        Severity: Minor
        Found in packages/babel-core/src/transformation/file/merge-map.js - About 1 hr 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 generateRegexpuOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function generateRegexpuOptions(node, features) {
          let useUnicodeFlag = false,
            dotAllFlag = false,
            unicodePropertyEscape = false,
            namedGroup = false;
        Severity: Minor
        Found in packages/babel-helper-create-regexp-features-plugin/src/util.js - About 1 hr 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 _maybeAddParen has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          _maybeAddParen(str: string): void {
            // see startTerminatorless() instance method
            const parenPushNewlineState = this._parenPushNewlineState;
            if (!parenPushNewlineState) return;
        
        
        Severity: Minor
        Found in packages/babel-generator/src/printer.js - About 1 hr 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 isFirstInStatement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function isFirstInStatement(
          printStack: Array<Object>,
          { considerArrow = false, considerDefaultExports = false } = {},
        ): boolean {
          let i = printStack.length - 1;
        Severity: Minor
        Found in packages/babel-generator/src/node/parentheses.js - About 1 hr 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

        Severity
        Category
        Status
        Source
        Language