polkadot-js/apps

View on GitHub

Showing 1,720 of 1,720 total issues

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

export const kusama: Record<string, TrackInfo[]> = {
  fellowshipReferenda: [
    {
      compare: compareFellowshipRank(0),
      id: 0,
Severity: Major
Found in packages/apps-config/src/api/params/tracks/kusama.ts and 1 other location - About 5 days to fix
packages/apps-config/src/api/params/tracks/polkadot.ts on lines 33..208

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

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 const polkadot: Record<string, TrackInfo[]> = {
  fellowshipReferenda: [
    {
      compare: compareFellowshipRank(0),
      id: 0,
Severity: Major
Found in packages/apps-config/src/api/params/tracks/polkadot.ts and 1 other location - About 5 days to fix
packages/apps-config/src/api/params/tracks/kusama.ts on lines 33..208

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

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

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

// Automatically generated, do not edit

Severity: Major
Found in packages/react-components/src/IdentityIcon/RoboHash/sets/index.ts - About 4 days to fix

    File testing.ts has 1030 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright 2017-2024 @polkadot/apps-config authors & contributors
    // SPDX-License-Identifier: Apache-2.0
    
    import type { EndpointOption } from './types.js';
    
    
    Severity: Major
    Found in packages/apps-config/src/endpoints/testing.ts - About 2 days to fix

      File productionRelayKusama.ts has 942 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright 2017-2024 @polkadot/apps-config authors & contributors
      // SPDX-License-Identifier: Apache-2.0
      
      import type { EndpointOption } from './types.js';
      
      
      Severity: Major
      Found in packages/apps-config/src/endpoints/productionRelayKusama.ts - About 2 days to fix

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

          return (
            <>
              {isOpen && (
                <Modal
                  header={t('Close proposal')}
        Severity: Major
        Found in packages/page-tech-comm/src/Proposals/Close.tsx and 1 other location - About 2 days to fix
        packages/page-council/src/Motions/Close.tsx on lines 34..80

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

        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

          return (
            <>
              {isOpen && (
                <Modal
                  header={t('Close proposal')}
        Severity: Major
        Found in packages/page-council/src/Motions/Close.tsx and 1 other location - About 2 days to fix
        packages/page-tech-comm/src/Proposals/Close.tsx on lines 35..81

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

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

        // Copyright 2017-2024 @polkadot/apps-config authors & contributors
        // SPDX-License-Identifier: Apache-2.0
        
        import type { EndpointOption } from './types.js';
        
        
        Severity: Major
        Found in packages/apps-config/src/endpoints/productionRelayPolkadot.ts - About 2 days to fix

          File testingRelayRococo.ts has 780 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright 2017-2024 @polkadot/apps-config authors & contributors
          // SPDX-License-Identifier: Apache-2.0
          
          import type { EndpointOption } from './types.js';
          
          
          Severity: Major
          Found in packages/apps-config/src/endpoints/testingRelayRococo.ts - About 1 day to fix

            File Account.tsx has 714 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Copyright 2017-2024 @polkadot/app-accounts authors & contributors
            // SPDX-License-Identifier: Apache-2.0
            
            import type { ApiPromise } from '@polkadot/api';
            import type { SubmittableExtrinsic } from '@polkadot/api/types';
            Severity: Major
            Found in packages/page-accounts/src/Accounts/Account.tsx - About 1 day to fix

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

              function BountyGiveUpCurator ({ curatorId, description, index, toggleOpen }: Props) {
                const { t } = useTranslation();
                const { unassignCurator } = useBounties();
              
                return (
              Severity: Major
              Found in packages/page-bounties/src/BountyExtraActions/GiveUp.tsx and 1 other location - About 1 day to fix
              packages/page-bounties/src/BountyExtraActions/BountyRejectCurator.tsx on lines 21..54

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

              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 BountyRejectCurator ({ curatorId, description, index, toggleOpen }: Props) {
                const { t } = useTranslation();
                const { unassignCurator } = useBounties();
              
                return (
              packages/page-bounties/src/BountyExtraActions/GiveUp.tsx on lines 21..54

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

              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 useProxiesImpl (): Record<string, string[]> {
                const { api } = useApi();
                const { allAccounts } = useAccounts();
                const mountedRef = useIsMountedRef();
                const [state, setState] = useState<Record<string, string[]>>({});
              Severity: Major
              Found in packages/page-gilt/src/useProxies.ts and 1 other location - About 1 day to fix
              packages/page-nis/src/useProxies.ts on lines 14..40

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

              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 useProxiesImpl (): Record<string, string[]> {
                const { api } = useApi();
                const { allAccounts } = useAccounts();
                const mountedRef = useIsMountedRef();
                const [state, setState] = useState<Record<string, string[]>>({});
              Severity: Major
              Found in packages/page-nis/src/useProxies.ts and 1 other location - About 1 day to fix
              packages/page-gilt/src/useProxies.ts on lines 14..40

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

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

              function DayItem ({ className, item: { blockNumber, date, info, type }, showAllEvents }: Props): React.ReactElement<Props> {
                const { t } = useTranslation();
              
                const [description, setDescription] = useState<string>('');
              
              
              Severity: Minor
              Found in packages/page-calendar/src/DayItem.tsx - About 1 day 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

              function ChartPrefs ({ labels, validatorId }: Props): React.ReactElement<Props> {
                const { t } = useTranslation();
                const { api } = useApi();
                const params = useMemo(() => [validatorId, false], [validatorId]);
                const stakerPrefs = useCall<DeriveStakerPrefs[]>(api.derive.staking.stakerPrefs, params);
              Severity: Major
              Found in packages/page-staking/src/Query/ChartPrefs.tsx and 1 other location - About 1 day to fix
              packages/page-staking/src/Query/ChartPoints.tsx on lines 43..74

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

              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 ChartPoints ({ labels, validatorId }: Props): React.ReactElement<Props> {
                const { t } = useTranslation();
                const { api } = useApi();
                const params = useMemo(() => [validatorId, false], [validatorId]);
                const stakerPoints = useCall<DeriveStakerPoints[]>(api.derive.staking.stakerPoints, params);
              Severity: Major
              Found in packages/page-staking/src/Query/ChartPoints.tsx and 1 other location - About 1 day to fix
              packages/page-staking/src/Query/ChartPrefs.tsx on lines 48..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 266.

              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 AddressInfo.tsx has 639 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // Copyright 2017-2024 @polkadot/react-components authors & contributors
              // SPDX-License-Identifier: Apache-2.0
              
              import type { DeriveBalancesAccountData, DeriveBalancesAll, DeriveDemocracyLock, DeriveStakingAccount } from '@polkadot/api-derive/types';
              import type { Raw } from '@polkadot/types';
              Severity: Major
              Found in packages/react-components/src/AddressInfo.tsx - About 1 day to fix

                File production.ts has 568 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // Copyright 2017-2024 @polkadot/apps-config authors & contributors
                // SPDX-License-Identifier: Apache-2.0
                
                import type { EndpointOption } from './types.js';
                
                
                Severity: Major
                Found in packages/apps-config/src/endpoints/production.ts - About 1 day to fix

                  Function InputMegaGas has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function InputMegaGas ({ className,
                    estimatedWeight,
                    estimatedWeightV2,
                    isCall,
                    weight: { executionTime,
                  Severity: Minor
                  Found in packages/page-contracts/src/shared/InputMegaGas.tsx - About 1 day to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language