Showing 1,982 of 1,982 total issues

Function constructExportCall has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function constructExportCall(
  path,
  exportIdent,
  exportNames,
  exportValues,
Severity: Major
Found in packages/babel-plugin-transform-modules-systemjs/src/index.js - About 2 hrs to fix

    Function parseMaybeUnary has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      parseMaybeUnary(refExpressionErrors: ?ExpressionErrors): N.Expression {
        if (this.isContextual("await") && this.isAwaitAllowed()) {
          return this.parseAwait();
        } else if (this.state.type.prefix) {
          const node = this.startNode();
    Severity: Minor
    Found in packages/babel-parser/src/parser/expression.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 checkDeclaration has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      checkDeclaration(node: N.Pattern | N.ObjectProperty): void {
        if (node.type === "Identifier") {
          this.checkDuplicateExports(node, node.name);
        } else if (node.type === "ObjectPattern") {
          for (const prop of node.properties) {
    Severity: Minor
    Found in packages/babel-parser/src/parser/statement.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 finishCallExpression has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      finishCallExpression<T: N.CallExpression | N.OptionalCallExpression>(
        node: T,
        optional: boolean,
      ): N.Expression {
        if (node.callee.type === "Import") {
    Severity: Minor
    Found in packages/babel-parser/src/parser/expression.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 parseVar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      parseVar(
        node: N.VariableDeclaration,
        isFor: boolean,
        kind: "var" | "let" | "const",
      ): N.VariableDeclaration {
    Severity: Minor
    Found in packages/babel-parser/src/parser/statement.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 getConditionalAnnotation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    function getConditionalAnnotation(binding, path, name) {
      const ifStatement = getParentConditionalPath(binding, path, name);
      if (!ifStatement) return;
    
      const test = ifStatement.get("test");
    Severity: Minor
    Found in packages/babel-traverse/src/path/inference/inferer-reference.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 insertAfter has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    export function insertAfter(nodes) {
      this._assertUnremoved();
    
      nodes = this._verifyNodeList(nodes);
    
    
    Severity: Minor
    Found in packages/babel-traverse/src/path/modification.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 BreakStatement|ContinueStatement|ReturnStatement has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      "BreakStatement|ContinueStatement|ReturnStatement"(path, state) {
        const { node, scope } = path;
        if (node[this.LOOP_IGNORE]) return;
    
        let replace;
    Severity: Minor
    Found in packages/babel-plugin-transform-block-scoping/src/index.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

    File parentheses.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as t from "@babel/types";
    
    const PRECEDENCE = {
      "||": 0,
      "??": 0,
    Severity: Minor
    Found in packages/babel-generator/src/node/parentheses.js - About 2 hrs to fix

      Function readTmplToken has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        readTmplToken(): void {
          let out = "",
            chunkStart = this.state.pos,
            containsInvalid = false;
          for (;;) {
      Severity: Major
      Found in packages/babel-parser/src/tokenizer/index.js - About 2 hrs to fix

        Function isExpression has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function isExpression(node: ?Object, opts?: Object): boolean {
          if (!node) return false;
        
          const nodeType = node.type;
          if (
        Severity: Major
        Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix

          Function getLetReferences has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getLetReferences() {
              const block = this.block;
          
              let declarators = [];
          
          
          Severity: Major
          Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 2 hrs to fix

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

                    path.get("body").forEach(bodyPath => {
                      const source = getRequireSource(bodyPath);
                      if (!source) return;
                      if (isBabelPolyfillSource(source)) {
                        console.warn(BABEL_POLYFILL_DEPRECATION);
            packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js on lines 67..78

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

            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 (this.eat(tt.question)) {
                    if (param.type !== "Identifier") {
                      this.raise(param.start, FlowErrors.OptionalBindingPattern);
                    }
            
            
            Severity: Major
            Found in packages/babel-parser/src/plugins/flow.js and 1 other location - About 2 hrs to fix
            packages/babel-parser/src/plugins/typescript/index.js on lines 2450..2456

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

            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 (this.eat(tt.question)) {
                    if (param.type !== "Identifier") {
                      this.raise(param.start, TSErrors.PatternIsOptional);
                    }
            
            
            Severity: Major
            Found in packages/babel-parser/src/plugins/typescript/index.js and 1 other location - About 2 hrs to fix
            packages/babel-parser/src/plugins/flow.js on lines 2395..2401

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

            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

                ImportDeclaration(path: NodePath) {
                  const source = getImportSource(path);
                  if (!source) return;
                  if (isBabelPolyfillSource(source)) {
                    console.warn(BABEL_POLYFILL_DEPRECATION);
            packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js on lines 81..92

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

            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

            File analyze-scope.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { types as t } from "@babel/core";
            import escope from "eslint-scope";
            import { Definition } from "eslint-scope/lib/definition";
            import OriginalPatternVisitor from "eslint-scope/lib/pattern-visitor";
            import OriginalReferencer from "eslint-scope/lib/referencer";
            Severity: Minor
            Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 2 hrs to fix

              Function defineType has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function defineType(
                type: string,
                opts: {
                  fields?: {
                    [string]: FieldOptions,
              Severity: Major
              Found in packages/babel-types/src/definitions/utils.js - About 2 hrs to fix

                Function replaceWith has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function replaceWith(replacement) {
                  this.resync();
                
                  if (this.removed) {
                    throw new Error("You can't replace this node, we've already removed it");
                Severity: Major
                Found in packages/babel-traverse/src/path/replacement.js - About 2 hrs to fix

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

                        if (exportNames.length > 0) {
                          const statement = t.expressionStatement(
                            buildBindingExportAssignmentExpression(
                              metadata,
                              exportNames,
                  packages/babel-helper-module-transforms/src/rewrite-live-references.js on lines 94..105

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language