Showing 600 of 2,050 total issues
Function SidebarEditableSection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function SidebarEditableSection ({ accountIndex, address, isBeingEdited, onUpdateName, sidebarRef }: Props): React.ReactElement<Props> {
const { flags, isEditing, isEditingName, isEditingTags, name, onForgetAddress, onSaveName, onSaveTags, setIsEditingName, setIsEditingTags, setName, setTags, tags, toggleIsEditingName, toggleIsEditingTags } = useAccountInfo(address);
const refs = useMemo(
() => [sidebarRef],
- 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 Modules
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function Modules ({ className = '', onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [{ defaultValues, isIterable, key, params }, setKey] = useState<KeyState>(() => ({ defaultValues: undefined, isHeadKey: true, isIterable: false, key: api.query.timestamp?.now || api.query.system.events, params: [] }));
const [{ isValid, values }, setValues] = useState<ValState>(() => ({ isValid: true, values: [] }));
- 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 StakingRedeemable
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function StakingRedeemable ({ className = '', isPool, stakingInfo }: Props): React.ReactElement<Props> | null {
const { api } = useApi();
const { allAccounts } = useAccounts();
const { t } = useTranslation();
const spanCount = useCall<number>(api.query.staking.slashingSpans, [stakingInfo?.stashId], OPT_SPAN);
- 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 Tags
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function Tags ({ children, className = '', isEditable, isEditing, onChange, onSave, onToggleIsEditing, value, withEditButton = true, withTitle }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const contents = useMemo(
() => value.length
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
function Summary ({ events, maxBlockWeight, signedBlock }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const [deposits, transfers, weight] = useMemo(
- 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 AccountItems
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function AccountItems ({ className, infos = [] }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const NO_NAME = ` - ${t('no name')} -`;
const [infoIndex, setInfoIndex] = useState(0);
- 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 ProposalDisplay
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function ProposalDisplay ({ className = '', isMember, members, proposal: { council, id, proposal }, withSend }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [isExpanded, toggleIsExpanded] = 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 redirect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function redirect (basePath: string, location: Location, items: (TabItem | false | null | undefined)[], hidden?: string[] | null | false): void {
if (location.pathname !== basePath) {
// Has the form /staking/query/<something>
const [,, section] = location.pathname.split('/');
const alias = items.find((v) => v && v.alias === section);
- 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 useProxiesImpl
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function useProxiesImpl (address?: string | null): State | null {
const { api } = useApi();
const { allAccounts } = useAccounts();
const mountedRef = useIsMountedRef();
const [known, setState] = useState<State | null>(null);
Function extractState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractState (ownStashes?: StakerState[]): State {
if (!ownStashes) {
return {};
}
Function dryRun
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function dryRun () {
let contract: SubmittableExtrinsic<'promise'> | null = null;
let error: string | null = null;
try {
Function getTrackOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTrackOptions (api: ApiPromise, specName: string, palletReferenda: string, tracks: TrackDescription[], include?: (BN | number)[], exclude?: (BN | number)[]): TrackOption[] {
const includeBn = include?.map((v) => bnToBn(v));
const excludeBn = exclude?.map((v) => bnToBn(v));
return tracks
Function extractState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractState (ownStashes?: StakerState[]): State {
if (!ownStashes) {
return {};
}
Function CallDisplay
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CallDisplay (props: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { className = '', defaultValue: { value }, isDisabled, label, withLabel } = props;
if (!isDisabled) {
Function _onChangeAddress
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(addressInput: string): void => {
let address = '';
let isAddressValid = true;
let isAddressExisting = false;
let isPublicKey = false;
Function getStatus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numMembers: number, section: CollectiveType): State {
const [instance] = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), section) || [section];
const modLocation = isFunction(api.tx[instance as 'technicalCommittee']?.close)
? instance
: null;
Function Entry
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Entry (): React.ReactElement | null {
const bestNumber = useBestNumber();
const { value } = useParams<{ value: string }>();
const [stateValue, setStateValue] = useState<string | undefined>(value);
Function retrieveAll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function retrieveAll (): Promise<Defaults> {
const _keys = await retrieveJson('index.json') as string[];
const keys = _keys.filter((lng) => lng !== 'en');
const missing = keys.filter((lng) => !languageCache[lng]);
const english = await retrieveEnglish();
Function extractTipState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractTipState (tip: PalletTipsOpenTip | OpenTipTo225, allAccounts: string[]): TipState {
const closesAt = tip.closes.unwrapOr(null);
let finder: AccountId | null = null;
let deposit: Balance | null = null;
Function _doChange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
(): void => {
const account = address && keyring.getPair(address);
if (!account) {
return;