Showing 600 of 2,050 total issues
Function getInitial
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getInitial (defaultValue: RawParam, options: Option[]): Initial {
if (defaultValue?.value) {
if (defaultValue.value instanceof Enum) {
return {
initialEnum: defaultValue.value.type,
Function BasicAccountIdBase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function BasicAccountIdBase (props: Props): React.ReactElement<Props> {
const { bytesLength, className = '', defaultValue: { value }, isDisabled, isError, label, onChange } = props;
const [defaultValue] = useState(() => (value as string)?.toString());
const _onChange = useCallback(
Function onSaveName
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
(): void => {
if (isEditingName) {
toggleIsEditingName();
}
Function useParaApiImpl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function useParaApiImpl (paraId: BN | number): Result {
const mountedRef = useIsMountedRef();
const endpoints = useParaEndpoints(paraId);
const [state, setState] = useState<Result>(() => ({
api: null,
Function extractBaseInfo
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function extractBaseInfo (api: ApiPromise, allAccounts: string[], electedDerive: DeriveStakingElected, waitingDerive: DeriveStakingWaiting, favorites: string[], totalIssuance: BN, lastEraInfo: LastEra, historyDepth?: BN): Partial<SortedTargets> {
Function checkValue
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function checkValue (hasValue: boolean, value: string | null | undefined, minLength: number, includes: string[], excludes: string[], starting: string[], notStarting: string[] = WHITESPACE, notEnding: string[] = WHITESPACE): boolean {
Function extractBaseInfo
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function extractBaseInfo (api: ApiPromise, allAccounts: string[], electedDerive: DeriveStakingElected, waitingDerive: DeriveStakingWaiting, favorites: string[], totalIssuance: BN, lastEraInfo: LastEra, historyDepth?: BN): Partial<SortedTargets> {
Function getValues
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function getValues (api: ApiPromise, value: BN | string = BN_ZERO, si: SiDef | null, bitLength: BitLength, isSigned: boolean, isZeroable: boolean, maxValue?: BN | null, decimals?: number): [string, BN, boolean] {
Function inputToBn
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function inputToBn (api: ApiPromise, input: string, si: SiDef | null, bitLength: BitLength, isSigned: boolean, isZeroable: boolean, maxValue?: BN | null, decimals?: number): [BN, boolean] {
Function getValuesFromString
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function getValuesFromString (api: ApiPromise, value: string, si: SiDef | null, bitLength: BitLength, isSigned: boolean, isZeroable: boolean, maxValue?: BN | null, decimals?: number): [string, BN, boolean] {
Function Pool
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Pool ({ className = '', members, ownAccounts, params, poolId }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const info = usePoolInfo(poolId);
const [isExpanded, toggleExpanded] = useToggle(false);
- 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"
Further reading
Function CreateEthDerivationPath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function CreateEthDerivationPath ({ className, derivePath, deriveValidation, onChange, seedType }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [addIndex, setAddIndex] = useState(0);
const [customIndex, setCustomIndex] = useState<BN | undefined>(BN_ZERO);
const [addressList] = useState<{ key: number; text: ReactNode; value: number; }[]>(
- 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"
Further reading
Function StakingApp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function StakingApp ({ basePath, className = '' }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { areAccountsLoaded, hasAccounts } = useAccounts();
const { pathname } = useLocation();
- 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"
Further reading
Function Status
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Status ({ className, heartbeat: { authoredBlocks, isOnline } = {}, isChilled, nominators, validator: { isElected, isPara } }: Props): React.ReactElement<Props> {
const { allAccounts } = useAccounts();
const isNominating = useMemo(
() => nominators && nominators.some((a) => allAccounts.includes(a)),
- 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"
Further reading
Function Code
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Code ({ className, code, onShowDeploy }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const optCode = useCall<Option<Codec>>(api.query.contracts.pristineCode || api.query.contracts.codeStorage, [code.json.codeHash]);
const [isForgetOpen, toggleIsForgetOpen] = useToggle();
- 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"
Further reading
Function Add
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Add ({ onClose }: Props): React.ReactElement {
const { t } = useTranslation();
const { api } = useApi();
const [address, setAddress] = useState<string | null>(null);
const [isAddressValid, setIsAddressValid] = useState(false);
- 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"
Further reading
Function Summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Summary ({ avgStaked, className, lastEra, lowStaked, minNominated, minNominatorBond, stakedReturn, totalIssuance, totalStaked }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const lastReward = useCall<BN>(lastEra && api.query.staking.erasValidatorReward, [lastEra], OPT_REWARD);
- 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"
Further reading
Function Summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Summary ({ avgStaked, className, lastEra, lowStaked, minNominated, minNominatorBond, stakedReturn, totalIssuance, totalStaked }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const lastReward = useCall<BN>(lastEra && api.query.staking.erasValidatorReward, [lastEra], OPT_REWARD);
- 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"
Further reading
Function StakingApp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function StakingApp ({ basePath, className = '' }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { areAccountsLoaded, hasAccounts } = useAccounts();
const { pathname } = useLocation();
- 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"
Further reading
Function Summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function Summary ({ className, issuanceActive, issuanceInactive, issuanceTotal, summary: { refActive, refCount }, withIssuance }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
return (
- 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"