Showing 1,982 of 1,982 total issues

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

            } else if (path.node.kind === "set") {
              if (
                privateNames.has(setName) ||
                (privateNames.has(name) && !privateNames.has(getName))
              ) {
packages/babel-helper-create-class-features-plugin/src/index.js on lines 79..109

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

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 type EstreeMethodDefinition = NodeBase & {
  type: "MethodDefinition",
  static: boolean,
  key: Expression,
  computed: boolean,
Severity: Major
Found in packages/babel-parser/src/types.js and 1 other location - About 2 hrs to fix
packages/babel-parser/src/types.js on lines 1028..1038

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

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

            if (path.node.kind === "get") {
              if (
                privateNames.has(getName) ||
                (privateNames.has(name) && !privateNames.has(setName))
              ) {
packages/babel-helper-create-class-features-plugin/src/index.js on lines 88..109

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

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

Function readRegexp has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  readRegexp(): void {
    const start = this.state.pos;
    let escaped, inClass;
    for (;;) {
      if (this.state.pos >= this.length) {
Severity: Minor
Found in packages/babel-parser/src/tokenizer/index.js - About 1 hr to fix

    Function isNodesEquivalent has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function isNodesEquivalent(a: any, b: any): boolean {
      if (
        typeof a !== "object" ||
        typeof b !== "object" ||
        a == null ||
    Severity: Minor
    Found in packages/babel-types/src/validators/isNodesEquivalent.js - About 1 hr to fix

      Function rewriteLiveReferences has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function rewriteLiveReferences(
        programPath: NodePath,
        metadata: ModuleMetadata,
      ) {
        const imported = new Map();

        Function buildPrivateMethodDeclaration has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function buildPrivateMethodDeclaration(prop, privateNamesMap, loose = false) {
          const privateName = privateNamesMap.get(prop.node.key.id.name);
          const {
            id,
            methodId,
        Severity: Minor
        Found in packages/babel-helper-create-class-features-plugin/src/fields.js - About 1 hr to fix

          Function normalizeOptions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function normalizeOptions(opts: Options) {
            validateTopLevelOptions(opts);
          
            const useBuiltIns = validateUseBuiltInsOption(opts.useBuiltIns);
          
          
          Severity: Minor
          Found in packages/babel-preset-env/src/normalize-options.js - About 1 hr to fix

            Function getScopeInformation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getScopeInformation(fnPath) {
              const thisPaths = [];
              const argumentsPaths = [];
              const newTargetPaths = [];
              const superProps = [];
            Severity: Minor
            Found in packages/babel-traverse/src/path/conversion.js - About 1 hr to fix

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

              function constDeclarationIndent() {
                // "const " indentation.
                this.token(",");
                this.newline();
                if (this.endsWith("\n")) for (let i = 0; i < 6; i++) this.space(true);
              Severity: Major
              Found in packages/babel-generator/src/generators/statements.js and 1 other location - About 1 hr to fix
              packages/babel-generator/src/generators/statements.js on lines 224..229

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

              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

              function variableDeclarationIndent() {
                // "let " or "var " indentation.
                this.token(",");
                this.newline();
                if (this.endsWith("\n")) for (let i = 0; i < 4; i++) this.space(true);
              Severity: Major
              Found in packages/babel-generator/src/generators/statements.js and 1 other location - About 1 hr to fix
              packages/babel-generator/src/generators/statements.js on lines 231..236

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

              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

              Function tsParseDeclaration has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  tsParseDeclaration(
                    node: any,
                    value: string,
                    next: boolean,
                  ): ?N.Declaration {
              Severity: Minor
              Found in packages/babel-parser/src/plugins/typescript/index.js - About 1 hr to fix

                Function parseForStatement has 48 lines of code (exceeds 25 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 1 hr to fix

                  Function stringifyValidator has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function stringifyValidator(validator, nodePrefix) {
                    if (validator === undefined) {
                      return "any";
                    }
                  
                  
                  Severity: Minor
                  Found in packages/babel-types/scripts/utils/stringifyValidator.js - About 1 hr to fix

                    Function normalizeOptions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function normalizeOptions(config: ResolvedConfig): {} {
                      const {
                        filename,
                        cwd,
                        filenameRelative = typeof filename === "string"
                    Severity: Minor
                    Found in packages/babel-core/src/transformation/normalize-opts.js - About 1 hr to fix

                      Function crawl has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        crawl() {
                          const path = this.path;
                      
                          this.references = Object.create(null);
                          this.bindings = Object.create(null);
                      Severity: Minor
                      Found in packages/babel-traverse/src/scope/index.js - About 1 hr to fix

                        Function completionRecordForSwitch has 48 lines of code (exceeds 25 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 1 hr to fix

                          Function buildOpeningElementAttributes has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function buildOpeningElementAttributes(attribs, file) {
                              let _props = [];
                              const objs = [];
                          
                              const { useSpread = false } = file.opts;
                          Severity: Minor
                          Found in packages/babel-helper-builder-react-jsx/src/index.js - About 1 hr to fix

                            Function evaluate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function evaluate(
                              expr,
                              seen: PreviousEnumMembers,
                            ): number | string | typeof undefined {
                              return evalConstant(expr);
                            Severity: Minor
                            Found in packages/babel-plugin-transform-typescript/src/enum.js - About 1 hr 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 parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function parse(input: string, options?: Options): File {
                              if (options?.sourceType === "unambiguous") {
                                options = {
                                  ...options,
                                };
                            Severity: Minor
                            Found in packages/babel-parser/src/index.js - About 1 hr 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