polkadot-js/apps

View on GitHub

Showing 599 of 2,040 total issues

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 1044 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 956 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

        File productionRelayPolkadot.ts has 867 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 778 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

              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

              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

                  Function useAccountInfoImpl has 199 lines of code (exceeds 25 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: Major
                  Found in packages/react-hooks/src/useAccountInfo.ts - About 7 hrs to fix

                    Function sortMembers has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function sortMembers (a: MapMember, b: MapMember): number {
                      const isVoterA = a.isCandidateVoter || a.isDefenderVoter;
                    
                      return a.isHead !== b.isHead
                        ? (a.isHead ? -1 : 1)
                    Severity: Minor
                    Found in packages/page-society/src/index.tsx - About 7 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

                    Function getLocks has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function getLocks (api: ApiPromise, palletVote: PalletVote, votes: [classId: BN, refIds: BN[], casting: PalletConvictionVotingVoteCasting][], referenda: [BN, PalletReferendaReferendumInfoConvictionVotingTally][]): Lock[] {
                      const lockPeriod = api.consts[palletVote].voteLockingPeriod as BN;
                      const locks: Lock[] = [];
                    
                      for (let i = 0, voteCount = votes.length; i < voteCount; i++) {
                    Severity: Minor
                    Found in packages/page-referenda/src/useAccountLocks.ts - About 7 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

                    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

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

                    function Create ({ className = '', onClose, onStatusChange, seed: propsSeed, type: propsType }: CreateProps): React.ReactElement<CreateProps> {
                      const { t } = useTranslation();
                      const { api, isDevelopment, isEthereum } = useApi();
                      const { isLedgerEnabled } = useLedger();
                      const [{ address, derivePath, deriveValidation, isSeedValid, pairType, seed, seedType }, setAddress] = useState<AddressState>(() => generateSeed(
                    Severity: Minor
                    Found in packages/page-accounts/src/modals/Create.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

                    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

                          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

                          File Referendum.tsx has 426 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          // Copyright 2017-2024 @polkadot/app-referenda authors & contributors
                          // SPDX-License-Identifier: Apache-2.0
                          
                          import type { ChartOptions, ChartTypeRegistry, TooltipItem } from 'chart.js';
                          import type { PalletConvictionVotingTally, PalletRankedCollectiveTally, PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletReferendaTrackInfo } from '@polkadot/types/lookup';
                          Severity: Minor
                          Found in packages/page-referenda/src/Referenda/Referendum.tsx - About 6 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language