Showing 600 of 2,050 total issues
Function extractRewards
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function extractRewards (labels: string[], erasRewards: DeriveEraRewards[], ownSlashes: DeriveOwnSlashes[], allPoints: DeriveStakerPoints[], divisor: BN): LineData {
Function canary
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function canary (ctx: CanvasRenderingContext2D, w: number, h: number, s: number, f: (ctx: CanvasRenderingContext2D, path: Path2D) => void): void {
Function applyFilter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function applyFilter (validators: ValidatorInfo[], medianComm: number, allIdentity: Record<string, DeriveHasIdentity>, { daysPayout, isBabe, maxPaid, withElected, withGroup, withIdentity, withPayout, withoutComm, withoutOver }: Flags, nominatedBy?: NominatedByMap): ValidatorInfo[] {
Function getChartResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function getChartResult (totalEligible: BN, isConvictionVote: boolean, info: PalletReferendaReferendumInfoConvictionVotingTally | PalletReferendaReferendumInfoRankedCollectiveTally, track: PalletReferendaTrackInfo, trackGraph: CurveGraph): ChartResultExt[] | null {
Function createResult
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function createResult (bestNumber: BlockNumber, minContribution: BN, funds: Campaign[], leased: ParaId[], prev: Campaigns): Campaigns {
Function extractRewards
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function extractRewards (labels: string[], erasRewards: DeriveEraRewards[], ownSlashes: DeriveOwnSlashes[], allPoints: DeriveStakerPoints[], divisor: BN): LineData {
Function getTrackInfo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function getTrackInfo (api: ApiPromise, specName: string, palletReferenda: string, tracks: TrackDescription[], trackId?: number): TrackInfoExt | undefined {
Function isFundUpdated
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function isFundUpdated (bestNumber: BlockNumber, minContribution: BN, { info: { cap, end, raised }, paraId }: Campaign, leased: ParaId[], allPrev: Campaigns): boolean {
Function getFiltered
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function getFiltered (isOwn: boolean, stakingOverview: DeriveStakingOverview | undefined, favorites: string[], next?: string[], ownStashIds?: string[]): Filtered {
Function checkVisible
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
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 {
Function extractParams
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
async function extractParams (api: ApiPromise, address: string, options: Partial<SignerOptions>, getLedger: () => Ledger, setQrState: (state: QrState) => void): Promise<['qr' | 'signing', string, Partial<SignerOptions>, boolean]> {
Function mergeCurrent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function mergeCurrent (ranges: [number, number][], auctionInfo: AuctionInfo, prev: Winning[] | undefined, optCurrent: Option<WinningData>, blockOffset: BN): Winning[] | undefined {
Function getStatus
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numMembers: number, section: CollectiveType): State {
Function checkVisibility
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function checkVisibility (api: ApiPromise, address: string, accountInfo: DeriveAccountInfo, filterName = '', onlyNamed = false): boolean {
Function fitsInView
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function fitsInView (positionY: VerticalPosition, trigger: ElementPosition, popupWindowHeight: number, windowSize: WindowSize, scrollY: number): boolean {
Function calculateOptions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function calculateOptions (aspectRatio: number, values: Value[], jsonValues: string, max: number, showLabels: boolean): State {
Function getValuesFromBn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function getValuesFromBn (valueBn: BN, si: SiDef | null, isSigned: boolean, isZeroable: boolean, _decimals?: number): [string, BN, boolean] {
Function createHdr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function createHdr (bn: string, hash: string, parent: string, author: string | null, isEmpty = false): LinkHeader {
Function isValidNumber
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function isValidNumber (bn: BN, bitLength: BitLength, isSigned: boolean, isZeroable: boolean, maxValue?: BN | null): boolean {
Function NewNominator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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>({});
- Read upRead up
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"