polkadot-js/apps

View on GitHub

Showing 1,717 of 1,717 total issues

Function UploadModal has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

function UploadModal ({ className, file, onClose = NOOP, onSuccess = NOOP }: Props): React.ReactElement<Props> {
  const { t } = useTranslation();
  const endpoints = useMemo(
    () => createAuthIpfsEndpoints(t)
      .sort(() => Math.random() > 0.5 ? -1 : 1)
Severity: Minor
Found in packages/page-files/src/UploadModal.tsx - About 6 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

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

function filter (records: EventRecord[]): Changes<u32> {
  const added: u32[] = [];
  const removed: u32[] = [];

  records.forEach(({ event: { data: [id], method } }): void => {
Severity: Major
Found in packages/page-nfts/src/useCollectionIds.ts and 1 other location - About 6 hrs to fix
packages/page-assets/src/useAssetIds.ts on lines 17..30

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

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

function filter (records: EventRecord[]): Changes<u32> {
  const added: u32[] = [];
  const removed: u32[] = [];

  records.forEach(({ event: { data: [id], method } }): void => {
Severity: Major
Found in packages/page-assets/src/useAssetIds.ts and 1 other location - About 6 hrs to fix
packages/page-nfts/src/useCollectionIds.ts on lines 17..30

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

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 index.ts has 451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2017-2024 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { createGlobalStyle } from 'styled-components';

Severity: Minor
Found in packages/react-components/src/styles/index.ts - About 6 hrs to fix

    File index.tsx has 447 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2017-2024 @polkadot/react-components authors & contributors
    // SPDX-License-Identifier: Apache-2.0
    
    import React from 'react';
    
    
    Severity: Minor
    Found in packages/react-components/src/Table/index.tsx - About 6 hrs to fix

      File TxSigned.tsx has 445 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright 2017-2024 @polkadot/react-signer authors & contributors
      // SPDX-License-Identifier: Apache-2.0
      
      import type { ApiPromise } from '@polkadot/api';
      import type { SignerOptions } from '@polkadot/api/submittable/types';
      Severity: Minor
      Found in packages/react-signer/src/TxSigned.tsx - About 6 hrs to fix

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

                    <Modal.Columns hint={t('This account will make the bid for the nis and pay all associated fees.')}>
                      <InputAddress
                        filter={proxiedAccounts}
                        label={t('use proxied account')}
                        labelExtra={
        Severity: Major
        Found in packages/page-nis/src/Overview/BidAdd.tsx and 1 other location - About 6 hrs to fix
        packages/page-gilt/src/Overview/BidAdd.tsx on lines 58..79

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

        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

                    <Modal.Columns hint={t('This account will make the bid for the gilt and pay all associated fees.')}>
                      <InputAddress
                        filter={proxiedAccounts}
                        label={t('use proxied account')}
                        labelExtra={
        Severity: Major
        Found in packages/page-gilt/src/Overview/BidAdd.tsx and 1 other location - About 6 hrs to fix
        packages/page-nis/src/Overview/BidAdd.tsx on lines 57..78

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

        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 TotalInactive ({ children, className = '', label }: Props): React.ReactElement<Props> | null {
          const { api } = useApi();
          const inactiveIssuance = useCall<string>(api.query.balances?.inactiveIssuance);
        
          return (
        Severity: Major
        Found in packages/react-query/src/TotalInactive.tsx and 1 other location - About 6 hrs to fix
        packages/react-query/src/TotalIssuance.tsx on lines 16..31

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

        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 TotalIssuance ({ children, className = '', label }: Props): React.ReactElement<Props> | null {
          const { api } = useApi();
          const totalIssuance = useCall<string>(api.query.balances?.totalIssuance);
        
          return (
        Severity: Major
        Found in packages/react-query/src/TotalIssuance.tsx and 1 other location - About 6 hrs to fix
        packages/react-query/src/TotalInactive.tsx on lines 16..31

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

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

        function filter (records: EventRecord[]): Changes<Hash> {
          const added: Hash[] = [];
          const removed: Hash[] = [];
        
          records.forEach(({ event: { data: [hash], method } }): void => {
        Severity: Major
        Found in packages/page-preimages/src/usePreimages.ts and 4 other locations - About 6 hrs to fix
        packages/page-ranked/src/useMemberIds.ts on lines 16..29
        packages/page-referenda/src/useReferendaIds.ts on lines 17..30
        packages/page-staking2/src/useValidatorsAll.ts on lines 23..36
        packages/page-whitelist/src/useHashes.ts on lines 18..31

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

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

        function filter (records: EventRecord[]): Changes<AccountId32> {
          const added: AccountId32[] = [];
          const removed: AccountId32[] = [];
        
          records.forEach(({ event: { data: [id], method } }): void => {
        Severity: Major
        Found in packages/page-ranked/src/useMemberIds.ts and 4 other locations - About 6 hrs to fix
        packages/page-preimages/src/usePreimages.ts on lines 20..33
        packages/page-referenda/src/useReferendaIds.ts on lines 17..30
        packages/page-staking2/src/useValidatorsAll.ts on lines 23..36
        packages/page-whitelist/src/useHashes.ts on lines 18..31

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

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

        function eventFilter (records: EventRecord[]): Changes<AccountId32> {
          const added: AccountId32[] = [];
          const removed: AccountId32[] = [];
        
          records.forEach(({ event: { data: [id], method } }): void => {
        Severity: Major
        Found in packages/page-staking2/src/useValidatorsAll.ts and 4 other locations - About 6 hrs to fix
        packages/page-preimages/src/usePreimages.ts on lines 20..33
        packages/page-ranked/src/useMemberIds.ts on lines 16..29
        packages/page-referenda/src/useReferendaIds.ts on lines 17..30
        packages/page-whitelist/src/useHashes.ts on lines 18..31

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

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

        function filter (records: EventRecord[]): Changes<u32> {
          const added: u32[] = [];
          const removed: u32[] = [];
        
          records.forEach(({ event: { data: [id], method } }): void => {
        Severity: Major
        Found in packages/page-referenda/src/useReferendaIds.ts and 4 other locations - About 6 hrs to fix
        packages/page-preimages/src/usePreimages.ts on lines 20..33
        packages/page-ranked/src/useMemberIds.ts on lines 16..29
        packages/page-staking2/src/useValidatorsAll.ts on lines 23..36
        packages/page-whitelist/src/useHashes.ts on lines 18..31

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

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

        function filter (records: EventRecord[]): Changes<Hash> {
          const added: Hash[] = [];
          const removed: Hash[] = [];
        
          records.forEach(({ event: { data: [hash], method } }): void => {
        Severity: Major
        Found in packages/page-whitelist/src/useHashes.ts and 4 other locations - About 6 hrs to fix
        packages/page-preimages/src/usePreimages.ts on lines 20..33
        packages/page-ranked/src/useMemberIds.ts on lines 16..29
        packages/page-referenda/src/useReferendaIds.ts on lines 17..30
        packages/page-staking2/src/useValidatorsAll.ts on lines 23..36

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

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

        function useAccountInfoImpl (value: string | null, isContract = false): UseAccountInfo {
          const { api } = useApi();
          const { accounts: { isAccount }, addresses: { isAddress } } = useKeyring();
          const accountInfo = useDeriveAccountInfo(value);
          const accountFlags = useDeriveAccountFlags(value);
        Severity: Minor
        Found in packages/react-hooks/src/useAccountInfo.ts - About 6 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

        const METADATA_FETCH_OPTIONS = {
          transform: (data: string | undefined): CollectionSupportedMetadata | null => {
            if (!data) {
              return null;
            }
        Severity: Major
        Found in packages/page-nfts/src/useCollectionInfos.ts and 1 other location - About 6 hrs to fix
        packages/page-nfts/src/AccountItems/useItemsInfos.ts on lines 19..38

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

        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 METADATA_FETCH_OPTIONS = {
          transform: (data: string | undefined): ItemSupportedMetadata | null => {
            if (!data) {
              return null;
            }
        Severity: Major
        Found in packages/page-nfts/src/AccountItems/useItemsInfos.ts and 1 other location - About 6 hrs to fix
        packages/page-nfts/src/useCollectionInfos.ts on lines 26..45

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

        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 Queue ({ className, value: { balance, index, numItems } }: Props): React.ReactElement<Props> {
          return (
            <tr className={className}>
              <Table.Column.Id value={index} />
              <td className='number all'>
        Severity: Major
        Found in packages/page-nis/src/Overview/Queue.tsx and 1 other location - About 6 hrs to fix
        packages/page-gilt/src/Overview/Queue.tsx on lines 17..29

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

        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 Queue ({ className, value: { balance, index, numItems } }: Props): React.ReactElement<Props> {
          return (
            <tr className={className}>
              <Table.Column.Id value={index} />
              <td className='number all'>
        Severity: Major
        Found in packages/page-gilt/src/Overview/Queue.tsx and 1 other location - About 6 hrs to fix
        packages/page-nis/src/Overview/Queue.tsx on lines 17..29

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

        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