Showing 1,251 of 1,982 total issues

Function convertToken has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function convertToken(token, source) {
  const type = token.type;
  token.range = [token.start, token.end];

  if (type === tt.name) {
Severity: Major
Found in eslint/babel-eslint-parser/src/convert/convertTokens.js - About 3 hrs to fix

    Function convertFunctionRest has 82 lines of code (exceeds 25 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: Major
    Found in packages/babel-plugin-transform-parameters/src/rest.js - About 3 hrs to fix

      Function buildRootChain has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function* buildRootChain(
        opts: ValidatedOptions,
        context: ConfigContext,
      ): Handler<RootConfigChain | null> {
        const programmaticChain = yield* loadProgrammaticChain(
      Severity: Major
      Found in packages/babel-core/src/config/config-chain.js - About 3 hrs to fix

        Function readWord1 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          readWord1(): string {
            let word = "";
            this.state.containsEsc = false;
            const start = this.state.pos;
            let chunkStart = this.state.pos;
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 3 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 readRegexp has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          readRegexp(): void {
            const start = this.state.pos;
            let escaped, inClass;
            for (;;) {
              if (this.state.pos >= this.length) {
        Severity: Minor
        Found in packages/babel-parser/src/tokenizer/index.js - About 3 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 parseCallExpressionArguments has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          parseCallExpressionArguments(
            close: TokenType,
            possibleAsyncArrow: boolean,
            dynamicImport?: boolean,
            allowPlaceholder?: boolean,
        Severity: Minor
        Found in packages/babel-parser/src/parser/expression.js - About 3 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 parser has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function* parser(
          pluginPasses: PluginPasses,
          { parserOpts, highlightCode = true, filename = "unknown" }: Object,
          code: string,
        ): Handler<ParseResult> {
        Severity: Minor
        Found in packages/babel-core/src/parser/index.js - About 3 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 buildRootChain has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        export function* buildRootChain(
          opts: ValidatedOptions,
          context: ConfigContext,
        ): Handler<RootConfigChain | null> {
          const programmaticChain = yield* loadProgrammaticChain(
        Severity: Minor
        Found in packages/babel-core/src/config/config-chain.js - About 3 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 exprs has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const exprs = decoratedProps.reduce(function (acc, node) {
            const decorators = node.decorators || [];
            node.decorators = null;
        
            if (decorators.length === 0) return acc;
        Severity: Major
        Found in packages/babel-plugin-proposal-decorators/src/transformer-legacy.js - About 3 hrs to fix

          Function isReferenced has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function isReferenced(
            node: Object,
            parent: Object,
            grandparent?: Object,
          ): boolean {
          Severity: Major
          Found in packages/babel-types/src/validators/isReferenced.js - About 3 hrs to fix

            Function evaluate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function evaluate(
              expr,
              seen: PreviousEnumMembers,
            ): number | string | typeof undefined {
              return evalConstant(expr);
            Severity: Major
            Found in packages/babel-plugin-transform-typescript/src/enum.js - About 3 hrs to fix

              Function jsxParseElementAt has 78 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  jsxParseElementAt(startPos: number, startLoc: Position): N.JSXElement {
                    const node = this.startNodeAt(startPos, startLoc);
                    const children = [];
                    const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
                    let closingElement = null;
              Severity: Major
              Found in packages/babel-parser/src/plugins/jsx/index.js - About 3 hrs to fix

                Function getHelperMetadata has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                function getHelperMetadata(file) {
                  const globals = new Set();
                  const localBindingNames = new Set();
                  // Maps imported identifier -> helper name
                  const dependencies = new Map();
                Severity: Minor
                Found in packages/babel-helpers/src/index.js - About 3 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 permuteHelperAST has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                function permuteHelperAST(file, metadata, id, localBindings, getDependency) {
                  if (localBindings && !id) {
                    throw new Error("Unexpected local bindings for module-based helpers.");
                  }
                
                
                Severity: Minor
                Found in packages/babel-helpers/src/index.js - About 3 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 readToken_pipe_amp has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                  readToken_pipe_amp(code: number): void {
                    // '||' '&&' '||=' '&&='
                    const next = this.input.charCodeAt(this.state.pos + 1);
                
                    if (next === code) {
                Severity: Minor
                Found in packages/babel-parser/src/tokenizer/index.js - About 3 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 stringifyValidator has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function stringifyValidator(validator, nodePrefix) {
                  if (validator === undefined) {
                    return "any";
                  }
                
                
                Severity: Minor
                Found in packages/babel-types/scripts/utils/stringifyValidator.js - About 3 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 createRegExpFeaturePlugin has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                export function createRegExpFeaturePlugin({ name, feature, options = {} }) {
                  return {
                    name,
                    pre() {
                      const { file } = this;
                Severity: Minor
                Found in packages/babel-helper-create-regexp-features-plugin/src/index.js - About 3 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 getLetReferences has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                  getLetReferences() {
                    const block = this.block;
                
                    let declarators = [];
                
                
                Severity: Minor
                Found in packages/babel-plugin-transform-block-scoping/src/index.js - About 3 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 permuteHelperAST has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function permuteHelperAST(file, metadata, id, localBindings, getDependency) {
                  if (localBindings && !id) {
                    throw new Error("Unexpected local bindings for module-based helpers.");
                  }
                
                
                Severity: Major
                Found in packages/babel-helpers/src/index.js - About 3 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                    if (
                      // Although parentheses wouldn"t hurt around sequence
                      // expressions in the head of for loops, traditional style
                      // dictates that e.g. i++, j++ should not be wrapped with
                      // parentheses.
                  Severity: Critical
                  Found in packages/babel-generator/src/node/parentheses.js - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language