RocketChat/Rocket.Chat

View on GitHub
ee/packages/api-client/src/index.ts

Summary

Maintainability
F
6 days
Test Coverage

File index.ts has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { Serialized } from '@rocket.chat/core-typings';
import type {
    MatchPathPattern,
    ParamsFor,
    OperationResult,
Severity: Minor
Found in ee/packages/api-client/src/index.ts - About 2 hrs to fix

    Function send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        send(endpoint: string, method: string, { headers, ...options }: Omit<RequestInit, 'method'> = {}): Promise<Response> {
            return fetch(`${this.baseUrl}${`/${endpoint}`.replace(/\/+/, '/')}`, {
                ...options,
                headers: { ...this.getCredentialsAsHeaders(), ...this.headers, ...headers },
                method,
    Severity: Minor
    Found in ee/packages/api-client/src/index.ts - About 1 hr to fix

      Function buildFormData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function buildFormData(data?: Record<string, any> | void, formData = new FormData(), parentKey?: string): FormData {
          if (data instanceof FormData) {
              return data;
          }
          if (!data) {
      Severity: Minor
      Found in ee/packages/api-client/src/index.ts - About 25 mins 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

          send(endpoint: string, method: string, { headers, ...options }: Omit<RequestInit, 'method'> = {}): Promise<Response> {
              return fetch(`${this.baseUrl}${`/${endpoint}`.replace(/\/+/, '/')}`, {
                  ...options,
                  headers: { ...this.getCredentialsAsHeaders(), ...this.headers, ...headers },
                  method,
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 1 day to fix
      apps/meteor/client/startup/notifications/konchatNotifications.ts on lines 19..28

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

      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 4 locations. Consider refactoring.
      Open

          put<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithParamsFor<'PUT'> = PathWithParamsFor<'PUT'>>(
              endpoint: TPath,
              params: ParamsFor<'PUT', TPathPattern>,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'PUT', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 3 hrs to fix
      ee/packages/api-client/src/index.ts on lines 95..99
      ee/packages/api-client/src/index.ts on lines 121..125
      ee/packages/api-client/src/index.ts on lines 192..196

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

      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 4 locations. Consider refactoring.
      Open

          get<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithParamsFor<'GET'> = PathWithParamsFor<'GET'>>(
              endpoint: TPath,
              params: ParamsFor<'GET', TPathPattern>,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'GET', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 3 hrs to fix
      ee/packages/api-client/src/index.ts on lines 121..125
      ee/packages/api-client/src/index.ts on lines 160..164
      ee/packages/api-client/src/index.ts on lines 192..196

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

      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 4 locations. Consider refactoring.
      Open

          post<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithParamsFor<'POST'> = PathWithParamsFor<'POST'>>(
              endpoint: TPath,
              params: ParamsFor<'POST', TPathPattern>,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'POST', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 3 hrs to fix
      ee/packages/api-client/src/index.ts on lines 95..99
      ee/packages/api-client/src/index.ts on lines 160..164
      ee/packages/api-client/src/index.ts on lines 192..196

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

      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 4 locations. Consider refactoring.
      Open

          delete<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithParamsFor<'DELETE'> = PathWithParamsFor<'DELETE'>>(
              endpoint: TPath,
              params: ParamsFor<'DELETE', TPathPattern>,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'DELETE', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 3 hrs to fix
      ee/packages/api-client/src/index.ts on lines 95..99
      ee/packages/api-client/src/index.ts on lines 121..125
      ee/packages/api-client/src/index.ts on lines 160..164

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

      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 4 locations. Consider refactoring.
      Open

          put<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithoutParamsFor<'PUT'> = PathWithoutParamsFor<'PUT'>>(
              endpoint: TPath,
              params?: undefined,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'PUT', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 2 hrs to fix
      ee/packages/api-client/src/index.ts on lines 101..105
      ee/packages/api-client/src/index.ts on lines 127..131
      ee/packages/api-client/src/index.ts on lines 198..202

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

      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 4 locations. Consider refactoring.
      Open

          get<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithoutParamsFor<'GET'> = PathWithoutParamsFor<'GET'>>(
              endpoint: TPath,
              params?: undefined,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'GET', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 2 hrs to fix
      ee/packages/api-client/src/index.ts on lines 127..131
      ee/packages/api-client/src/index.ts on lines 166..170
      ee/packages/api-client/src/index.ts on lines 198..202

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

      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 4 locations. Consider refactoring.
      Open

          post<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithoutParamsFor<'POST'> = PathWithoutParamsFor<'POST'>>(
              endpoint: TPath,
              params?: undefined,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'POST', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 2 hrs to fix
      ee/packages/api-client/src/index.ts on lines 101..105
      ee/packages/api-client/src/index.ts on lines 166..170
      ee/packages/api-client/src/index.ts on lines 198..202

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

      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 4 locations. Consider refactoring.
      Open

          delete<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathWithoutParamsFor<'DELETE'> = PathWithoutParamsFor<'DELETE'>>(
              endpoint: TPath,
              params?: undefined,
              options?: Omit<RequestInit, 'method'>,
          ): Promise<Serialized<OperationResult<'DELETE', TPathPattern>>>;
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 3 other locations - About 2 hrs to fix
      ee/packages/api-client/src/index.ts on lines 101..105
      ee/packages/api-client/src/index.ts on lines 127..131
      ee/packages/api-client/src/index.ts on lines 166..170

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

      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 response = await this.send(endpoint, 'PUT', {
                  body: isFormData ? buildFormData(params) : JSON.stringify(params),
      
                  headers: {
                      Accept: 'application/json',
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 1 hr to fix
      ee/packages/api-client/src/index.ts on lines 140..150

      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

              const response = await this.send(endpoint, 'POST', {
                  body: isFormData ? buildFormData(params) : JSON.stringify(params),
      
                  headers: {
                      Accept: 'application/json',
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 1 hr to fix
      ee/packages/api-client/src/index.ts on lines 178..188

      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

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

      const pipe =
          <T extends (...args: any[]) => any>(fn: T) =>
          (...args: Parameters<T>): ReturnType<T> =>
              fn(...args);
      Severity: Major
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 1 hr to fix
      apps/meteor/app/settings/server/Middleware.ts on lines 5..8

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

      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

          async post<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathFor<'POST'>>(
              endpoint: TPath,
              params?: ParamsFor<'POST', TPathPattern>,
              { headers, ...options }: Omit<RequestInit, 'method'> = {},
          ): Promise<Serialized<OperationResult<'POST', TPathPattern>>> {
      Severity: Minor
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 55 mins to fix
      ee/packages/api-client/src/index.ts on lines 172..190

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

      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

          async put<TPathPattern extends MatchPathPattern<TPath>, TPath extends PathFor<'PUT'>>(
              endpoint: TPath,
              params?: ParamsFor<'PUT', TPathPattern>,
              { headers, ...options }: Omit<RequestInit, 'method'> = {},
          ): Promise<Serialized<OperationResult<'PUT', TPathPattern>>> {
      Severity: Minor
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 55 mins to fix
      ee/packages/api-client/src/index.ts on lines 133..158

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

      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

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

              cb: (args: { method: 'totp' | 'email' | 'password'; emailOrUsername?: string; invalidAttempt?: boolean }) => Promise<string>,
      Severity: Minor
      Found in ee/packages/api-client/src/index.ts and 1 other location - About 55 mins to fix
      ee/packages/api-client/src/RestClientInterface.ts on lines 90..90

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

      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

      There are no issues that match your filters.

      Category
      Status