Showing 1,982 of 1,982 total issues

Function parseClassMemberWithIsStatic has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseClassMemberWithIsStatic(
    classBody: N.ClassBody,
    member: N.ClassMember,
    state: { hadConstructor: boolean },
    isStatic: boolean,
Severity: Major
Found in packages/babel-parser/src/parser/statement.js - About 5 hrs to fix

    Function hoistFunctionEnvironment has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function hoistFunctionEnvironment(
      fnPath,
      specCompliant = false,
      allowInsertArrow = true,
    ) {
    Severity: Major
    Found in packages/babel-traverse/src/path/conversion.js - About 5 hrs to fix

      Function run has 125 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function run(task) {
        const {
          actual,
          expect: expected,
          exec,
      Severity: Major
      Found in packages/babel-helper-transform-fixture-test-runner/src/index.js - About 5 hrs to fix

        Consider simplifying this complex logical expression.
        Open

          if (
            nodeType === "BlockParent" ||
            "BlockStatement" === nodeType ||
            "CatchClause" === nodeType ||
            "DoWhileStatement" === nodeType ||
        Severity: Critical
        Found in packages/babel-types/src/validators/generated/index.js - About 5 hrs to fix

          Function loadFullConfig has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default gensync<[any], ResolvedConfig | null>(function* loadFullConfig(
            inputOpts: mixed,
          ): Handler<ResolvedConfig | null> {
            const result = yield* loadPrivatePartialConfig(inputOpts);
            if (!result) {
          Severity: Major
          Found in packages/babel-core/src/config/full.js - About 4 hrs to fix

            Function OptionalCallExpression|OptionalMemberExpression has 123 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  "OptionalCallExpression|OptionalMemberExpression"(path) {
                    const { scope } = path;
                    // maybeParenthesized points to the outermost parenthesizedExpression
                    // or the path itself
                    let maybeParenthesized = path;
            Severity: Major
            Found in packages/babel-plugin-proposal-optional-chaining/src/index.js - About 4 hrs to fix

              Function removeTypeDuplicates has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function removeTypeDuplicates(
                nodes: Array<Object>,
              ): Array<Object> {
                const generics = {};
                const bases = {};
              Severity: Minor
              Found in packages/babel-types/src/modifications/flow/removeTypeDuplicates.js - About 4 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 default has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function (
                _: any,
                { corejs, include, exclude, polyfillTargets, debug }: InternalPluginOptions,
              ) {
                const polyfills = filterItems(
              Severity: Minor
              Found in packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js - About 4 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 completionRecordForSwitch has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              function completionRecordForSwitch(cases, paths) {
                let isLastCaseWithConsequent = true;
              
                for (let i = cases.length - 1; i >= 0; i--) {
                  const switchCase = cases[i];
              Severity: Minor
              Found in packages/babel-traverse/src/path/family.js - About 4 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 getBindingIdentifierPaths has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getBindingIdentifierPaths(
                duplicates?: boolean = false,
                outerOnly?: boolean = false,
              ): { [string]: NodePath } {
                const path = this;
              Severity: Minor
              Found in packages/babel-traverse/src/path/family.js - About 4 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

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

              export function isLoop(node: ?Object, opts?: Object): boolean {
                if (!node) return false;
              
                const nodeType = node.type;
                if (
              Severity: Major
              Found in packages/babel-types/src/validators/generated/index.js and 1 other location - About 4 hrs to fix
              packages/babel-types/src/validators/generated/index.js on lines 4557..4577

              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 133.

              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

              export function isTSTypeElement(node: ?Object, opts?: Object): boolean {
                if (!node) return false;
              
                const nodeType = node.type;
                if (
              Severity: Major
              Found in packages/babel-types/src/validators/generated/index.js and 1 other location - About 4 hrs to fix
              packages/babel-types/src/validators/generated/index.js on lines 3757..3777

              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 133.

              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

              File estree.js has 366 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // @flow
              
              import { types as tt, TokenType } from "../tokenizer/types";
              import type Parser from "../parser";
              import type { ExpressionErrors } from "../parser/util";
              Severity: Minor
              Found in packages/babel-parser/src/plugins/estree.js - About 4 hrs to fix

                Function readTmplToken has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                  readTmplToken(): void {
                    let out = "",
                      chunkStart = this.state.pos,
                      containsInvalid = false;
                    for (;;) {
                Severity: Minor
                Found in packages/babel-parser/src/tokenizer/index.js - About 4 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 getBindingIdentifiers has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function getBindingIdentifiers(
                  node: Object,
                  duplicates?: boolean,
                  outerOnly?: boolean,
                ): { [string]: Object | Array<Object> } {
                Severity: Minor
                Found in packages/babel-types/src/retrievers/getBindingIdentifiers.js - About 4 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

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

                import { declare } from "@babel/helper-plugin-utils";
                import { addDefault, isModule } from "@babel/helper-module-imports";
                import { types as t } from "@babel/core";
                
                import getCoreJS2Definitions from "./runtime-corejs2-definitions";
                Severity: Minor
                Found in packages/babel-plugin-transform-runtime/src/index.js - About 4 hrs to fix

                  Function buildRollup has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function buildRollup(packages) {
                    const sourcemap = process.env.NODE_ENV === "production";
                    const minify = !!process.env.IS_PUBLISH;
                    return Promise.all(
                      packages.map(
                  Severity: Major
                  Found in Gulpfile.js - About 4 hrs to fix

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

                    import { declare } from "@babel/helper-plugin-utils";
                    import syntaxTypeScript from "@babel/plugin-syntax-typescript";
                    import { types as t, template } from "@babel/core";
                    import { injectInitialization } from "@babel/helper-create-class-features-plugin";
                    
                    
                    Severity: Minor
                    Found in packages/babel-plugin-transform-typescript/src/index.js - About 4 hrs to fix

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

                            enter(path, state) {
                              if (hasJSX(path)) {
                                const { file } = state;
                                let runtime = RUNTIME_DEFAULT;
                      
                      
                      Severity: Major
                      Found in packages/babel-helper-builder-react-jsx-experimental/src/index.js - About 4 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                          if (
                            nodeType === "Immutable" ||
                            "StringLiteral" === nodeType ||
                            "NumericLiteral" === nodeType ||
                            "NullLiteral" === nodeType ||
                        Severity: Critical
                        Found in packages/babel-types/src/validators/generated/index.js - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language