Showing 1,982 of 1,982 total issues

Function convertFunctionRest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function convertFunctionRest(path) {
  const { node, scope } = path;
  if (!hasRest(node)) return false;

  let rest = node.params.pop().argument;
Severity: Minor
Found in packages/babel-plugin-transform-parameters/src/rest.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 _printNewline has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  _printNewline(leading, node, parent, opts) {
    // Fast path since 'this.newline' does nothing when not tracking lines.
    if (this.format.retainLines || this.format.compact) return;

    // Fast path for concise since 'this.newline' just inserts a space when
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 replaceExpressionWithStatements has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function replaceExpressionWithStatements(nodes: Array<Object>) {
  this.resync();

  const toSequenceExpression = t.toSequenceExpression(nodes, this.scope);

Severity: Minor
Found in packages/babel-traverse/src/path/replacement.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 compile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function compile(code, filename) {
  // merge in base options and resolve all the plugins and presets relative to this file
  const opts = new OptionManager().init(
    // sourceRoot can be overwritten
    {
Severity: Minor
Found in packages/babel-register/src/node.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 resolveCall has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function resolveCall(callee) {
  callee = callee.resolve();

  if (callee.isFunction()) {
    if (callee.is("async")) {
Severity: Minor
Found in packages/babel-traverse/src/path/inference/inferers.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 getParentConditionalPath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function getParentConditionalPath(binding, path, name) {
  let parentPath;
  while ((parentPath = path.parentPath)) {
    if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
      if (path.key === "test") {
Severity: Minor
Found in packages/babel-traverse/src/path/inference/inferer-reference.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 default has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function ({ types: t }) {
  return {
    inherits: syntaxObjectRestSpread,

    visitor: {

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

  enter(path, self) {
    const { node, parent } = path;

    if (path.isForStatement()) {
      if (isVar(node.init, node)) {
Severity: Minor
Found in packages/babel-plugin-transform-block-scoping/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 convertBlockScopedToVar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function convertBlockScopedToVar(
  path,
  node,
  parent,
  scope,
Severity: Minor
Found in packages/babel-plugin-transform-block-scoping/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 tsTryParseDeclare has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    tsTryParseDeclare(nany: any): ?N.Declaration {
      if (this.isLineTerminator()) {
        return;
      }
      let starttype = this.state.type;
Severity: Minor
Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

    Function processMethod has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function processMethod(node, scope) {
        if (classState.isLoose && !node.decorators) {
          // use assignments instead of define properties for loose classes
          let { classRef } = classState;
          if (!node.static) {
    Severity: Minor
    Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 1 hr to fix

      Function buildCodeFrameError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        buildCodeFrameError(
          node: ?NodeLocation,
          msg: string,
          Error: typeof Error = SyntaxError,
        ): Error {
      Severity: Minor
      Found in packages/babel-core/src/transformation/file/file.js - About 1 hr to fix

        Function pre has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            pre() {
              this.injectedPolyfills = new Set();
              this.polyfillsSet = new Set();
        
              this.addUnsupported = function (builtIn) {
        Severity: Minor
        Found in packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js - About 1 hr to fix

          Function verify has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function verify(visitor) {
            if (visitor._verified) return;
          
            if (typeof visitor === "function") {
              throw new Error(
          Severity: Minor
          Found in packages/babel-traverse/src/visitors.js - About 1 hr to fix

            Function inferAnnotationFromBinaryExpression has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function inferAnnotationFromBinaryExpression(name, path) {
              const operator = path.node.operator;
            
              const right = path.get("right").resolve();
              const left = path.get("left").resolve();
            Severity: Minor
            Found in packages/babel-traverse/src/path/inference/inferer-reference.js - About 1 hr to fix

              Function ForXStatement has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    ForXStatement(path) {
                      const { node, scope } = path;
                      const leftPath = path.get("left");
                      const left = node.left;
              
              
              Severity: Minor
              Found in packages/babel-plugin-proposal-object-rest-spread/src/index.js - About 1 hr to fix

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

                    err = new Error(
                      `Requires Babel "${range}", but was loaded with "${version}". ` +
                        `If you are sure you have a compatible version of @babel/core, ` +
                        `it is likely that something in your build process is loading the ` +
                        `wrong version. Inspect the stack trace of this error to look for ` +
                Severity: Major
                Found in packages/babel-helper-plugin-utils/src/index.js and 1 other location - About 1 hr to fix
                packages/babel-core/src/config/helpers/config-api.js on lines 83..90

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

                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

                  const err = new Error(
                    `Requires Babel "${range}", but was loaded with "${coreVersion}". ` +
                      `If you are sure you have a compatible version of @babel/core, ` +
                      `it is likely that something in your build process is loading the ` +
                      `wrong version. Inspect the stack trace of this error to look for ` +
                Severity: Major
                Found in packages/babel-core/src/config/helpers/config-api.js and 1 other location - About 1 hr to fix
                packages/babel-helper-plugin-utils/src/index.js on lines 73..80

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

                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 TSUnionType(node: Object, parent: Object): boolean {
                  return (
                    t.isTSArrayType(parent) ||
                    t.isTSOptionalType(parent) ||
                    t.isTSIntersectionType(parent) ||
                Severity: Major
                Found in packages/babel-generator/src/node/parentheses.js and 1 other location - About 1 hr to fix
                packages/babel-generator/src/node/whitespace.js on lines 55..63

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

                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

                function isType(node) {
                  return (
                    t.isLiteral(node) ||
                    t.isObjectExpression(node) ||
                    t.isArrayExpression(node) ||
                Severity: Major
                Found in packages/babel-generator/src/node/whitespace.js and 1 other location - About 1 hr to fix
                packages/babel-generator/src/node/parentheses.js on lines 146..154

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

                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