Showing 1,251 of 1,982 total issues

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

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

    Function _generateImport has 162 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _generateImport(opts, importName) {
        const isDefault = importName === "default";
        const isNamed = !!importName && !isDefault;
        const isNamespace = importName === null;
    
    
    Severity: Major
    Found in packages/babel-helper-module-imports/src/import-injector.js - About 6 hrs to fix

      Function gatherSequenceExpressions has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function gatherSequenceExpressions(
        nodes: Array<Object>,
        scope: Scope,
        declars: Array<Object>,
      ): ?Object {
      Severity: Minor
      Found in packages/babel-types/src/converters/gatherSequenceExpressions.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 _resolve has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      export function _resolve(dangerous?, resolved?): ?NodePath {
        // detect infinite recursion
        // todo: possibly have a max length on this just to be safe
        if (resolved && resolved.indexOf(this) >= 0) return;
      
      
      Severity: Minor
      Found in packages/babel-traverse/src/path/introspection.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 explode has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      export function explode(visitor) {
        if (visitor._exploded) return visitor;
        visitor._exploded = true;
      
        // normalise pipes
      Severity: Minor
      Found in packages/babel-traverse/src/visitors.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 flowParsePrimaryType has 160 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          flowParsePrimaryType(): N.FlowTypeAnnotation {
            const startPos = this.state.start;
            const startLoc = this.state.startLoc;
            const node = this.startNode();
            let tmp;
      Severity: Major
      Found in packages/babel-parser/src/plugins/flow.js - About 6 hrs to fix

        File printer.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import isInteger from "lodash/isInteger";
        import repeat from "lodash/repeat";
        import Buffer from "./buffer";
        import * as n from "./node";
        import * as t from "@babel/types";
        Severity: Minor
        Found in packages/babel-generator/src/printer.js - About 6 hrs to fix

          Function _visitTypeAnnotation has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

            _visitTypeAnnotation(node) {
              if (!node) {
                return;
              }
              if (Array.isArray(node)) {
          Severity: Minor
          Found in eslint/babel-eslint-parser/src/analyze-scope.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 readInt has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

            readInt(
              radix: number,
              len?: number,
              forceLen?: boolean,
              allowNumSeparator: boolean = true,
          Severity: Minor
          Found in packages/babel-parser/src/tokenizer/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 gatherNodeParts has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

          function gatherNodeParts(node: Object, parts: Array) {
            switch (node?.type) {
              default:
                if (t.isModuleDeclaration(node)) {
                  if (node.source) {
          Severity: Minor
          Found in packages/babel-traverse/src/scope/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

          Tokenizer has 45 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Tokenizer extends ParserErrors {
            // Forward-declarations
            // parser/util.js
            /*::
            +unexpected: (pos?: ?number, messageOrType?: string | TokenType) => empty;
          Severity: Minor
          Found in packages/babel-parser/src/tokenizer/index.js - About 6 hrs to fix

            Function parseClassMemberWithIsStatic has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

              parseClassMemberWithIsStatic(
                classBody: N.ClassBody,
                member: N.ClassMember,
                state: { hadConstructor: boolean },
                isStatic: boolean,
            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 checkLVal has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

              checkLVal(
                expr: Expression,
                bindingType: BindingTypes = BIND_NONE,
                checkClashes: ?{ [key: string]: boolean },
                contextDescription: string,
            Severity: Minor
            Found in packages/babel-parser/src/parser/lval.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 isNodesEquivalent has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function isNodesEquivalent(a: any, b: any): boolean {
              if (
                typeof a !== "object" ||
                typeof b !== "object" ||
                a == null ||
            Severity: Minor
            Found in packages/babel-types/src/validators/isNodesEquivalent.js - About 5 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 built-in-definitions.js has 413 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // @flow
            
            type ObjectMap<V> = { [name: string]: V };
            
            const ArrayNatureIterators = [

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

              export default async function ({
                cliOptions,
                babelOptions,
              }: CmdOptions): Promise<void> {
                function buildResult(fileResults: Array<Object>): CompilationOutput {
              Severity: Minor
              Found in packages/babel-cli/src/babel/file.js - About 5 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 === "Scopable" ||
                  "BlockStatement" === nodeType ||
                  "CatchClause" === nodeType ||
                  "DoWhileStatement" === nodeType ||
              Severity: Critical
              Found in packages/babel-types/src/validators/generated/index.js - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language