rescribet/link-lib

View on GitHub

Showing 139 of 139 total issues

Function broadcast has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
        if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
            return this.currentBroadcast || Promise.resolve();
        }

Severity: Minor
Found in src/LinkedRenderStore.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

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

export class DataProcessor implements LinkedDataAPI, DeltaProcessor {
    public accept: { [k: string]: string };

    private _dispatch?: MiddlewareActionHandler;
    private readonly bulkEndpoint: string;
Severity: Minor
Found in src/processor/DataProcessor.ts - About 2 hrs to fix

    Function execActionByIRI has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
    
            const [graph, blobs = []] = dataTuple;
    
            if (this.store.getInternalStore().store.getRecord(subject.value) === undefined) {
    Severity: Minor
    Found in src/processor/DataProcessor.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 getRenderComponent has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public getRenderComponent(
            types: Id[],
            fields: Id[],
            topology: Id,
            defaultType: Id,
    Severity: Minor
    Found in src/ComponentStore/ComponentStore.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

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

    export class RDFStore implements DeltaProcessor {
        public langPrefs: string[] = Array.from(typeof navigator !== "undefined"
            ? (navigator.languages || [navigator.language])
            : ["en"]);
        private changedResources: Set<string> = new Set();
    Severity: Minor
    Found in src/RDFStore.ts - About 2 hrs to fix

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

              it("processes quad delta", () => {
                  const { lrs } = getBasicStore();
      
                  lrs.processDelta([
                    [schemaT, rdfs.label, rdfFactory.literal("test"), ld.replace],
      Severity: Major
      Found in src/__tests__/LinkedRenderStore/delta.spec.ts and 1 other location - About 2 hrs to fix
      src/__tests__/LinkedRenderStore/delta.spec.ts on lines 40..48

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

      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

              it("processes quadruple delta", () => {
                  const { lrs } = getBasicStore();
      
                  lrs.processDelta([
                    [schemaT, rdfs.label, rdfFactory.literal("test"), ld.replace],
      Severity: Major
      Found in src/__tests__/LinkedRenderStore/delta.spec.ts and 1 other location - About 2 hrs to fix
      src/__tests__/LinkedRenderStore/delta.spec.ts on lines 30..38

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

      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

              it("wildcards object", () => {
                  expect(store.match(schema.Person, rdfx.type, null))
                      .toEqual([
                          [schema.Person, rdfx.type, schema.Thing, defaultGraph],
                          [schema.Person, rdfx.type, rdfs.Resource, defaultGraph],
      Severity: Major
      Found in src/store/__tests__/RDFAdapter.spec.ts and 1 other location - About 2 hrs to fix
      src/store/__tests__/RDFAdapter.spec.ts on lines 60..66

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

      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

              it("returns a all quads", () => {
                  expect(store.match(schema.Person, rdfx.type, null))
                      .toEqual([
                          [schema.Person, rdfx.type, schema.Thing, defaultGraph],
                          [schema.Person, rdfx.type, rdfs.Resource, defaultGraph],
      Severity: Major
      Found in src/store/__tests__/RDFAdapter.spec.ts and 1 other location - About 2 hrs to fix
      src/store/__tests__/RDFAdapter.spec.ts on lines 84..90

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

      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 StructuredStore.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import rdfFactory, { SomeTerm } from "@ontologies/core";
      import * as rdf from "@ontologies/rdf";
      import * as rdfs from "@ontologies/rdfs";
      
      import { SomeNode } from "../types";
      Severity: Minor
      Found in src/store/StructuredStore.ts - About 2 hrs to fix

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

                it("returns true for invalidated resources", () => {
                    const store = getBasicStore();
                    store.processor.invalidate(example.ns("test"));
                    expect(store.processor.isInvalid(example.ns("test"))).toBeTruthy();
                });
        Severity: Major
        Found in src/processor/__tests__/DataProcessor.spec.ts and 1 other location - About 2 hrs to fix
        src/processor/__tests__/DataProcessor.spec.ts on lines 324..328

        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

                it("returns false for non-invalidated resources", () => {
                    const store = getBasicStore();
                    store.processor.invalidate(example.ns("other"));
                    expect(store.processor.isInvalid(example.ns("test"))).toBeFalsy();
                });
        Severity: Major
        Found in src/processor/__tests__/DataProcessor.spec.ts and 1 other location - About 2 hrs to fix
        src/processor/__tests__/DataProcessor.spec.ts on lines 318..322

        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

            public getRecord(id: Node | string): DataRecord | undefined {
                const recordId = typeof id === "string" ? id : id.value;
                return this.store.getInternalStore().store.getRecord(recordId);
            }
        Severity: Major
        Found in src/LinkedRenderStore.ts and 1 other location - About 2 hrs to fix
        src/LinkedRenderStore.ts on lines 669..672

        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

            public collectRecord(id: SomeNode | string): DeepRecord | undefined {
                const recordId = typeof id === "string" ? id : id.value;
                return this.store.getInternalStore().store.collectRecord(recordId);
            }
        Severity: Major
        Found in src/LinkedRenderStore.ts and 1 other location - About 2 hrs to fix
        src/LinkedRenderStore.ts on lines 657..660

        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 execActionByIRI has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
        
                const [graph, blobs = []] = dataTuple;
        
                if (this.store.getInternalStore().store.getRecord(subject.value) === undefined) {
        Severity: Major
        Found in src/processor/DataProcessor.ts - About 2 hrs to fix

          Function processDelta has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public processDelta(delta: Array<Quadruple|void>): Quadruple[] {
                  let s: Quadruple|void;
                  for (let i = 0, len = delta.length; i < len; i++) {
                      s = delta[i];
                      const subj = s ? s[0] : undefined;
          Severity: Minor
          Found in src/processor/DataProcessor.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 match has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            public match(
              subject: SomeNode | null,
              predicate: NamedNode | null,
              object: SomeTerm | null,
              justOne: boolean = false,
          Severity: Minor
          Found in src/store/RDFAdapter.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 broadcast has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
                  if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
                      return this.currentBroadcast || Promise.resolve();
                  }
          
          
          Severity: Major
          Found in src/LinkedRenderStore.ts - About 2 hrs to fix

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

                    const quadDelta = [
                        [ex("1"), ex("p"), ex("2"), ld.add],
                        [ex("1"), ex("t"), rdfFactory.literal("Test"), ld.add],
                        [ex("2"), ex("t"), rdfFactory.literal("Value"), ld.add],
                    ] as Quadruple[];
            Severity: Major
            Found in src/__tests__/LinkedRenderStore/delta.spec.ts and 1 other location - About 2 hrs to fix
            src/__tests__/LinkedRenderStore/delta.spec.ts on lines 88..92

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

            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 delta: Quadruple[] = [
                            [ex("1"), ex("p"), ex("2"), ld.add],
                            [ex("1"), ex("t"), rdfFactory.literal("Test"), ld.add],
                            [ex("2"), ex("t"), rdfFactory.literal("Value"), ld.add],
                        ];
            Severity: Major
            Found in src/__tests__/LinkedRenderStore/delta.spec.ts and 1 other location - About 2 hrs to fix
            src/__tests__/LinkedRenderStore/delta.spec.ts on lines 52..56

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

            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

            Severity
            Category
            Status
            Source
            Language