fission-suite/webnative

View on GitHub

Showing 98 of 283 total issues

Function fromCID has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static async fromCID({ accountDID, dependencies, cid, permissions }: {
    accountDID: string
    dependencies: Dependencies
    cid: CID
    permissions?: Permissions
Severity: Major
Found in src/fs/root/tree.ts - About 2 hrs to fix

    Function symlink has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async symlink(args: {
        at: Path.Directory<Partitioned<Partition>>
        referringTo: {
          path: Path.Distinctive<Partitioned<Partition>>
          username?: string
    Severity: Major
    Found in src/fs/filesystem.ts - About 2 hrs to fix

      Function validatePermissions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      export function validatePermissions(
        repo: Repository<Ucan.Ucan>,
        { app, fs, raw }: Permissions.Permissions
      ): Maybe<Ucan.Ucan> {
        let ucan
      Severity: Minor
      Found in src/capabilities.ts - About 2 hrs 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 implementation has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function implementation(
        getIpfs: () => Promise<{ ipfs: IPFS, repo: IPFSRepo }>
      ): Promise<Implementation> {
        return {
      
      
      Severity: Major
      Found in src/components/depot/implementation/ipfs.ts - About 2 hrs to fix

        Function monitorBitswap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function monitorBitswap(dependencies: Dependencies, ipfs: IPFS, peersUrl: string, verbose: boolean): Promise<void> {
          const cidCount: { [ k: string ]: number } = {}
          const seen: string[] = []
          const peers = await listPeers(dependencies.storage, peersUrl)
        
        
        Severity: Major
        Found in src/components/depot/implementation/ipfs/node.ts - About 2 hrs to fix

          Function handleMessage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const handleMessage = async (event: MessageEvent): Promise<void> => {
              const { data } = event
              const message = data.arrayBuffer ? new TextDecoder().decode(await data.arrayBuffer()) : data
          
              switch (ls.step) {
          Severity: Minor
          Found in src/linking/consumer.ts - About 2 hrs to fix

            Function handleSessionKey has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const handleSessionKey = async (
              crypto: Crypto.Implementation,
              temporaryRsaPrivateKey: CryptoKey,
              data: string
            ): Promise<Result<Uint8Array, Error>> => {
            Severity: Minor
            Found in src/linking/consumer.ts - About 1 hr to fix

              Function session has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function session(
                components: Components,
                authedUsername: Maybe<string>,
                config: Configuration,
                eventEmitters: { fileSystem: Events.Emitter<Events.FileSystem>; session: Events.Emitter<Events.Session<Session>> }
              Severity: Minor
              Found in src/components/auth/implementation/wnfs.ts - About 1 hr to fix

                Function handleSessionKey has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                export const handleSessionKey = async (
                  crypto: Crypto.Implementation,
                  temporaryRsaPrivateKey: CryptoKey,
                  data: string
                ): Promise<Result<Uint8Array, Error>> => {
                Severity: Minor
                Found in src/linking/consumer.ts - About 1 hr 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 loadShare has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async loadShare({ shareId, sharedBy }: { shareId: string; sharedBy: string }): Promise<UnixTree> {
                    const ourExchangeDid = await DID.exchange(this.dependencies.crypto)
                    const theirRootDid = await this.dependencies.reference.didRoot.lookup(sharedBy)
                
                    // Share key
                Severity: Minor
                Found in src/fs/filesystem.ts - About 1 hr to fix

                  Function getClassifiedViaPostMessage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function getClassifiedViaPostMessage(
                    endpoints: Fission.Endpoints,
                    crypto: Crypto.Implementation
                  ): Promise<LobbyClassifiedInfo> {
                    const didExchange = await DID.exchange(crypto)
                  Severity: Minor
                  Found in src/components/capabilities/implementation/fission-lobby.ts - About 1 hr to fix

                    Function getRecurse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async getRecurse(
                        nodeInfo: PrivateSkeletonInfo | SoftLink,
                        parts: string[]
                      ): Promise<PrivateTree | PrivateFile | null> {
                        const [ head, ...rest ] = parts
                    Severity: Minor
                    Found in src/fs/v1/PrivateTree.ts - About 1 hr 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 fromCID has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      static async fromCID({ accountDID, dependencies, cid, permissions }: {
                        accountDID: string
                        dependencies: Dependencies
                        cid: CID
                        permissions?: Permissions
                    Severity: Minor
                    Found in src/fs/root/tree.ts - About 1 hr 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 36 lines of code (exceeds 25 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 1 hr to fix

                      Function build has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export async function build({
                        addSignature = true,
                        audience,
                        dependencies,
                        facts = [],
                      Severity: Minor
                      Found in src/ucan/token.ts - About 1 hr 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 loadShare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                        async loadShare({ shareId, sharedBy }: { shareId: string; sharedBy: string }): Promise<UnixTree> {
                          const ourExchangeDid = await DID.exchange(this.dependencies.crypto)
                          const theirRootDid = await this.dependencies.reference.didRoot.lookup(sharedBy)
                      
                          // Share key
                      Severity: Minor
                      Found in src/fs/filesystem.ts - About 1 hr 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 session has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export async function session(
                        components: Components,
                        authedUsername: Maybe<string>,
                        config: Configuration,
                        eventEmitters: { fileSystem: Events.Emitter<Events.FileSystem>; session: Events.Emitter<Events.Session<Session>> }
                      Severity: Minor
                      Found in src/components/auth/implementation/wnfs.ts - About 1 hr 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 request has 35 lines of code (exceeds 25 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 1 hr to fix

                        Function addPrivateLogEntry has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async addPrivateLogEntry(depot: Depot.Implementation, cid: CID): Promise<void> {
                            const log = [ ...this.privateLog ]
                            let idx = Math.max(0, log.length - 1)
                        
                            // get last chunk
                        Severity: Minor
                        Found in src/fs/root/tree.ts - About 1 hr to fix

                          Function putLinks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const putLinks = async (
                            depot: Depot.Implementation,
                            links: Links | SimpleLinks
                          ): Promise<Depot.PutResult> => {
                            const dagLinks = Object
                          Severity: Minor
                          Found in src/fs/protocol/basic.ts - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language