fission-suite/webnative

View on GitHub

Showing 98 of 283 total issues

Function getDirectChild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  async getDirectChild(name: string): Promise<Child | null> {
    let child = null

    if (this.children[ name ]) {
      return this.children[ name ]
Severity: Minor
Found in src/fs/v1/PublicTree.ts - About 55 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 privateNode has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  crypto: Crypto.Implementation,
  depot: Depot.Implementation,
  manners: Manners.Implementation,
  reference: Reference.Implementation,
  rootTree: RootTree,
Severity: Major
Found in src/fs/share.ts - About 50 mins to fix

    Function findBareNameFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    async function findBareNameFilter(
      crypto: Crypto.Implementation,
      storage: Storage.Implementation,
      accountDID: string,
      map: Record<string, PrivateNode>,
    Severity: Minor
    Found in src/fs/root/tree.ts - About 45 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 linkDevice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const linkDevice = async (
      auth: Auth.Implementation<Components>,
      crypto: Crypto.Implementation,
      sessionKey: Uint8Array,
      username: string,
    Severity: Minor
    Found in src/linking/consumer.ts - About 45 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 getNode has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      crypto: Crypto.Implementation,
      depot: Depot.Implementation,
      manners: Manners.Implementation,
      reference: Reference.Implementation,
      mmpt: MMPT,
    Severity: Minor
    Found in src/fs/v1/PrivateTree.ts - About 45 mins to fix

      Function findLatestRevision has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export const findLatestRevision = async (
        crypto: Crypto.Implementation,
        mmpt: MMPT,
        bareName: BareNameFilter,
        key: Uint8Array,
      Severity: Minor
      Found in src/fs/protocol/private/index.ts - About 45 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 getDirectChild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        async getDirectChild(name: string): Promise<PrivateTree | PrivateFile | null> {
          let child = null
      
          if (this.children[ name ]) {
            return this.children[ name ]
      Severity: Minor
      Found in src/fs/v1/PrivateTree.ts - About 45 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 deeply nested control flow statements.
      Open

                          if (ls.sessionKey) {
                            await declineDelegation(dependencies.crypto, ls.sessionKey, finishDelegation)
                          } else {
                            handleLinkingError(new LinkingError("Producer missing session key when declining account delegation"))
                          }
      Severity: Major
      Found in src/linking/producer.ts - About 45 mins to fix

        Function sharePrivate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          async sharePrivate(paths: Path.Distinctive<Path.PartitionedNonEmpty<Path.Private>>[], { sharedBy, shareWith }: { sharedBy?: SharedBy; shareWith: string | string[] }): Promise<ShareDetails> {
            const verifiedPaths = paths.filter(path => {
              return Path.isOnRootBranch(Path.RootBranch.Private, path)
            })
        
        
        Severity: Minor
        Found in src/fs/filesystem.ts - About 45 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 deeply nested control flow statements.
        Open

                            if (ls.sessionKey) {
                              await delegateAccount(
                                dependencies.auth,
                                dependencies.crypto,
                                ls.sessionKey,
        Severity: Major
        Found in src/linking/producer.ts - About 45 mins to fix

          Function request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export async function request(
            endpoints: Fission.Endpoints,
            dependencies: Dependencies,
            options: RequestOptions = {}
          ): Promise<void> {
          Severity: Minor
          Found in src/components/capabilities/implementation/fission-lobby.ts - About 45 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 findBareNameFilter has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            crypto: Crypto.Implementation,
            storage: Storage.Implementation,
            accountDID: string,
            map: Record<string, PrivateNode>,
            path: DistinctivePath<Path.Segments>
          Severity: Minor
          Found in src/fs/root/tree.ts - About 35 mins to fix

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

              dependencies: Dependencies,
              pkg: IPFSPackage,
              peersUrl: string,
              repoName: string,
              logging: boolean
            Severity: Minor
            Found in src/components/depot/implementation/ipfs/node.ts - About 35 mins to fix

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

              export function decodeCID(val: CID | object | string): CID {
                const cid = CID.asCID(val)
                if (cid) return cid
              
                // String format
              Severity: Minor
              Found in src/common/cid.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 rmRecurse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                async rmRecurse(path: Path, onUpdate: Maybe<UpdateCallback>): Promise<this> {
                  const [ head, ...nextPath ] = path
              
                  if (!head) {
                    throw new Error("Invalid path: empty")
              Severity: Minor
              Found in src/fs/base/tree.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 report has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function report(peer: Multiaddr, status: Status): void {
                peerConnections = peerConnections
                  .filter(connection => connection.peer !== peer)
                  .concat({ peer, status })
              
              
              Severity: Minor
              Found in src/components/depot/implementation/ipfs/node.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

              Avoid too many return statements within this function.
              Open

                  return child
              Severity: Major
              Found in src/fs/v1/PrivateTree.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return false
                Severity: Major
                Found in src/ucan/token.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      if (!check.isPrivateTreeInfo(reloadedNode)) return null
                  Severity: Major
                  Found in src/fs/v1/PrivateTree.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        if (nextChild !== undefined) return this.getRecurse(nextChild, rest)
                    Severity: Major
                    Found in src/fs/v1/PrivateTree.ts - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language