fission-suite/webnative

View on GitHub

Showing 283 of 283 total issues

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

describe("is object", () => {
  it(IT_FC, () => {
    fc.assert(
      fc.property(fc.object(), data => {
        expect(check.isObject(data)).toEqual(true)
Severity: Major
Found in src/common/type-check.node.test.ts and 1 other location - About 1 day to fix
src/common/type-check.node.test.ts on lines 219..253

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

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

describe("is string", () => {
  it(IT_FC, () => {
    fc.assert(
      fc.property(fc.string(), data => {
        expect(check.isString(data)).toEqual(true)
Severity: Major
Found in src/common/type-check.node.test.ts and 1 other location - About 1 day to fix
src/common/type-check.node.test.ts on lines 255..289

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

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 3 locations. Consider refactoring.
Open

describe("is just", () => {
  it(IT_FC, () => {
    fc.assert(
      fc.property(fc.oneof(
        { arbitrary: fc.object(), weight: 10 },
Severity: Major
Found in src/common/type-check.node.test.ts and 2 other locations - About 1 day to fix
src/common/type-check.node.test.ts on lines 41..70
src/common/type-check.node.test.ts on lines 103..132

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

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 3 locations. Consider refactoring.
Open

describe("not null", () => {
  it(IT_FC, () => {
    fc.assert(
      fc.property(fc.oneof(
        { arbitrary: fc.object(), weight: 10 },
Severity: Major
Found in src/common/type-check.node.test.ts and 2 other locations - About 1 day to fix
src/common/type-check.node.test.ts on lines 72..101
src/common/type-check.node.test.ts on lines 103..132

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

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 3 locations. Consider refactoring.
Open

describe("is value", () => {
  it(IT_FC, () => {
    fc.assert(
      fc.property(fc.oneof(
        { arbitrary: fc.object(), weight: 10 },
Severity: Major
Found in src/common/type-check.node.test.ts and 2 other locations - About 1 day to fix
src/common/type-check.node.test.ts on lines 41..70
src/common/type-check.node.test.ts on lines 72..101

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

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

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

              private: async (node, relPath) => {
                const links = Array.isArray(content)
                  ? content
                  : TypeChecks.isObject(content)
                    ? Object.values(content) as Array<SoftLink>
      Severity: Major
      Found in src/fs/filesystem.ts and 1 other location - About 7 hrs to fix
      src/fs/filesystem.ts on lines 272..289

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

      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

              public: async (root, relPath) => {
                const links = Array.isArray(content)
                  ? content
                  : TypeChecks.isObject(content)
                    ? Object.values(content) as Array<SoftLink>
      Severity: Major
      Found in src/fs/filesystem.ts and 1 other location - About 7 hrs to fix
      src/fs/filesystem.ts on lines 290..308

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

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

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

        async createOrUpdateChildFile(content: Uint8Array, name: string, onUpdate: Maybe<UpdateCallback>): Promise<PublicFile> {
          const existing = await this.getDirectChild(name)
          let file: PublicFile
          if (existing === null) {
            file = await PublicFile.create(this.depot, content)
      Severity: Major
      Found in src/fs/v1/PublicTree.ts and 1 other location - About 7 hrs to fix
      src/fs/bare/tree.ts on lines 71..83

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

      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

        async createOrUpdateChildFile(content: Uint8Array, name: string, onUpdate: Maybe<UpdateCallback>): Promise<BareFile> {
          const existing = await this.getDirectChild(name)
          let file: BareFile
          if (existing === null) {
            file = await BareFile.create(this.depot, content)
      Severity: Major
      Found in src/fs/bare/tree.ts and 1 other location - About 7 hrs to fix
      src/fs/v1/PublicTree.ts on lines 135..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 177.

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

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

              static async fromLatestName(
                crypto: Crypto.Implementation,
                depot: Depot.Implementation,
                manners: Manners.Implementation,
                reference: Reference.Implementation,
            Severity: Major
            Found in src/fs/v1/PrivateTree.ts and 2 other locations - About 4 hrs to fix
            src/fs/v1/PrivateTree.ts on lines 133..144
            src/fs/v1/PrivateTree.ts on lines 159..170

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

            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 3 locations. Consider refactoring.
            Open

              static async fromName(
                crypto: Crypto.Implementation,
                depot: Depot.Implementation,
                manners: Manners.Implementation,
                reference: Reference.Implementation,
            Severity: Major
            Found in src/fs/v1/PrivateTree.ts and 2 other locations - About 4 hrs to fix
            src/fs/v1/PrivateTree.ts on lines 133..144
            src/fs/v1/PrivateTree.ts on lines 146..157

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

            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 3 locations. Consider refactoring.
            Open

              static async fromBareNameFilter(
                crypto: Crypto.Implementation,
                depot: Depot.Implementation,
                manners: Manners.Implementation,
                reference: Reference.Implementation,
            Severity: Major
            Found in src/fs/v1/PrivateTree.ts and 2 other locations - About 4 hrs to fix
            src/fs/v1/PrivateTree.ts on lines 146..157
            src/fs/v1/PrivateTree.ts on lines 159..170

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

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