fission-suite/webnative

View on GitHub

Showing 98 of 283 total issues

File filesystem.ts has 599 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as cbor from "@ipld/dag-cbor"
import * as uint8arrays from "uint8arrays"
import { CID } from "multiformats/cid"
import { throttle } from "throttle-debounce"

Severity: Major
Found in src/fs/filesystem.ts - About 1 day to fix

    File blocklist.ts has 551 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Blocklist for usernames.
     *
     * Keep in sync with the Fission API.
     * https://github.com/fission-suite/fission/blob/master/library/Fission/User/Username/Validation.hs
    Severity: Major
    Found in src/components/auth/implementation/fission/blocklist.ts - About 1 day to fix

      Function createProducer has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

      export const createProducer = async (
        dependencies: Dependencies,
        options: { username: string }
      ): Promise<AccountLinkingProducer> => {
        const { username } = options
      Severity: Minor
      Found in src/linking/producer.ts - About 7 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

      File PrivateTree.ts has 392 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as Uint8arrays from "uint8arrays"
      
      import * as Crypto from "../../components/crypto/implementation.js"
      import * as Depot from "../../components/depot/implementation.js"
      import * as History from "./PrivateHistory.js"
      Severity: Minor
      Found in src/fs/v1/PrivateTree.ts - About 5 hrs to fix

        File tree.ts has 383 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import * as DagCBOR from "@ipld/dag-cbor"
        import * as Uint8arrays from "uint8arrays"
        import { CID } from "multiformats/cid"
        
        import { BareNameFilter } from "../protocol/private/namefilter.js"
        Severity: Minor
        Found in src/fs/root/tree.ts - About 5 hrs to fix

          Function symlink has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

            async symlink(args: {
              at: Path.Directory<Partitioned<Partition>>
              referringTo: {
                path: Path.Distinctive<Partitioned<Partition>>
                username?: string
          Severity: Minor
          Found in src/fs/filesystem.ts - About 4 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

          File consumer.test.ts has 368 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as Uint8arrays from "uint8arrays"
          import expect from "expect"
          
          import * as DID from "../did/index.js"
          import * as Consumer from "./consumer.js"
          Severity: Minor
          Found in src/linking/consumer.test.ts - About 4 hrs to fix

            File index.node.test.ts has 356 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import expect from "expect"
            import * as fc from "fast-check"
            import * as Path from "./index.js"
            import { DirectoryPath, FilePath, RootBranch } from "./index.js"
            
            
            Severity: Minor
            Found in src/path/index.node.test.ts - About 4 hrs to fix

              File PublicRootWasm.ts has 344 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { CID } from "multiformats"
              import { default as init, PublicDirectory, PublicFile, PublicNode } from "wnfs"
              
              import * as Depot from "../../components/depot/implementation.js"
              import * as Manners from "../../components/manners/implementation.js"
              Severity: Minor
              Found in src/fs/v3/PublicRootWasm.ts - About 4 hrs to fix

                Function createConsumer has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                export const createConsumer = async (
                  dependencies: Dependencies,
                  options: { username: string }
                ): Promise<AccountLinkingConsumer> => {
                  const { username } = options
                Severity: Minor
                Found in src/linking/consumer.ts - About 4 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 createProducer has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const createProducer = async (
                  dependencies: Dependencies,
                  options: { username: string }
                ): Promise<AccountLinkingProducer> => {
                  const { username } = options
                Severity: Major
                Found in src/linking/producer.ts - About 3 hrs to fix

                  Function write has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                    async write(
                      path: Path.Distinctive<Partitioned<Partition>>,
                      content: Uint8Array | SoftLink | SoftLink[] | Record<string, SoftLink>,
                      options: MutationOptions = {}
                    ): Promise<this> {
                  Severity: Minor
                  Found in src/fs/filesystem.ts - About 3 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 createConsumer has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const createConsumer = async (
                    dependencies: Dependencies,
                    options: { username: string }
                  ): Promise<AccountLinkingConsumer> => {
                    const { username } = options
                  Severity: Major
                  Found in src/linking/consumer.ts - About 3 hrs to fix

                    FileSystem has 25 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class FileSystem implements API {
                    
                      account: AssociatedIdentity
                      dependencies: Dependencies
                      eventEmitter: EventEmitter<Events.FileSystem>
                    Severity: Minor
                    Found in src/fs/filesystem.ts - About 2 hrs to fix

                      File PublicTree.ts has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { CID } from "multiformats/cid"
                      
                      import * as Common from "../../common/index.js"
                      import * as Check from "../types/check.js"
                      import * as Depot from "../../components/depot/implementation.js"
                      Severity: Minor
                      Found in src/fs/v1/PublicTree.ts - About 2 hrs to fix

                        Function write has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async write(
                            path: Path.Distinctive<Partitioned<Partition>>,
                            content: Uint8Array | SoftLink | SoftLink[] | Record<string, SoftLink>,
                            options: MutationOptions = {}
                          ): Promise<this> {
                        Severity: Major
                        Found in src/fs/filesystem.ts - About 2 hrs to fix

                          Function listen has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function listen(connection: Connection, config: Config): Listeners {
                            async function handleLocalChange(params: { root: CID; path: DistinctivePath<[ Partition, ...string[] ]> }) {
                              const { root, path } = params
                              const state = await getState(config)
                          
                          
                          Severity: Major
                          Found in src/extension/index.ts - About 2 hrs to fix

                            PrivateTree has 23 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export default class PrivateTree extends BaseTree {
                            
                              crypto: Crypto.Implementation
                              depot: Depot.Implementation
                              manners: Manners.Implementation
                            Severity: Minor
                            Found in src/fs/v1/PrivateTree.ts - About 2 hrs to fix

                              File node.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*
                              
                              (づ ̄ ³ ̄)づ
                              
                              IPFS node things.
                              Severity: Minor
                              Found in src/components/depot/implementation/ipfs/node.ts - About 2 hrs to fix

                                Function handleMessage has 59 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: Major
                                Found in src/linking/producer.ts - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language