rescribet/link-lib

View on GitHub

Showing 153 of 153 total issues

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

                it("equates existing data", () => {
                    const store = getBasicStore();
                    store.store.addQuads(aboutIsThing);
                    store.store.addQuads(thingStatements);
                    expect(store.store.match(schema.AboutPage, rdfs.label, rdfFactory.literal("Thing.")))
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 3 hrs to fix
src/__tests__/RDFStore.spec.ts on lines 65..71

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

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

import "jest";
import "./useFactory";

import rdfFactory, { createNS, NamedNode, QuadPosition, Quadruple } from "@ontologies/core";
import * as owl from "@ontologies/owl";
Severity: Minor
Found in src/__tests__/RDFStore.spec.ts - About 2 hrs to fix

    Function match has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      public match(
        aSubject: SomeNode | null,
        aPredicate: NamedNode | null,
        aObject: 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

    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

      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

        Function execActionByIRI has a Cognitive Complexity of 18 (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

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

        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

        Function broadcast has 58 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

                  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 289..293

          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 650..653

          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 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 295..299

          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 662..665

          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

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

                        expect(store.getField("/resource/4", rdfs.member.value))
                            .toEqual([
                                rdfFactory.literal("1"),
                                rdfFactory.literal("2"),
                                rdfFactory.literal("10"),
            Severity: Major
            Found in src/store/__tests__/StructuredStore.spec.ts and 1 other location - About 2 hrs to fix
            src/store/__tests__/StructuredStore.spec.ts on lines 240..247

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

            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

                        expect(store.getField("/resource/4", rdfs.member.value))
                            .toEqual([
                                rdfFactory.literal("0"),
                                rdfFactory.literal("1"),
                                rdfFactory.literal("2"),
            Severity: Major
            Found in src/store/__tests__/StructuredStore.spec.ts and 1 other location - About 2 hrs to fix
            src/store/__tests__/StructuredStore.spec.ts on lines 262..269

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

            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 processDelta has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public processDelta(delta: Array<Quadruple|void>): Quadruple[] {
                    for (const s of delta) {
                        const subj = s ? s[0] : undefined;
            
                        if (!s || !equals(s[QuadPosition.graph], ll.meta)) {
            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

            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