Showing 1,982 of 1,982 total issues

Function default has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

export default async function ({
  cliOptions,
  babelOptions,
}: CmdOptions): Promise<void> {
  const filenames = cliOptions.filenames;
Severity: Minor
Found in packages/babel-cli/src/babel/dir.js - About 7 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 flow.js has 487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
import defineType, {
  arrayOfType,
  assertOneOf,
  assertValueType,
Severity: Minor
Found in packages/babel-types/src/definitions/flow.js - About 7 hrs to fix

    Function handle has 192 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      handle(member) {
        const { node, parent, parentPath } = member;
    
        if (member.isOptionalMemberExpression()) {
          // Transforming optional chaining requires we replace ancestors.
    Severity: Major
    Found in packages/babel-helper-member-expression-to-functions/src/index.js - About 7 hrs to fix

      File conversion.js has 484 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // This file contains methods that convert the path node into another node or some other type of data.
      
      import * as t from "@babel/types";
      import nameFunction from "@babel/helper-function-name";
      
      
      Severity: Minor
      Found in packages/babel-traverse/src/path/conversion.js - About 7 hrs to fix

        File index.js has 481 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @flow
        
        import * as charCodes from "charcodes";
        
        import XHTMLEntities from "./xhtml";
        Severity: Minor
        Found in packages/babel-parser/src/plugins/jsx/index.js - About 7 hrs to fix

          File index.js has 473 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { declare } from "@babel/helper-plugin-utils";
          import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
          import { types as t } from "@babel/core";
          import { convertFunctionParams } from "@babel/plugin-transform-parameters";
          
          
          Severity: Minor
          Found in packages/babel-plugin-proposal-object-rest-spread/src/index.js - About 7 hrs to fix

            Scope has 52 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class Scope {
              /**
               * This searches the current "scope" and collects all references/bindings
               * within.
               */
            Severity: Major
            Found in packages/babel-traverse/src/scope/index.js - About 7 hrs to fix

              Function run has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

              function run(task) {
                const {
                  actual,
                  expect: expected,
                  exec,
              Severity: Minor
              Found in packages/babel-helper-transform-fixture-test-runner/src/index.js - About 7 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

              Consider simplifying this complex logical expression.
              Open

                if (
                  nodeType === "FlowType" ||
                  "AnyTypeAnnotation" === nodeType ||
                  "ArrayTypeAnnotation" === nodeType ||
                  "BooleanTypeAnnotation" === nodeType ||
              Severity: Critical
              Found in packages/babel-types/src/validators/generated/index.js - About 7 hrs to fix

                File typescript.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // @flow
                import defineType, {
                  arrayOfType,
                  assertEach,
                  assertNodeType,
                Severity: Minor
                Found in packages/babel-types/src/definitions/typescript.js - About 7 hrs to fix

                  Function pushTask has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function pushTask(taskName, taskDir, suite, suiteName) {
                    const taskDirStats = fs.statSync(taskDir);
                    let actualLoc = findFile(taskDir + "/input");
                    let execLoc = findFile(taskDir + "/exec");
                  
                  
                  Severity: Minor
                  Found in packages/babel-helper-fixtures/src/index.js - About 6 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 parseStatementContent has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                  Open

                    parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement {
                      let starttype = this.state.type;
                      const node = this.startNode();
                      let kind;
                  
                  
                  Severity: Minor
                  Found in packages/babel-parser/src/parser/statement.js - About 6 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 parseExprAtom has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                  Open

                    parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression {
                      // If a division operator appears in an expression position, the
                      // tokenizer got confused, and we force it to read a regexp instead.
                      if (this.state.type === tt.slash) this.readRegexp();
                  
                  
                  Severity: Minor
                  Found in packages/babel-parser/src/parser/expression.js - About 6 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

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

                        case charCodes.leftSquareBracket:
                          if (
                            this.hasPlugin("recordAndTuple") &&
                            this.input.charCodeAt(this.state.pos + 1) === charCodes.verticalBar
                          ) {
                  Severity: Major
                  Found in packages/babel-parser/src/tokenizer/index.js and 1 other location - About 6 hrs to fix
                  packages/babel-parser/src/tokenizer/index.js on lines 765..784

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

                  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

                        case charCodes.leftCurlyBrace:
                          if (
                            this.hasPlugin("recordAndTuple") &&
                            this.input.charCodeAt(this.state.pos + 1) === charCodes.verticalBar
                          ) {
                  Severity: Major
                  Found in packages/babel-parser/src/tokenizer/index.js and 1 other location - About 6 hrs to fix
                  packages/babel-parser/src/tokenizer/index.js on lines 741..760

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

                  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

                      BuiltIns: {
                        Symbol: { stable: true, path: "symbol" },
                        Promise: { stable: true, path: "promise" },
                        Map: { stable: true, path: "map" },
                        WeakMap: { stable: true, path: "weak-map" },
                  packages/babel-plugin-transform-runtime/src/runtime-corejs3-definitions.js on lines 74..85

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

                  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

                    function makeTrace(fileNameIdentifier, lineNumber, column0Based) {
                      const fileLineLiteral =
                        lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral();
                  
                      const fileColumnLiteral =
                  packages/babel-plugin-transform-react-jsx-source/src/index.js on lines 24..48

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

                  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

                        Number: {
                          EPSILON: { stable: true, path: "number/epsilon" },
                          MAX_SAFE_INTEGER: { stable: true, path: "number/max-safe-integer" },
                          MIN_SAFE_INTEGER: { stable: true, path: "number/min-safe-integer" },
                          fromString: { stable: false, path: "number/from-string" },
                  packages/babel-plugin-transform-runtime/src/runtime-corejs2-definitions.js on lines 9..20

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

                  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

                    function makeTrace(fileNameIdentifier, lineNumber, column0Based) {
                      const fileLineLiteral =
                        lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral();
                      const fileColumnLiteral =
                        column0Based != null
                  packages/babel-helper-builder-react-jsx-experimental/src/index.js on lines 408..434

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

                  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 getTokenFromCode has 162 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getTokenFromCode(code: number): void {
                      switch (code) {
                        // The interpretation of a dot depends on whether it is followed
                        // by a digit or another two dots.
                  
                  
                  Severity: Major
                  Found in packages/babel-parser/src/tokenizer/index.js - About 6 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language