polkadot-js/apps

View on GitHub

Showing 600 of 2,050 total issues

Function interleave has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    (winners: WinnerData[], asIs: boolean): WinnerData[] => {
      if (asIs || !newRaise || !auctionInfo?.leasePeriod || !loans) {
        return winners;
      }

Severity: Minor
Found in packages/page-parachains/src/Auctions/Auction.tsx - About 1 hr to fix

    Function TestModal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function TestModal () {
      const [isOpen, toggleIsOpen] = useToggle();
    
      return (
        <>
    Severity: Minor
    Found in packages/react-components/src/Modal/Modal.spec.tsx - About 1 hr to fix

      Function _onSend has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          (): void => {
            let extrinsics: SubmittableExtrinsic<'promise'>[] | undefined;
      
            if (propsExtrinsic) {
              extrinsics = Array.isArray(propsExtrinsic)
      Severity: Minor
      Found in packages/react-components/src/TxButton.tsx - About 1 hr to fix

        Function createItemsRef has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createItemsRef (t: (key: string, options?: { replace: Record<string, unknown> }) => string): TabItem[] {
          return [
            {
              isRoot: true,
              name: 'chain',
        Severity: Minor
        Found in packages/page-explorer/src/index.tsx - About 1 hr to fix

          Function checkVisibility has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function checkVisibility (api: ApiPromise, address: string, accountInfo: DeriveAccountInfo, filterName = '', onlyNamed = false): boolean {
            let isVisible = false;
            const filterLower = filterName.toLowerCase();
          
            if (filterLower || onlyNamed) {
          Severity: Minor
          Found in packages/react-components/src/util/checkVisibility.tsx - About 1 hr to fix

            Function Message has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Message ({ className = '', index, lastResult, message, onSelect }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
            
              const _onSelect = useCallback(
                () => onSelect && onSelect(index),
            Severity: Minor
            Found in packages/page-contracts/src/shared/Message.tsx - About 1 hr 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 Status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Status ({ isChilled, isElected, isMain, isPara, isRelay, nominators = NO_NOMS, onlineCount, onlineMessage }: Props): React.ReactElement<Props> {
              const { allAccounts } = useAccounts();
              const blockCount = onlineCount && onlineCount.toNumber();
            
              const isNominating = useMemo(
            Severity: Minor
            Found in packages/page-staking-legacy/src/Validators/Address/Status.tsx - About 1 hr 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 FormatBalance has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function FormatBalance ({ children, className = '', format, formatIndex, isShort, label, labelPost, value, valueFormatted, withCurrency, withSi }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const { api } = useApi();
            
              const formatInfo = useMemo(
            Severity: Minor
            Found in packages/react-query/src/FormatBalance.tsx - About 1 hr 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 groupAccounts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]> {
              const ret: Record<GroupName, string[]> = {
                accounts: [],
                chopsticks: [],
                hardware: [],
            Severity: Minor
            Found in packages/page-accounts/src/Accounts/index.tsx - About 1 hr 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 Member has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Member ({ bestNumber, className, info: { accountId, role }, isPrime, isVoter }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const { api } = useApi();
              const { allAccounts } = useAccounts();
              const info = useMemberInfo(accountId);
            Severity: Minor
            Found in packages/page-alliance/src/Members/Member.tsx - About 1 hr 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 Multisig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Multisig ({ className = '', onClose, onStatusChange }: Props): React.ReactElement<Props> {
              const { api, isDevelopment } = useApi();
              const { t } = useTranslation();
              const availableSignatories = useKnownAddresses();
              const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
            Severity: Minor
            Found in packages/page-accounts/src/modals/MultisigCreate.tsx - About 1 hr 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 Status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Status ({ isChilled, isElected, isMain, isPara, isRelay, nominators = NO_NOMS, onlineCount, onlineMessage }: Props): React.ReactElement<Props> {
              const { allAccounts } = useAccounts();
              const blockCount = onlineCount && onlineCount.toNumber();
            
              const isNominating = useMemo(
            Severity: Minor
            Found in packages/page-staking/src/Validators/Address/Status.tsx - About 1 hr 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 extractEvents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function extractEvents (api: ApiPromise, lastBlock: SignedBlockExtended, prev: Result): Result {
              const backed: EventMap = {};
              const included: EventMap = {};
              const timeout: EventMap = {};
              const blockNumber = lastBlock.block.header.number.unwrap();
            Severity: Minor
            Found in packages/page-parachains/src/Overview/useEvents.ts - About 1 hr 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 expandOngoing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function expandOngoing (api: ApiPromise, info: Referendum['info'], track?: PalletReferendaTrackInfo): Expanded {
              const ongoing = info.asOngoing;
              const proposalHash = getPreimageHash(api, ongoing.proposal || (ongoing as unknown as { proposalHash: Hash }).proposalHash).proposalHash;
              let prepareEnd: BN | null = null;
              let decideEnd: BN | null = null;
            Severity: Minor
            Found in packages/page-referenda/src/Referenda/RefOngoing.tsx - About 1 hr 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 Voters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Voters ({ isAye, members, threshold, votes }: Props): React.ReactElement<Props> | null {
              const { t } = useTranslation();
            
              const count = useMemo(
                (): string => {
            Severity: Minor
            Found in packages/page-council/src/Motions/Voters.tsx - About 1 hr 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 needsApiCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function needsApiCheck (api: ApiPromise): boolean {
              if (typeof api.query.staking.erasStakersOverview === 'function') {
                return false;
              }
            
            
            Severity: Minor
            Found in packages/apps-routing/src/stakingLegacy.ts - About 1 hr 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 RegisterThread has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function RegisterThread ({ className, nextParaId, onClose, ownedIds }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const { api } = useApi();
              const [accountId, setAccountId] = useState<string | null>(null);
              const [paraId, setParaId] = useState<BN | undefined>();
            Severity: Minor
            Found in packages/page-parachains/src/Parathreads/RegisterThread.tsx - About 1 hr 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 Auction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Auction ({ auctionInfo, campaigns, className, winningData }: Props): React.ReactElement<Props> {
              const { t } = useTranslation();
              const { api } = useApi();
              const rangeMax = useLeaseRangeMax();
              const newRaise = useCall<ParaId[]>(api.query.crowdloan.newRaise);
            Severity: Minor
            Found in packages/page-parachains/src/Auctions/Auction.tsx - About 1 hr 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 Teleport has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function Teleport ({ onClose }: Props): React.ReactElement<Props> | null {
              const { t } = useTranslation();
              const { api } = useApi();
              const [amount, setAmount] = useState<BN | undefined>(BN_ZERO);
              const [recipientId, setRecipientId] = useState<string | null>(null);
            Severity: Minor
            Found in packages/page-parachains/src/Teleport.tsx - About 1 hr 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 TipCreate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function TipCreate ({ members }: Props): React.ReactElement<Props> | null {
              const { t } = useTranslation();
              const { api } = useApi();
              const [isOpen, toggleOpen] = useToggle();
              const [accountId, setAccountId] = useState<string | null>(null);
            Severity: Minor
            Found in packages/page-treasury/src/Tips/TipCreate.tsx - About 1 hr 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