polkadot-js/apps

View on GitHub

Showing 600 of 2,052 total issues

Avoid too many return statements within this function.
Open

        return {
          action: `${section}.${method}`,
          message: EVENT_MESSAGE,
          status: 'event'
        };
Severity: Major
Found in packages/react-hooks/src/ctx/Queue.tsx - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return null;
    Severity: Major
    Found in packages/apps/src/overlays/Connecting.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return true;
      Severity: Major
      Found in packages/apps-routing/src/staking.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return t('Sign (no submission)');
        Severity: Major
        Found in packages/react-signer/src/TxSigned.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return false;
          Severity: Major
          Found in packages/apps/src/Menu/index.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return '';
            Severity: Major
            Found in packages/react-hooks/src/useMetadataFetch.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return false;
              Severity: Major
              Found in packages/apps/src/Menu/index.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return ['signing', address, { ...options, signer: new AccountSigner(api.registry, pair) }, false];
                Severity: Major
                Found in packages/react-signer/src/TxSigned.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return findMissingApis(api, needsApi, needsApiInstances, needsApiCheck).length === 0;
                  Severity: Major
                  Found in packages/apps/src/Menu/index.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return (value as string).toString();
                    Severity: Major
                    Found in packages/page-js/src/Output.tsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return `{${[...value.entries()]
                            .map(([k, v]) => `${(k as string).toString()}: ${format(v)}`)
                            .join(', ')}}`;
                      Severity: Major
                      Found in packages/page-js/src/Output.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return true;
                        Severity: Major
                        Found in packages/react-components/src/AddressInfo.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return <div>{item.value.toString().split(',').join(', ')}</div>;
                          Severity: Major
                          Found in packages/page-explorer/src/BlockInfo/Logs.tsx - About 30 mins to fix

                            Function tattoo3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function tattoo3 (ctx: CanvasRenderingContext2D, bits: boolean[]): void {
                              ctx.lineWidth = 0.01;
                            
                              for (let i = 0; i < 8; ++i) {
                                for (let j = 0; j < 32; ++j) {
                            Severity: Minor
                            Found in packages/page-society/src/draw/canary.ts - About 25 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

                            Function Nominate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function Nominate ({ className = '', controllerId, nominating, onChange, poolId, stashId, targets: { nominateIds = [] }, withSenders }: Props): React.ReactElement<Props> {
                              const { t } = useTranslation();
                              const { api } = useApi();
                              const [favorites] = useFavorites(STORE_FAVS_BASE);
                              const [selected, setSelected] = useState<string[]>(nominating || []);
                            Severity: Minor
                            Found in packages/page-staking-legacy/src/Actions/partials/Nominate.tsx - About 25 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

                            Function Rebag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function Rebag ({ bagUpper, stashIds }: Props): React.ReactElement<Props> | null {
                              const { t } = useTranslation();
                              const { api } = useApi();
                              const [accountId, setAccountId] = useState<string | null>(null);
                              const [isVisible, toggleVisible] = useToggle();
                            Severity: Minor
                            Found in packages/page-staking-legacy/src/Bags/Rebag.tsx - About 25 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

                            Function transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              transform: ([[ids], opts]: [[string[]], Option<PalletNominationPoolsPoolMember>[]]): OwnPoolBase[] => {
                                const pools: OwnPoolBase[] = [];
                            
                                for (let i = 0; i < ids.length; i++) {
                                  if (opts[i].isSome) {
                            Severity: Minor
                            Found in packages/page-staking2/src/Pools/useOwnPools.ts - About 25 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

                            Function execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export async function execute (extrinsic: SubmittableExtrinsic<'promise'>, singer: KeyringPair, logger = { info: console.log }): Promise<void> {
                              let currentTxDone = false;
                            
                              function sendStatusCb ({ events = [], status }: { events?: EventRecord[], status: ExtrinsicStatus; }) {
                                if (status.isInvalid) {
                            Severity: Minor
                            Found in packages/test-support/src/transaction/execute.ts - About 25 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

                            Function NewValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function NewValidator ({ isInElection, minCommission, 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/NewValidator.tsx - About 25 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

                            Function extractBaseInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function extractBaseInfo (api: ApiPromise, allAccounts: string[], electedDerive: DeriveStakingElected, waitingDerive: DeriveStakingWaiting, favorites: string[], totalIssuance: BN, lastEraInfo: LastEra, historyDepth?: BN): Partial<SortedTargets> {
                              const [elected, nominators] = extractSingle(api, allAccounts, electedDerive, favorites, lastEraInfo, historyDepth, true);
                              const [waiting] = extractSingle(api, allAccounts, waitingDerive, favorites, lastEraInfo);
                              const activeTotals = elected
                                .filter(({ isActive }) => isActive)
                            Severity: Minor
                            Found in packages/page-staking-legacy/src/useSortedTargets.ts - About 25 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