polkadot-js/apps

View on GitHub

Showing 600 of 2,050 total issues

Function extractRewards has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function extractRewards (labels: string[], erasRewards: DeriveEraRewards[], ownSlashes: DeriveOwnSlashes[], allPoints: DeriveStakerPoints[], divisor: BN): LineData {
Severity: Minor
Found in packages/page-staking-legacy/src/Query/ChartRewards.tsx - About 35 mins to fix

    Function canary has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function canary (ctx: CanvasRenderingContext2D, w: number, h: number, s: number, f: (ctx: CanvasRenderingContext2D, path: Path2D) => void): void {
    Severity: Minor
    Found in packages/page-society/src/draw/canary.ts - About 35 mins to fix

      Function applyFilter has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function applyFilter (validators: ValidatorInfo[], medianComm: number, allIdentity: Record<string, DeriveHasIdentity>, { daysPayout, isBabe, maxPaid, withElected, withGroup, withIdentity, withPayout, withoutComm, withoutOver }: Flags, nominatedBy?: NominatedByMap): ValidatorInfo[] {
      Severity: Minor
      Found in packages/page-staking/src/Targets/index.tsx - About 35 mins to fix

        Function getChartResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function getChartResult (totalEligible: BN, isConvictionVote: boolean, info: PalletReferendaReferendumInfoConvictionVotingTally | PalletReferendaReferendumInfoRankedCollectiveTally, track: PalletReferendaTrackInfo, trackGraph: CurveGraph): ChartResultExt[] | null {
        Severity: Minor
        Found in packages/page-referenda/src/Referenda/Referendum.tsx - About 35 mins to fix

          Function createResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function createResult (bestNumber: BlockNumber, minContribution: BN, funds: Campaign[], leased: ParaId[], prev: Campaigns): Campaigns {
          Severity: Minor
          Found in packages/page-parachains/src/useFunds.ts - About 35 mins to fix

            Function extractRewards has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function extractRewards (labels: string[], erasRewards: DeriveEraRewards[], ownSlashes: DeriveOwnSlashes[], allPoints: DeriveStakerPoints[], divisor: BN): LineData {
            Severity: Minor
            Found in packages/page-staking/src/Query/ChartRewards.tsx - About 35 mins to fix

              Function getTrackInfo has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function getTrackInfo (api: ApiPromise, specName: string, palletReferenda: string, tracks: TrackDescription[], trackId?: number): TrackInfoExt | undefined {
              Severity: Minor
              Found in packages/page-referenda/src/util.ts - About 35 mins to fix

                Function isFundUpdated has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function isFundUpdated (bestNumber: BlockNumber, minContribution: BN, { info: { cap, end, raised }, paraId }: Campaign, leased: ParaId[], allPrev: Campaigns): boolean {
                Severity: Minor
                Found in packages/page-parachains/src/useFunds.ts - About 35 mins to fix

                  Function getFiltered has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function getFiltered (isOwn: boolean, stakingOverview: DeriveStakingOverview | undefined, favorites: string[], next?: string[], ownStashIds?: string[]): Filtered {
                  Severity: Minor
                  Found in packages/page-staking/src/Validators/CurrentList.tsx - About 35 mins to fix

                    Function checkVisible has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function checkVisible ({ api, isApiConnected, isApiReady, isDevelopment: isApiDevelopment }: ApiProps, allowTeleport: boolean, hasAccounts: boolean, hasSudo: boolean, { isDevelopment, isHidden, needsAccounts, needsApi, needsApiCheck, needsApiInstances, needsSudo, needsTeleport }: Route['display']): boolean {
                    Severity: Minor
                    Found in packages/apps/src/Menu/index.tsx - About 35 mins to fix

                      Function extractParams has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      async function extractParams (api: ApiPromise, address: string, options: Partial<SignerOptions>, getLedger: () => Ledger, setQrState: (state: QrState) => void): Promise<['qr' | 'signing', string, Partial<SignerOptions>, boolean]> {
                      Severity: Minor
                      Found in packages/react-signer/src/TxSigned.tsx - About 35 mins to fix

                        Function mergeCurrent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function mergeCurrent (ranges: [number, number][], auctionInfo: AuctionInfo, prev: Winning[] | undefined, optCurrent: Option<WinningData>, blockOffset: BN): Winning[] | undefined {
                        Severity: Minor
                        Found in packages/page-parachains/src/useWinningData.ts - About 35 mins to fix

                          Function getStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numMembers: number, section: CollectiveType): State {
                          Severity: Minor
                          Found in packages/react-hooks/src/useVotingStatus.ts - About 35 mins to fix

                            Function checkVisibility has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            export function checkVisibility (api: ApiPromise, address: string, accountInfo: DeriveAccountInfo, filterName = '', onlyNamed = false): boolean {
                            Severity: Minor
                            Found in packages/react-components/src/util/checkVisibility.tsx - About 35 mins to fix

                              Function fitsInView has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function fitsInView (positionY: VerticalPosition, trigger: ElementPosition, popupWindowHeight: number, windowSize: WindowSize, scrollY: number): boolean {
                              Severity: Minor
                              Found in packages/react-components/src/Popup/utils.ts - About 35 mins to fix

                                Function calculateOptions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function calculateOptions (aspectRatio: number, values: Value[], jsonValues: string, max: number, showLabels: boolean): State {
                                Severity: Minor
                                Found in packages/react-components/src/Chart/HorizBar.tsx - About 35 mins to fix

                                  Function getValuesFromBn has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function getValuesFromBn (valueBn: BN, si: SiDef | null, isSigned: boolean, isZeroable: boolean, _decimals?: number): [string, BN, boolean] {
                                  Severity: Minor
                                  Found in packages/react-components/src/InputNumber.tsx - About 35 mins to fix

                                    Function createHdr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    function createHdr (bn: string, hash: string, parent: string, author: string | null, isEmpty = false): LinkHeader {
                                    Severity: Minor
                                    Found in packages/page-explorer/src/Forks.tsx - About 35 mins to fix

                                      Function isValidNumber has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function isValidNumber (bn: BN, bitLength: BitLength, isSigned: boolean, isZeroable: boolean, maxValue?: BN | null): boolean {
                                      Severity: Minor
                                      Found in packages/react-components/src/InputNumber.tsx - About 35 mins to fix

                                        Function NewNominator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function NewNominator ({ isInElection, targets }: Props): React.ReactElement<Props> {
                                          const { t } = useTranslation();
                                          const { api } = useApi();
                                          const [isVisible, toggleVisible] = useToggle();
                                          const [{ bondTx, controllerId, controllerTx, stashId }, setBondInfo] = useState<BondInfo>({});
                                        Severity: Minor
                                        Found in packages/page-staking-legacy/src/Actions/NewNominator.tsx - About 35 mins to fix

                                        Cognitive Complexity

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

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

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

                                        Further reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language