fission-suite/webnative

View on GitHub

Showing 98 of 283 total issues

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

  constructor({ account, dependencies, eventEmitter, root, localOnly }: ConstructorParams) {
    this.account = account
    this.dependencies = dependencies
    this.eventEmitter = eventEmitter

Severity: Minor
Found in src/fs/filesystem.ts - About 1 hr to fix

    Function empty has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async empty({ accountDID, dependencies, rootKey, wnfsWasm }: {
        accountDID: string
        dependencies: Dependencies
        rootKey: Uint8Array
        wnfsWasm?: boolean
    Severity: Minor
    Found in src/fs/root/tree.ts - About 1 hr to fix

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

        async getRecurse(skel: Skeleton, path: NonEmptyPath): Promise<SkeletonInfo | Child | null> {
          const head = path[ 0 ]
          const child = skel[ head ] || null
          const nextPath = nextNonEmpty(path)
      
      
      Severity: Minor
      Found in src/fs/v1/PublicTree.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 mv has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async mv(from: Path, to: Path): Promise<this> {
          const node = await this.get(from)
          if (node === null) {
            throw new Error(`Path does not exist: ${Pathing.log(from)}`)
          }
      Severity: Minor
      Found in src/fs/base/tree.ts - About 1 hr to fix

        Function handleUserChallenge has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const handleUserChallenge = async (
          crypto: Crypto.Implementation,
          sessionKey: CryptoKey,
          data: string
        ): Promise<Result<{ pin: number[]; audience: string }, Error>> => {
        Severity: Minor
        Found in src/linking/producer.ts - About 1 hr to fix

          Function deleteByDomain has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function deleteByDomain(
            endpoints: Fission.Endpoints,
            dependencies: Dependencies,
            domain: string
          ): Promise<void> {
          Severity: Minor
          Found in src/apps/index.ts - About 1 hr to fix

            Function runMutationOnNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async runMutationOnNode(
                path: DistinctivePath<Partitioned<Partition>>,
                handlers: {
                  public(root: UnixTree, relPath: Path.Segments): Promise<void>
                  private(node: PrivateTree | PrivateFile, relPath: Path.Segments): Promise<void>
            Severity: Minor
            Found in src/fs/filesystem.ts - About 1 hr to fix

              Function ls has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async ls(path: Path): Promise<Links> {
                  const root = await this.root
              
                  const { result: node } = await this.withError(
                    root.getNode(path, this.store),
              Severity: Minor
              Found in src/fs/v3/PublicRootWasm.ts - About 1 hr to fix

                Function challengeOnce has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            const challengeOnce = () => {
                              let called = false
                
                              return {
                                confirmPin: async () => {
                Severity: Minor
                Found in src/linking/producer.ts - About 1 hr to fix

                  Function sharePrivate has 29 lines of code (exceeds 25 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 1 hr to fix

                    Function private has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          private: async (node, relPath) => {
                            if (FsTypeChecks.isFile(node)) {
                              throw new Error("Cannot add a soft link to a file")
                            }
                    
                    
                    Severity: Minor
                    Found in src/fs/filesystem.ts - About 1 hr to fix

                      Function generateSessionKey has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const generateSessionKey = async (
                        crypto: Crypto.Implementation,
                        didThrowaway: string
                      ): Promise<{ sessionKey: CryptoKey; sessionKeyMessage: string }> => {
                        const sessionKey = await crypto.aes.genKey(Crypto.SymmAlg.AES_GCM)
                      Severity: Minor
                      Found in src/linking/producer.ts - About 1 hr to fix

                        Function update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function update(
                          endpoints: Fission.Endpoints,
                          dependencies: Dependencies,
                          cidInstance: CID,
                          proof: Ucan.Ucan
                        Severity: Minor
                        Found in src/components/reference/implementation/fission/data-root.ts - About 1 hr to fix

                          Function handleUserChallenge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const handleUserChallenge = async (
                            crypto: Crypto.Implementation,
                            sessionKey: CryptoKey,
                            data: string
                          ): Promise<Result<{ pin: number[]; audience: string }, Error>> => {
                          Severity: Minor
                          Found in src/linking/producer.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 create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function create(repoName: string): IPFSRepo {
                            const memoryDs = new MemoryDatastore()
                          
                            return createRepo(
                              repoName,
                          Severity: Minor
                          Found in src/components/depot/implementation/ipfs/node/repo.ts - About 1 hr to fix

                            Function create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export async function create(
                              endpoints: Fission.Endpoints,
                              dependencies: Dependencies,
                              subdomain: Maybe<string>
                            ): Promise<AppMetadata> {
                            Severity: Minor
                            Found in src/apps/index.ts - About 1 hr to fix

                              Function getState has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function getState(config: Config): Promise<State> {
                                const { capabilities, dependencies, namespace, session } = config
                              
                                const agentDID = await DID.agent(dependencies.crypto)
                                let accountDID = null
                              Severity: Minor
                              Found in src/extension/index.ts - About 1 hr to fix

                                Function linkDevice has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export async function linkDevice(
                                  dependencies: Dependencies,
                                  username: string,
                                  data: Record<string, unknown>
                                ): Promise<void> {
                                Severity: Minor
                                Found in src/components/auth/implementation/wnfs.ts - About 1 hr to fix

                                  Function mv has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    async mv(from: Path.Distinctive<PartitionedNonEmpty<Partition>>, to: Path.Distinctive<PartitionedNonEmpty<Partition>>): Promise<this> {
                                      const sameTree = Path.isSamePartition(from, to)
                                  
                                      if (!Path.isSameKind(from, to)) {
                                        const kindFrom = Path.kind(from)
                                  Severity: Minor
                                  Found in src/fs/filesystem.ts - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                      if (
                                        typeof val === "object" &&
                                        hasProp(val, "version") &&
                                        hasProp(val, "code") && isNum(val.code) &&
                                        hasProp(val, "hash") && isObject(val.hash) && Object.values(val.hash).every(isNum)
                                    Severity: Major
                                    Found in src/common/cid.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language