fission-suite/webnative

View on GitHub

Showing 283 of 283 total issues

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      async getName(): Promise<PrivateName> {
        const { bareNameFilter, revision } = this.header
        const revisionFilter = await namefilter.addRevision(this.crypto, bareNameFilter, this.key, revision)
        return namefilter.toPrivateName(this.crypto, revisionFilter)
      }
    Severity: Major
    Found in src/fs/v1/PrivateFile.ts and 1 other location - About 2 hrs to fix
    src/fs/v1/PrivateTree.ts on lines 286..290

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 86.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      async getName(): Promise<PrivateName> {
        const { bareNameFilter, revision } = this.header
        const revisionFilter = await namefilter.addRevision(this.crypto, bareNameFilter, this.key, revision)
        return namefilter.toPrivateName(this.crypto, revisionFilter)
      }
    Severity: Major
    Found in src/fs/v1/PrivateTree.ts and 1 other location - About 2 hrs to fix
    src/fs/v1/PrivateFile.ts on lines 174..178

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 86.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      const bitCount32 = (num: number): number => {
        const a = num - ((num >> 1) & 0x55555555)
        const b = (a & 0x33333333) + ((a >> 2) & 0x33333333)
        return ((b + (b >> 4) & 0xF0F0F0F) * 0x1010101) >> 24
      }
      Severity: Major
      Found in src/fs/protocol/private/namefilter.ts and 1 other location - About 2 hrs to fix
      src/fs/protocol/private/namefilter.test.ts on lines 122..126

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 85.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      const bitCount32 = (num: number): number => {
        const a = num - ((num >> 1) & 0x55555555)
        const b = (a & 0x33333333) + ((a >> 2) & 0x33333333)
        return ((b + (b >> 4) & 0xF0F0F0F) * 0x1010101) >> 24
      }
      Severity: Major
      Found in src/fs/protocol/private/namefilter.test.ts and 1 other location - About 2 hrs to fix
      src/fs/protocol/private/namefilter.ts on lines 143..147

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 85.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export async function exchange(crypto: Crypto.Implementation): Promise<string> {
        const pubKey = await crypto.keystore.publicExchangeKey()
        const ksAlg = await crypto.keystore.getAlgorithm()
      
        return publicKeyToDid(
      Severity: Major
      Found in src/did/local.ts and 1 other location - About 2 hrs to fix
      src/did/local.ts on lines 23..32

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 85.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export async function write(crypto: Crypto.Implementation): Promise<string> {
        const pubKey = await crypto.keystore.publicWriteKey()
        const ksAlg = await crypto.keystore.getAlgorithm()
      
        return publicKeyToDid(
      Severity: Major
      Found in src/did/local.ts and 1 other location - About 2 hrs to fix
      src/did/local.ts on lines 9..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 85.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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 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 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

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                return {
                  KEYS,
              
                  getItem: (...args) => getItem(db, ...args),
                  setItem: (...args) => setItem(db, ...args),
              Severity: Major
              Found in src/components/storage/implementation/browser.ts and 1 other location - About 2 hrs to fix
              src/components/storage/implementation/memory.ts on lines 30..37

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                return {
                  KEYS,
              
                  getItem: (...args) => getItem(mem, ...args),
                  setItem: (...args) => setItem(mem, ...args),
              Severity: Major
              Found in src/components/storage/implementation/memory.ts and 1 other location - About 2 hrs to fix
              src/components/storage/implementation/browser.ts on lines 36..43

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                updateLink(name: string, result: Depot.PutResult): this {
                  const { cid, size, isFile } = result
                  this.links[ name ] = Link.make(name, cid, isFile, size)
                  return this
                }
              Severity: Major
              Found in src/fs/bare/tree.ts and 1 other location - About 2 hrs to fix
              src/fs/root/tree.ts on lines 260..264

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 80.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                updateLink(name: string, result: Depot.PutResult): this {
                  const { cid, size, isFile } = result
                  this.links[ name ] = Link.make(name, cid, isFile, size)
                  return this
                }
              Severity: Major
              Found in src/fs/root/tree.ts and 1 other location - About 2 hrs to fix
              src/fs/bare/tree.ts on lines 145..149

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 80.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export function create({ storage }: { storage: Storage.Implementation }): Promise<Repo> {
                return Repo.create({
                  storage,
                  storageName: storage.KEYS.UCANS
                })
              Severity: Major
              Found in src/repositories/ucans.ts and 1 other location - About 2 hrs to fix
              src/repositories/cid-log.ts on lines 8..13

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 80.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export function create({ storage }: { storage: Storage.Implementation }): Promise<Repo> {
                return Repo.create({
                  storage,
                  storageName: storage.KEYS.CID_LOG
                })
              Severity: Major
              Found in src/repositories/cid-log.ts and 1 other location - About 2 hrs to fix
              src/repositories/ucans.ts on lines 10..15

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 80.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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
                Severity
                Category
                Status
                Source
                Language