Showing 1,982 of 1,982 total issues

File index.js has 4141 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
/*
 * This file is auto-generated! Do not modify it directly.
 * To re-generate run 'make build'
 */
Severity: Major
Found in packages/babel-types/src/validators/generated/index.js - About 1 wk to fix

    File flow.js has 2874 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @flow
    
    /*:: declare var invariant; */
    
    import type Parser from "../parser";
    Severity: Major
    Found in packages/babel-parser/src/plugins/flow.js - About 1 wk to fix

      File index.js has 2147 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @flow
      
      /*:: declare var invariant; */
      
      import type { TokenType } from "../../tokenizer/types";
      Severity: Major
      Found in packages/babel-parser/src/plugins/typescript/index.js - About 5 days to fix

        File expression.js has 1967 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @flow
        
        // A recursive descent parser operates by defining functions for all
        // syntactic elements, and recursively calling those, each function
        // advancing the input stream and returning an AST node. Precedence
        Severity: Major
        Found in packages/babel-parser/src/parser/expression.js - About 5 days to fix

          Function helper has a Cognitive Complexity of 244 (exceeds 5 allowed). Consider refactoring.
          Open

          export function helper(babel, options) {
            const FILE_NAME_VAR = "_jsxFileName";
          
            const JSX_SOURCE_ANNOTATION_REGEX = /\*?\s*@jsxImportSource\s+([^\s]+)/;
            const JSX_RUNTIME_ANNOTATION_REGEX = /\*?\s*@jsxRuntime\s+([^\s]+)/;
          Severity: Minor
          Found in packages/babel-helper-builder-react-jsx-experimental/src/index.js - About 5 days 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 statement.js has 1765 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          
          import * as N from "../types";
          import { types as tt, type TokenType } from "../tokenizer/types";
          import ExpressionParser from "./expression";
          Severity: Major
          Found in packages/babel-parser/src/parser/statement.js - About 4 days to fix

            File helpers.js has 1587 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // @flow
            
            import template from "@babel/template";
            
            const helpers = Object.create(null);
            Severity: Major
            Found in packages/babel-helpers/src/helpers.js - About 4 days to fix

              Function helper has 662 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function helper(babel, options) {
                const FILE_NAME_VAR = "_jsxFileName";
              
                const JSX_SOURCE_ANNOTATION_REGEX = /\*?\s*@jsxImportSource\s+([^\s]+)/;
                const JSX_RUNTIME_ANNOTATION_REGEX = /\*?\s*@jsxRuntime\s+([^\s]+)/;
              Severity: Major
              Found in packages/babel-helper-builder-react-jsx-experimental/src/index.js - About 3 days to fix

                Function transformClass has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function transformClass(
                  path: NodePath,
                  file: any,
                  builtinClasses: ReadonlySet<string>,
                  isLoose: boolean,
                Severity: Minor
                Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 3 days 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 index.js has 1242 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // @flow
                
                /*:: declare var invariant; */
                
                import type { Options } from "../options";
                Severity: Major
                Found in packages/babel-parser/src/tokenizer/index.js - About 3 days to fix

                  File index.js has 1223 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // @flow
                  /*
                   * This file is auto-generated! Do not modify it directly.
                   * To re-generate run 'make build'
                   */
                  Severity: Major
                  Found in packages/babel-types/src/asserts/generated/index.js - About 3 days to fix

                    File types.js has 1100 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // @flow
                    
                    import type { SourceType } from "./options";
                    import type { Token } from "./tokenizer";
                    import type { SourceLocation } from "./util/location";
                    Severity: Major
                    Found in packages/babel-parser/src/types.js - About 2 days to fix

                      Function transformClass has 532 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function transformClass(
                        path: NodePath,
                        file: any,
                        builtinClasses: ReadonlySet<string>,
                        isLoose: boolean,
                      Severity: Major
                      Found in packages/babel-plugin-transform-classes/src/transformClass.js - About 2 days to fix

                        File index.js has 1053 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        // @flow
                        /*
                         * This file is auto-generated! Do not modify it directly.
                         * To re-generate run 'make build'
                         */
                        Severity: Major
                        Found in packages/babel-types/src/builders/generated/index.js - About 2 days to fix

                          Function _evaluate has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function _evaluate(path, state) {
                            if (!state.confident) return;
                          
                            const { node } = path;
                          
                          
                          Severity: Minor
                          Found in packages/babel-traverse/src/path/evaluation.js - About 2 days 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 core.js has 1046 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // @flow
                          
                          import is from "../validators/is";
                          import isValidIdentifier from "../validators/isValidIdentifier";
                          import { isKeyword, isReservedWord } from "@babel/helper-validator-identifier";
                          Severity: Major
                          Found in packages/babel-types/src/definitions/core.js - About 2 days to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                nodeType === "Flow" ||
                                "AnyTypeAnnotation" === nodeType ||
                                "ArrayTypeAnnotation" === nodeType ||
                                "BooleanTypeAnnotation" === nodeType ||
                                "BooleanLiteralTypeAnnotation" === nodeType ||
                            Severity: Major
                            Found in packages/babel-types/src/validators/generated/index.js and 1 other location - About 2 days to fix
                            packages/babel-types/src/validators/generated/index.js on lines 3635..3686

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 382.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                nodeType === "Statement" ||
                                "BlockStatement" === nodeType ||
                                "BreakStatement" === nodeType ||
                                "ContinueStatement" === nodeType ||
                                "DebuggerStatement" === nodeType ||
                            Severity: Major
                            Found in packages/babel-types/src/validators/generated/index.js and 1 other location - About 2 days to fix
                            packages/babel-types/src/validators/generated/index.js on lines 4289..4337

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 382.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Consider simplifying this complex logical expression.
                            Open

                              if (
                                nodeType === "Flow" ||
                                "AnyTypeAnnotation" === nodeType ||
                                "ArrayTypeAnnotation" === nodeType ||
                                "BooleanTypeAnnotation" === nodeType ||
                            Severity: Critical
                            Found in packages/babel-types/src/validators/generated/index.js - About 2 days to fix

                              Function _generateImport has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
                              Open

                                _generateImport(opts, importName) {
                                  const isDefault = importName === "default";
                                  const isNamed = !!importName && !isDefault;
                                  const isNamespace = importName === null;
                              
                              
                              Severity: Minor
                              Found in packages/babel-helper-module-imports/src/import-injector.js - About 2 days 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

                              Severity
                              Category
                              Status
                              Source
                              Language