Showing 1,251 of 1,982 total issues

Function loadPrivatePartialConfig has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function* loadPrivatePartialConfig(
  inputOpts: mixed,
): Handler<PrivPartialConfig | null> {
  if (
    inputOpts != null &&
Severity: Major
Found in packages/babel-core/src/config/partial.js - About 2 hrs to fix

    Function validate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function validate(opts: mixed): TemplateOpts {
      if (opts != null && typeof opts !== "object") {
        throw new Error("Unknown template options.");
      }
    
    
    Severity: Major
    Found in packages/babel-template/src/options.js - About 2 hrs to fix

      Function mergeSourceMap has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function mergeSourceMap(
        inputMap: SourceMap,
        map: SourceMap,
      ): SourceMap {
        const input = buildMappingData(inputMap);
      Severity: Major
      Found in packages/babel-core/src/transformation/file/merge-map.js - About 2 hrs to fix

        Function _guessExecutionStatusRelativeTo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function _guessExecutionStatusRelativeTo(
          target: NodePath,
        ): RelativeExecutionStatus {
          // check if the two paths are in different functions, we can't track execution of these
          const funcParent = {
        Severity: Major
        Found in packages/babel-traverse/src/path/introspection.js - About 2 hrs to fix

          Referencer has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Referencer extends OriginalReferencer {
            // inherits.
            visitPattern(node, options, callback) {
              if (!node) {
                return;
          Severity: Minor
          Found in eslint/babel-eslint-parser/src/analyze-scope.js - About 2 hrs to fix

            Function tsParseNonArrayType has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                tsParseNonArrayType(): N.TsType {
                  switch (this.state.type) {
                    case tt.name:
                    case tt._void:
                    case tt._null: {
            Severity: Major
            Found in packages/babel-parser/src/plugins/typescript/index.js - About 2 hrs to fix

              Function parseObjectMember has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                parseObjectMember(
                  isPattern: boolean,
                  refExpressionErrors?: ?ExpressionErrors,
                ): N.ObjectMember | N.SpreadElement | N.RestElement {
                  let decorators = [];
              Severity: Major
              Found in packages/babel-parser/src/parser/expression.js - About 2 hrs to fix

                Function enter has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        enter(path) {
                          if (!injectCoreJS) return;
                          if (!path.isReferenced()) return;
                          // skip transforming `delete something.includes`
                          if (path.parentPath.isUnaryExpression({ operator: "delete" })) return;
                Severity: Major
                Found in packages/babel-plugin-transform-runtime/src/index.js - About 2 hrs to fix

                  Function CallExpression has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        CallExpression(path) {
                          if (!injectCoreJS) return;
                  
                          const { node } = path;
                          const { callee } = node;
                  Severity: Major
                  Found in packages/babel-plugin-transform-runtime/src/index.js - About 2 hrs to fix

                    File xhtml.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // @flow
                    
                    const entities: { [name: string]: string } = {
                      quot: "\u0022",
                      amp: "&",
                    Severity: Minor
                    Found in packages/babel-parser/src/plugins/jsx/xhtml.js - About 2 hrs to fix

                      File import-injector.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import assert from "assert";
                      import * as t from "@babel/types";
                      
                      import ImportBuilder from "./import-builder";
                      import isModule from "./is-module";
                      Severity: Minor
                      Found in packages/babel-helper-module-imports/src/import-injector.js - About 2 hrs to fix

                        Function Class has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              Class(path) {
                                const { node } = path;
                                let comments = [];
                                if (node.typeParameters) {
                                  const typeParameters = path.get("typeParameters");
                        Severity: Major
                        Found in packages/babel-plugin-transform-flow-comments/src/index.js - About 2 hrs to fix

                          Function plainFunction has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function plainFunction(path: NodePath, callId: Object) {
                            const node = path.node;
                            const isDeclaration = path.isFunctionDeclaration();
                            const functionId = node.id;
                            const wrapper = isDeclaration
                          Severity: Major
                          Found in packages/babel-helper-wrap-function/src/index.js - About 2 hrs to fix

                            Function flowParseDeclareExportDeclaration has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                flowParseDeclareExportDeclaration(
                                  node: N.FlowDeclareExportDeclaration,
                                  insideModule: ?boolean,
                                ): N.FlowDeclareExportDeclaration {
                                  this.expect(tt._export);
                            Severity: Major
                            Found in packages/babel-parser/src/plugins/flow.js - About 2 hrs to fix

                              Function enableFeature has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function enableFeature(file, feature, loose) {
                                // We can't blindly enable the feature because, if it was already set,
                                // "loose" can't be changed, so that
                                //   @babel/plugin-class-properties { loose: true }
                                //   @babel/plugin-class-properties { loose: false }
                              Severity: Major
                              Found in packages/babel-helper-create-class-features-plugin/src/features.js - About 2 hrs to fix

                                Function isPure has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  isPure(node, constantsOnly?: boolean) {
                                    if (t.isIdentifier(node)) {
                                      const binding = this.getBinding(node.name);
                                      if (!binding) return false;
                                      if (constantsOnly) return binding.constant;
                                Severity: Major
                                Found in packages/babel-traverse/src/scope/index.js - About 2 hrs to fix

                                  Function readConfigJS has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const readConfigJS = makeStrongCache(function* readConfigJS(
                                    filepath: string,
                                    cache: CacheConfigurator<{
                                      envName: string,
                                      caller: CallerMetadata | void,
                                  Severity: Major
                                  Found in packages/babel-core/src/config/files/configuration.js - About 2 hrs to fix

                                    Function walk has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      async function walk(filenames: Array<string>): Promise<void> {
                                        const _filenames = [];
                                    
                                        filenames.forEach(function (filename) {
                                          if (!fs.existsSync(filename)) return;
                                    Severity: Major
                                    Found in packages/babel-cli/src/babel/file.js - About 2 hrs to fix

                                      Function assertOptionalChainStart has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function assertOptionalChainStart(): Validator {
                                        function validate(node) {
                                          let current = node;
                                          while (node) {
                                            const { type } = current;
                                      Severity: Minor
                                      Found in packages/babel-types/src/definitions/utils.js - About 2 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 removeTypeDuplicates has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export default function removeTypeDuplicates(
                                        nodes: Array<Object>,
                                      ): Array<Object> {
                                        const generics = {};
                                        const bases = {};

                                      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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language