Showing 1,982 of 1,982 total issues

Avoid deeply nested control flow statements.
Open

              if (DECIMAL_NUMBER.test(str)) {
                entity = String.fromCodePoint(parseInt(str, 10));
              }
Severity: Major
Found in packages/babel-parser/src/plugins/jsx/index.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) {
                  ++this.state.pos;
                }
    Severity: Major
    Found in packages/babel-parser/src/tokenizer/index.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (HEX_NUMBER.test(str)) {
                      entity = String.fromCodePoint(parseInt(str, 16));
                    }
      Severity: Major
      Found in packages/babel-parser/src/plugins/jsx/index.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (lastChild.leadingComments[i].end <= node.start) {
                      node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
                      break;
                    }
        Severity: Major
        Found in packages/babel-parser/src/parser/comments.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (!isFrom && specifier.local) {
                      // check for keywords used as local names
                      this.checkReservedWord(
                        specifier.local.name,
                        specifier.local.start,
          Severity: Major
          Found in packages/babel-parser/src/parser/statement.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    if (
                      node.declaration.type === "FunctionDeclaration" ||
                      node.declaration.type === "ClassDeclaration"
                    ) {
                      const id = node.declaration.id;
            Severity: Major
            Found in packages/babel-parser/src/parser/statement.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        for (j = 0; j < this.state.leadingComments.length; j++) {
                          if (
                            this.state.leadingComments[j].end <
                            this.state.commentPreviousNode.end
                          ) {
              Severity: Major
              Found in packages/babel-parser/src/parser/comments.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if (this.state.leadingComments[i].end > node.start) {
                            break;
                          }
                Severity: Major
                Found in packages/babel-parser/src/parser/comments.js - About 45 mins to fix

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

                    parseDecorator(): N.Decorator {
                      this.expectOnePlugin(["decorators-legacy", "decorators"]);
                  
                      const node = this.startNode();
                      this.next();
                  Severity: Minor
                  Found in packages/babel-parser/src/parser/statement.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 (this.isNonstaticConstructor(publicMethod)) {
                            this.raise(publicMethod.key.start, Errors.ConstructorIsAsync);
                          }
                  Severity: Major
                  Found in packages/babel-parser/src/parser/statement.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                        } else if (this.isLineTerminator()) {
                          // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token)
                          if (isPrivate) {
                            this.pushClassPrivateProperty(classBody, privateProp);
                          } else {
                    Severity: Major
                    Found in packages/babel-parser/src/parser/statement.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                            if (method.key.type === "PrivateName") {
                              // private getter/setter
                              this.pushClassPrivateMethod(classBody, privateMethod, false, false);
                            } else {
                              if (this.isNonstaticConstructor(publicMethod)) {
                      Severity: Major
                      Found in packages/babel-parser/src/parser/statement.js - About 45 mins to fix

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

                          pushClassPrivateMethod(
                            classBody: N.ClassBody,
                            method: N.ClassPrivateMethod,
                            isGenerator: boolean,
                            isAsync: boolean,
                        Severity: Minor
                        Found in packages/babel-parser/src/parser/statement.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 (isEmptyStatement(node)) {
                              // empty statement so ensure the last item is undefined if we're last
                              ensureLastUndefined = true;
                            } else {
                              // bailed, we can't turn this statement into an expression
                        Severity: Major
                        Found in packages/babel-types/src/converters/gatherSequenceExpressions.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (reexport) {
                                      localData.delete(localName);
                          
                                      reexport.names.forEach(name => {
                                        data.reexports.set(name, importName);

                            Avoid deeply nested control flow statements.
                            Open

                                    if (!t.isStatement(replacement)) {
                                      replacement = t.expressionStatement((replacement: any));
                                    }
                            Severity: Major
                            Found in packages/babel-template/src/populate.js - About 45 mins to fix

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

                                get(member) {
                                  const { classRef, privateNamesMap, file } = this;
                                  const { name } = member.node.property.id;
                                  const {
                                    id,
                              Severity: Minor
                              Found in packages/babel-helper-create-class-features-plugin/src/fields.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 createTypeAnnotationBasedOnTypeof has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function createTypeAnnotationBasedOnTypeof(
                                type: string,
                              ): Object {
                                if (type === "string") {
                                  return stringTypeAnnotation();

                              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 (parentKey === "meta") {
                                    if (is("MetaProperty", parent, { meta: node })) return;
                                  }
                              Severity: Major
                              Found in packages/babel-types/src/definitions/core.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                        if (typeof replacement === "string") {
                                          replacement = t.identifier(replacement);
                                        }
                                Severity: Major
                                Found in packages/babel-template/src/populate.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language