CRBT-Team/Purplet

View on GitHub

Showing 129 of 129 total issues

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

    await rest.interactionResponse.deleteFollowupMessage({
      applicationId: this.interaction.applicationId,
      interactionToken: this.interaction.token,
      messageId: this.raw.id,
    });
Severity: Major
Found in packages/purplet/src/structures/message-interaction.ts and 1 other location - About 1 hr to fix
packages/purplet/src/structures/message-interaction.ts on lines 18..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 55.

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 toBlob has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function toBlob(data: BlobResolvable): Promise<Blob> {
  if (data instanceof Blob) {
    return data;
  }
  if (isArrayBufferable(data)) {
Severity: Minor
Found in packages/utils/src/blob.ts - About 55 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

Function runHook has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function runHook<Data, Type extends HookType>(
  features: FeatureArrayResolvable,
  hook: Hook<Data, Type>,
  extraArg?: Data | MergeFunction<Data, unknown>
) {
Severity: Minor
Found in packages/purplet/src/lib/hook-run.ts - About 55 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

Function onPacket has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private onPacket(packet: GatewayReceivePayload) {
    if (packet.s) {
      this.seq = packet.s;
    }

Severity: Minor
Found in packages/gateway/src/Gateway.ts - About 55 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

export function formatUserBannerURL(userId: string, userBanner: string, opts?: ImageURLOptions) {
  return formatImageURL(`/banners/${userId}/${userBanner}`, opts);
}
Severity: Minor
Found in packages/utils/src/format/cdn.ts and 1 other location - About 50 mins to fix
packages/utils/src/format/cdn.ts on lines 129..131

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

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 boolean(fallback: boolean): Validator {
  return validate(fallback, (input, keypath) => {
    if (typeof input !== 'boolean') {
      throw new Error(`${keypath} should be true or false, if specified`);
    }
Severity: Minor
Found in packages/purplet/src/config/validators.ts and 1 other location - About 50 mins to fix
packages/purplet/src/config/validators.ts on lines 68..75

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

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 formatTeamIconURL(teamId: string, teamIcon: string, opts?: ImageURLOptions) {
  return formatImageURL(`/team-icons/${teamId}/${teamIcon}`, opts);
}
Severity: Minor
Found in packages/utils/src/format/cdn.ts and 1 other location - About 50 mins to fix
packages/utils/src/format/cdn.ts on lines 62..64

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

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 number(fallback: number): Validator {
  return validate(fallback, (input, keypath) => {
    if (typeof input !== 'number') {
      throw new Error(`${keypath} should be a number, if specified`);
    }
Severity: Minor
Found in packages/purplet/src/config/validators.ts and 1 other location - About 50 mins to fix
packages/purplet/src/config/validators.ts on lines 82..89

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

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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  async start() {
    const spinner = new Spinner({
      text: this.firstRun ? 'Initializing development mode...' : 'Reloading...',
    });
    this.firstRun = false;
Severity: Minor
Found in packages/purplet/src/cli/dev.ts - About 45 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

Function pluginFeatures has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function pluginFeatures({ config, featureScan }: FeaturesPluginOptions): Plugin {
  const hookIDs = Object.keys(featureScan);
  const featureScanValues = Object.values(featureScan);
  const fileNameList = unique(featureScanValues.map(x => Object.keys(x)).flat());
  const namesWithSymbols = fileNameList.map(filename => {
Severity: Minor
Found in packages/purplet/src/build/rollup-plugin-purplet-features.ts - About 45 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

Function or has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function or<A, B>(a: BitSerializer<A>, b: BitSerializer<B>) {
  return new BitSerializer({
    read(buffer) {
      return buffer.read() ? a.read(buffer) : b.read(buffer);
    },
Severity: Minor
Found in packages/serialize/src/serializers.ts - About 45 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

Function mergeCommands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function mergeCommands(_list: ApplicationCommandResolvable[]) {
  /** I am sorry... */
  const list: any[] = _list;

  const groups = list.filter(x => 'isSlashCommandGroup' in x && !x.name.includes(' '));
Severity: Minor
Found in packages/purplet/src/lib/hook-core-merge.ts - About 45 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

Function createConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export async function createConfig(templatesRoot: string) {
  const config = {} as ProjectConfig;

  // Calculate initial directory based off of if this directory is 'empty' or not
  // Empty is a loose check that allows some stuff like `.git`
Severity: Minor
Found in packages/create-purplet/src/prompts.ts - About 45 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 10 locations. Consider refactoring.
Open

export function formatGuildDiscoverySplashURL(
  guildId: string,
  guildDiscoverySplash: string,
  opts?: ImageURLOptions
) {
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 143..145
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatUserAvatarURL(userId: string, userAvatar: string, opts?: ImageURLOptions) {
  return formatImageURL(`/avatars/${userId}/${userAvatar}`, opts);
}
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 143..145
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatApplicationIconURL(
  applicationId: string,
  iconHash: string,
  opts?: ImageURLOptions
) {
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 143..145
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatApplicationCoverURL(
  applicationId: string,
  coverImage: string,
  opts?: ImageURLOptions
) {
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 143..145
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatRoleIconURL(roleId: string, roleIcon: string, opts?: ImageURLOptions) {
  return formatImageURL(`/role-icons/${roleId}/${roleIcon}`, opts);
}
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatApplicationAssetURL(
  applicationId: string,
  assetId: string,
  opts?: ImageURLOptions
) {
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 143..145
packages/utils/src/format/cdn.ts on lines 147..153

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

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

export function formatGuildEventCoverURL(
  eventId: string,
  eventIcon: string,
  opts?: ImageURLOptions
) {
Severity: Major
Found in packages/utils/src/format/cdn.ts and 9 other locations - About 40 mins to fix
packages/utils/src/format/cdn.ts on lines 42..44
packages/utils/src/format/cdn.ts on lines 46..48
packages/utils/src/format/cdn.ts on lines 50..56
packages/utils/src/format/cdn.ts on lines 58..60
packages/utils/src/format/cdn.ts on lines 76..78
packages/utils/src/format/cdn.ts on lines 89..95
packages/utils/src/format/cdn.ts on lines 97..103
packages/utils/src/format/cdn.ts on lines 105..111
packages/utils/src/format/cdn.ts on lines 143..145

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

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

Severity
Category
Status
Source
Language