Showing 1,982 of 1,982 total issues

Avoid deeply nested control flow statements.
Open

          } else if (parentPath.node.property.name === "length") {
            // args.length
            state.candidates.push({ cause: "lengthGetter", path });
            return;
          }
Severity: Major
Found in packages/babel-plugin-transform-parameters/src/rest.js - About 45 mins to fix

    Function newline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      newline(i?: number): void {
        if (this.format.retainLines || this.format.compact) return;
    
        if (this.format.concise) {
          this.space();
    Severity: Minor
    Found in packages/babel-generator/src/printer.js - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

        } else if (t.isObjectExpression(node)) {
          for (const prop of (node.properties: Array<Object>)) {
            if (!this.isPure(prop, constantsOnly)) return false;
          }
          return true;
    Severity: Major
    Found in packages/babel-traverse/src/scope/index.js - About 45 mins to fix

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

      export default function () {
        const visitor = {
          ImportDeclaration(path: NodePath) {
            if (isRegeneratorSource(getImportSource(path))) {
              this.regeneratorImportExcluded = true;
      Severity: Minor
      Found in packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js - About 45 mins 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 loadCjsOrMjsDefault has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function* loadCjsOrMjsDefault(
        filepath: string,
        asyncError: string,
      ): Handler<mixed> {
        switch (guessJSModuleType(filepath)) {
      Severity: Minor
      Found in packages/babel-core/src/config/files/module-types.js - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                if (!regenerator) {
                  polyfillPlugins.push([removeRegeneratorEntryPlugin, pluginOptions]);
                }
      Severity: Major
      Found in packages/babel-preset-env/src/index.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                if (!this.isPure(method, constantsOnly)) return false;
        Severity: Major
        Found in packages/babel-traverse/src/scope/index.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                for (const prop of (props: Array)) {
                  if (!prop.isProperty()) continue;
          
                  const key = prop.get("key");
          
          
          Severity: Major
          Found in packages/babel-traverse/src/path/introspection.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                } else if (target.isArrayExpression() && !isNaN(+targetName)) {
                  const elems = target.get("elements");
                  const elem = elems[targetName];
                  if (elem) return elem.resolve(dangerous, resolved);
                }
            Severity: Major
            Found in packages/babel-traverse/src/path/introspection.js - About 45 mins to fix

              Function _getPattern has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function _getPattern(
                parts: string[],
                context?: TraversalContext,
              ): NodePath | NodePath[] {
                let path = this;
              Severity: Minor
              Found in packages/babel-traverse/src/path/family.js - About 45 mins 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 assertCallerMetadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function assertCallerMetadata(
                loc: OptionPath,
                value: mixed,
              ): CallerMetadata | void {
                const obj = assertObject(loc, value);
              Severity: Minor
              Found in packages/babel-core/src/config/validation/option-assertions.js - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                          if (binding) binding.reference(path);
              Severity: Major
              Found in packages/babel-traverse/src/scope/index.js - About 45 mins to fix

                Function getCompletionRecords has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export function getCompletionRecords(): NodePath[] {
                  let paths = [];
                
                  if (this.isIfStatement()) {
                    paths = addCompletionRecords(this.get("consequent"), paths);
                Severity: Minor
                Found in packages/babel-traverse/src/path/family.js - About 45 mins 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 normalizeCoreJSOption has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export function normalizeCoreJSOption(
                  corejs?: CorejsOption,
                  useBuiltIns: BuiltInsOption,
                ): NormalizedCorejsOption {
                  let proposals = false;
                Severity: Minor
                Found in packages/babel-preset-env/src/normalize-options.js - About 45 mins 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 readConfigJS has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                const readConfigJS = makeStrongCache(function* readConfigJS(
                  filepath: string,
                  cache: CacheConfigurator<{
                    envName: string,
                    caller: CallerMetadata | void,
                Severity: Minor
                Found in packages/babel-core/src/config/files/configuration.js - About 45 mins 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 findConfigUpwards has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export function* findConfigUpwards(rootDir: string): Handler<string | null> {
                  let dirname = rootDir;
                  while (true) {
                    for (const filename of ROOT_CONFIG_FILENAMES) {
                      if (yield* fs.exists(path.join(dirname, filename))) {
                Severity: Minor
                Found in packages/babel-core/src/config/files/configuration.js - About 45 mins 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 assertOverridesList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function assertOverridesList(loc: OptionPath, value: mixed): OverridesList {
                  if (loc.parent.type === "env") {
                    throw new Error(`${msg(loc)} is not allowed inside an .env block`);
                  }
                  if (loc.parent.type === "overrides") {
                Severity: Minor
                Found in packages/babel-core/src/config/validation/options.js - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                      for (const elem of (node.elements: Array<Object>)) {
                        if (!this.isPure(elem, constantsOnly)) return false;
                      }
                Severity: Major
                Found in packages/babel-traverse/src/scope/index.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (statementInBlock.isBreakStatement()) {
                              breakStatement = statementInBlock;
                              break findBreak;
                            }
                  Severity: Major
                  Found in packages/babel-traverse/src/path/family.js - About 45 mins to fix

                    Function node has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      node: Object,
                      opts: Object,
                      scope: Object,
                      state: Object,
                      parentPath: Object,
                    Severity: Minor
                    Found in packages/babel-traverse/src/index.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language