polkadot-js/apps

View on GitHub

Showing 609 of 2,082 total issues

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

function Collection ({ className, value: { details, id, ipfsData } }: Props): React.ReactElement<Props> {
  const { t } = useTranslation();
  const name = ipfsData?.name || '';
  let imageLink = '';

Severity: Minor
Found in packages/page-nfts/src/Overview/Collection.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

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

function InputExtrinsic ({ className = '', defaultValue, filter, isDisabled, label, onChange, withLabel }: Props): React.ReactElement<Props> {
  const { api } = useApi();
  const [optionsMethod, setOptionsMethod] = useState<DropdownOptions>(() => methodOptions(api, defaultValue.section, filter));
  const [optionsSection] = useState<DropdownOptions>(() => sectionOptions(api, filter));
  const [value, setValue] = useState<SubmittableExtrinsicFunction<'promise'>>((): SubmittableExtrinsicFunction<'promise'> => defaultValue);
Severity: Minor
Found in packages/react-components/src/InputExtrinsic/index.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

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

function renderItem ({ error, extrinsic, id, removeItem, rpc, status }: QueueTx): React.ReactNode {
  let { method, section } = rpc;

  if (extrinsic) {
    const found = extrinsic.registry.findMetaCall(extrinsic.callIndex);
Severity: Minor
Found in packages/react-components/src/Status/index.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

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

function AddressToggle ({ address, className = '', filter, isHidden, noToggle, onChange, value }: Props): React.ReactElement<Props> | null {
  const { apiIdentity } = useApi();
  const info = useDeriveAccountInfo(address);

  const isVisible = useMemo(
Severity: Minor
Found in packages/react-components/src/AddressToggle.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

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

function SettingsApp ({ basePath, onStatusChange }: Props): React.ReactElement<Props> {
  const { t } = useTranslation();
  const { api, isApiConnected, isApiReady, isDevelopment } = useApi();
  const numExtensions = useCounter();

Severity: Minor
Found in packages/page-settings/src/index.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

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

function AddressMini ({ balance, bonded, children, className = '', iconInfo, isHighlight, isPadded = true, label, labelBalance, nameExtra, onNameClick, summary, value, withAddress = true, withBalance = false, withBonded = false, withLockedVote = false, withName = true, withShrink = false, withSidebar = true }: Props): React.ReactElement<Props> | null {
  if (!value) {
    return null;
  }

Severity: Minor
Found in packages/react-components/src/AddressMini.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

Avoid too many return statements within this function.
Open

        return true;
Severity: Major
Found in packages/page-staking-legacy/src/Targets/index.tsx - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return true;
    Severity: Major
    Found in packages/page-staking-legacy/src/Targets/index.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return (
          <Banner type='warning'>
            <p>{t('It is recommended that you create/store your accounts securely and externally from the app. On {{yourBrowser}} the following browser extensions are available for use -', {
              replace: {
                yourBrowser: stringUpperFirst(browserName)
      Severity: Major
      Found in packages/page-accounts/src/Accounts/BannerExtension.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return { error: (error as Error).message };
        Severity: Major
        Found in packages/page-accounts/src/modals/Create.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return false;
          Severity: Major
          Found in packages/page-staking-legacy/src/Targets/index.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return isAscii(value)
                ? [true, false, stringToU8a(value)]
                : [value === '0x', false, new Uint8Array([])];
            Severity: Major
            Found in packages/react-params/src/Param/BaseBytes.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                  return Component || Unknown;
                Severity: Major
                Found in packages/react-params/src/Param/findComponent.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return BN_ZERO;
                  Severity: Major
                  Found in packages/react-params/src/initValue.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return '0x';
                    Severity: Major
                    Found in packages/react-params/src/initValue.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return bnMin(
                            BN_BILLION,
                            factor
                              .mul(BN_BILLION)
                              .div(div)
                      Severity: Major
                      Found in packages/page-referenda/src/util.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return bnMin(
                                BN_BILLION,
                                bnMax(
                                  BN_ZERO,
                                  factor
                        Severity: Major
                        Found in packages/page-referenda/src/util.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return undefined;
                          Severity: Major
                          Found in packages/react-params/src/initValue.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return true;
                            Severity: Major
                            Found in packages/page-staking/src/Targets/index.tsx - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language