Showing 1,982 of 1,982 total issues

Function parseMaybeAssign has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parseMaybeAssign(
      noIn?: ?boolean,
      refExpressionErrors?: ?ExpressionErrors,
      afterLeftParse?: Function,
      refNeedsArrowPos?: ?Pos,
Severity: Major
Found in packages/babel-parser/src/plugins/flow.js - About 2 hrs to fix

    Function applyReplacement has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function applyReplacement(
      placeholder: Placeholder,
      ast: BabelNodeFile,
      replacement: any,
    ) {
    Severity: Major
    Found in packages/babel-template/src/populate.js - About 2 hrs to fix

      Function classTransformer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function () {
          return {
            name: "babel-source",
            load(id) {
              const matches = id.match(/packages\/(babel-[^/]+)\/src\//);
        Severity: Major
        Found in scripts/rollup-plugin-babel-source.js - About 2 hrs to fix

          Function recurseDescriptors has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const ignored = yield* (function* recurseDescriptors(
                config: {
                  plugins: Array<UnloadedDescriptor>,
                  presets: Array<UnloadedDescriptor>,
                },
          Severity: Major
          Found in packages/babel-core/src/config/full.js - About 2 hrs to fix

            Function buildMappingData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function buildMappingData(map: SourceMap): ResolvedMappings {
              const consumer = new sourceMap.SourceMapConsumer({
                ...map,
            
                // This is a bit hack. .addMapping expects source values to be relative,
            Severity: Major
            Found in packages/babel-core/src/transformation/file/merge-map.js - About 2 hrs to fix

              File missing-plugin-helper.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // @flow
              
              const pluginNameMap = {
                classProperties: {
                  syntax: {
              Severity: Minor
              Found in packages/babel-core/src/parser/util/missing-plugin-helper.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                  if (
                    nodeType === "Pureish" ||
                    "FunctionDeclaration" === nodeType ||
                    "FunctionExpression" === nodeType ||
                    "StringLiteral" === nodeType ||
                Severity: Critical
                Found in packages/babel-types/src/validators/generated/index.js - About 2 hrs to fix

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

                  export function WhileStatement(node: Object) {
                    this.word("while");
                    this.space();
                    this.token("(");
                    this.print(node.test, node);
                  Severity: Major
                  Found in packages/babel-generator/src/generators/statements.js and 1 other location - About 2 hrs to fix
                  packages/babel-generator/src/generators/statements.js on lines 3..10

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

                  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 WithStatement(node: Object) {
                    this.word("with");
                    this.space();
                    this.token("(");
                    this.print(node.object, node);
                  Severity: Major
                  Found in packages/babel-generator/src/generators/statements.js and 1 other location - About 2 hrs to fix
                  packages/babel-generator/src/generators/statements.js on lines 75..82

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

                  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

                          isUnderHelper = path.findParent(path => {
                            return (
                              (path.isVariableDeclarator() && path.node.id === helper) ||
                              (path.isFunctionDeclaration() &&
                                path.node.id &&
                  Severity: Major
                  Found in packages/babel-plugin-transform-typeof-symbol/src/index.js and 1 other location - About 2 hrs to fix
                  packages/babel-plugin-transform-instanceof/src/index.js on lines 15..22

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

                  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

                            const isUnderHelper = path.findParent(path => {
                              return (
                                (path.isVariableDeclarator() && path.node.id === helper) ||
                                (path.isFunctionDeclaration() &&
                                  path.node.id &&
                  Severity: Major
                  Found in packages/babel-plugin-transform-instanceof/src/index.js and 1 other location - About 2 hrs to fix
                  packages/babel-plugin-transform-typeof-symbol/src/index.js on lines 55..62

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

                  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 rewrite-live-references.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import assert from "assert";
                  import * as t from "@babel/types";
                  import template from "@babel/template";
                  import simplifyAccess from "@babel/helper-simple-access";
                  
                  

                    Function readNumber has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      readNumber(startsWithDot: boolean): void {
                        const start = this.state.pos;
                        let isFloat = false;
                        let isBigInt = false;
                        let isNonOctalDecimalInt = false;
                    Severity: Major
                    Found in packages/babel-parser/src/tokenizer/index.js - About 2 hrs to fix

                      Function isFlow has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function isFlow(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 - About 2 hrs to fix

                        Function exit has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                exit(path, { requireId }) {
                                  if (!isModule(path)) {
                                    if (requireId) {
                                      injectWrapper(
                                        path,
                        Severity: Major
                        Found in packages/babel-plugin-transform-modules-amd/src/index.js - About 2 hrs to fix

                          Function exit has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  exit(path, state) {
                                    const { node, parent, scope } = path;
                                    let hasComputed = false;
                                    for (const prop of (node.properties: Array<Object>)) {
                                      hasComputed = prop.computed === true;
                          Severity: Major
                          Found in packages/babel-plugin-transform-computed-properties/src/index.js - About 2 hrs to fix

                            Function parseForStatement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                              parseForStatement(node: N.Node): N.ForLike {
                                this.next();
                                this.state.labels.push(loopLabel);
                            
                                let awaitAt = -1;
                            Severity: Minor
                            Found in packages/babel-parser/src/parser/statement.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 exit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                                exit(path) {
                                  const {
                                    scope,
                                    seen,
                                    imported,

                            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 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function ({ node, parent, scope, id }, localBinding = false) {
                              // has an `id` so we don't need to infer one
                              if (node.id) return;
                            
                              if (
                            Severity: Minor
                            Found in packages/babel-helper-function-name/src/index.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

                            Severity
                            Category
                            Status
                            Source
                            Language