polkadot-js/tools

View on GitHub

Showing 8 of 16 total issues

Function main has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function main (): Promise<number> {
  const [[regA, metaA, verA], [regB, metaB, verB]] = await Promise.all([getMetadata(ws1), getMetadata(ws2)]);
  const a = metaA.asLatest;
  const b = metaB.asLatest;

Severity: Major
Found in packages/metadata-cmp/src/runcli.ts - About 3 hrs to fix

    Function logArray has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function logArray (pad: number, title: string, pre: string, arr: string[], chunkSize: number) {
    Severity: Minor
    Found in packages/metadata-cmp/src/runcli.ts - About 35 mins to fix

      Function log has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function log (pad: number, title: string, pre: string, text: string, post?: string) {
      Severity: Minor
      Found in packages/metadata-cmp/src/runcli.ts - About 35 mins to fix

        Function cmdSubmit has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export default async function cmdSubmit (account: string, blocks: number | undefined, endpoint = '', tx: string | undefined, [txName, ...params]: string[]): Promise<void> {
        Severity: Minor
        Found in packages/signer-cli/src/cmdSubmit.ts - About 35 mins to fix

          Function createLog has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function createLog (pad: number, title: string, pre: string, text: string, post?: string): string {
          Severity: Minor
          Found in packages/metadata-cmp/src/runcli.ts - About 35 mins to fix

            Function cmdSendOffline has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export default async function cmdSendOffline (account: string, blocks: number | undefined, endpoint = '', nonce: number | undefined | Index, [tx, ...params]: string[]): Promise<void> {
            Severity: Minor
            Found in packages/signer-cli/src/cmdSendOffline.ts - About 35 mins to fix

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

              export default async function cmdSendOffline (account: string, blocks: number | undefined, endpoint = '', nonce: number | undefined | Index, [tx, ...params]: string[]): Promise<void> {
                const provider = new WsProvider(endpoint);
                const api = await ApiPromise.create({ provider });
                const options: Partial<SignerOptions> = { signer: new RawSigner() };
              
              
              Severity: Minor
              Found in packages/signer-cli/src/cmdSendOffline.ts - 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 calculateAtOne has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function calculateAtOne (atOffset: number, test: string[], address: string): GeneratorCalculation {
                return {
                  count: test.reduce((count, c, index): number => {
                    if (index === count) {
                      count += (c === '?' || c === address.charAt(index + atOffset)) ? 1 : 0;
              Severity: Minor
              Found in packages/vanitygen/src/calculate.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