rescribet/link-lib

View on GitHub

Showing 153 of 153 total issues

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

                } else if (status >= 500 && status < 600) {
                    this.store.getInternalStore().store.deleteRecord(s[0].value);
                    this.store.getInternalStore().store.addField(s[0].value, rdf.type.value, ll.ErrorResource);
                    this.store.getInternalStore().store.addField(s[0].value, rdf.type.value, ll.ServerError);
                    this.store.getInternalStore().store.addField(
Severity: Major
Found in src/processor/DataProcessor.ts and 1 other location - About 1 day to fix
src/processor/DataProcessor.ts on lines 419..441

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

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

                } else if (status >= 400 && status < 500) {
                    this.store.getInternalStore().store.deleteRecord(s[0].value);
                    this.store.getInternalStore().store.addField(s[0].value, rdf.type.value, ll.ErrorResource);
                    this.store.getInternalStore().store.addField(s[0].value, rdf.type.value, ll.ClientError);
                    this.store.getInternalStore().store.addField(
Severity: Major
Found in src/processor/DataProcessor.ts and 1 other location - About 1 day to fix
src/processor/DataProcessor.ts on lines 429..441

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

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("with an existing value", () => {
        it("add", () => {
            testDelta([ [bob, schema.children, alice, ld.add] ], [1, 0, 0]);
        });

Severity: Major
Found in src/store/__tests__/deltaProcessor.spec.ts and 1 other location - About 1 day to fix
src/store/__tests__/deltaProcessor.spec.ts on lines 101..121

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

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("with a new value", () => {
        it("add", () => {
            testDelta([ [bob, schema.children, erin, ld.add] ], [1, 0, 0]);
        });

Severity: Major
Found in src/store/__tests__/deltaProcessor.spec.ts and 1 other location - About 1 day to fix
src/store/__tests__/deltaProcessor.spec.ts on lines 79..99

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

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

import rdfFactory, {
    isNode,
    isQuad,
    NamedNode,
    Node,
Severity: Minor
Found in src/LinkedRenderStore.ts - About 7 hrs to fix

    File DataProcessor.ts has 473 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import rdfFactory, { isNode, NamedNode, QuadPosition, Quadruple, TermType } from "@ontologies/core";
    import * as ld from "@ontologies/ld";
    import * as rdf from "@ontologies/rdf";
    import * as schema from "@ontologies/schema";
    import * as xsd from "@ontologies/xsd";
    Severity: Minor
    Found in src/processor/DataProcessor.ts - About 7 hrs to fix

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

              it("handles decimals", () => {
                  const data = { "example:property": 2.5 };
                  const [graph] = dataToGraphTuple(data, exampleMap);
                  const stmt = graph.quads[0];
                  expect(stmt).toBeTruthy();
      Severity: Major
      Found in src/processor/__tests__/DataToGraph.spec.ts and 1 other location - About 6 hrs to fix
      src/processor/__tests__/DataToGraph.spec.ts on lines 174..182

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

      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("handles integers", () => {
                  const data = { "example:property": 45 };
                  const [graph] = dataToGraphTuple(data, exampleMap);
                  const stmt = graph.quads[0];
                  expect(stmt).toBeTruthy();
      Severity: Major
      Found in src/processor/__tests__/DataToGraph.spec.ts and 1 other location - About 6 hrs to fix
      src/processor/__tests__/DataToGraph.spec.ts on lines 151..159

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

      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("equal after", () => {
                          const store = getBasicStore();
                          store.store.addQuads(thingStatements);
                          store.store.addQuads(aboutIsThing);
      
      
      Severity: Major
      Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 5 hrs to fix
      src/__tests__/RDFStore.spec.ts on lines 319..330

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

      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("equal after", () => {
                          const store = getBasicStore();
                          store.store.addQuads(thingStatements);
                          store.store.addQuads(thingIsAbout);
      
      
      Severity: Major
      Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 5 hrs to fix
      src/__tests__/RDFStore.spec.ts on lines 291..302

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

      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 data: DataSlice = {
                  "/resource/4": {
                      _id: rdfFactory.namedNode("/resource/4"),
                      [rdf.ns("_2").value]: rdfFactory.literal("2"),
                      [rdf.ns("_10").value]: rdfFactory.literal("10"),
      Severity: Major
      Found in src/store/__tests__/StructuredStore.spec.ts and 1 other location - About 5 hrs to fix
      src/store/__tests__/StructuredStore.spec.ts on lines 251..260

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

      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 store = new StructuredStore(defaultGraph.value, {
                      "/resource/4": {
                          _id: rdfFactory.namedNode("/resource/4"),
                          [rdf.ns("_2").value]: rdfFactory.literal("2"),
                          [rdf.ns("_10").value]: rdfFactory.literal("10"),
      Severity: Major
      Found in src/store/__tests__/StructuredStore.spec.ts and 1 other location - About 5 hrs to fix
      src/store/__tests__/StructuredStore.spec.ts on lines 226..235

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

      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

      LinkedRenderStore has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class LinkedRenderStore<T, API extends LinkedDataAPI = DataProcessor> implements Dispatcher {
          public static registerRenderer<T>(
              component: T,
              type: LazyNNArgument,
              prop: LazyNNArgument = RENDER_CLASS_NAME,
      Severity: Minor
      Found in src/LinkedRenderStore.ts - About 5 hrs to fix

        File DataProcessor.spec.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import "../../__tests__/useFactory";
        
        import rdfFactory, { NamedNode, Quadruple } from "@ontologies/core";
        import * as ld from "@ontologies/ld";
        import * as rdfx from "@ontologies/rdf";
        Severity: Minor
        Found in src/processor/__tests__/DataProcessor.spec.ts - About 4 hrs to fix

          File StructuredStore.spec.ts has 346 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import rdfFactory, { createNS, NamedNode, Quadruple } from "@ontologies/core";
          import * as rdf from "@ontologies/rdf";
          import * as rdfs from "@ontologies/rdfs";
          import * as schema from "@ontologies/schema";
          
          
          Severity: Minor
          Found in src/store/__tests__/StructuredStore.spec.ts - About 4 hrs to fix

            Function broadcast has a Cognitive Complexity of 27 (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

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

                it("allows initializing with rdf:type", () => {
                  const [process, __, store] = init();
            
                  process(addField("/", rdfx.type.value, rdfs.Resource));
                  expect(store.getRecord("/")).toEqual({
            Severity: Major
            Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 3 hrs to fix
            src/messages/__tests__/messageProcessor.spec.ts on lines 134..142

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

            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("allows initializing with rdf:type", () => {
                  const [process, __, store] = init();
            
                  process(setField("/", rdfx.type.value, rdfs.Resource));
                  expect(store.getRecord("/")).toEqual({
            Severity: Major
            Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 3 hrs to fix
            src/messages/__tests__/messageProcessor.spec.ts on lines 84..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 106.

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

            export const createMessageProcessor = (lrs: LinkedRenderStore<unknown>): ((m: Messages) => void) => {
              const store = lrs.store.getInternalStore().store;
            
              return (message: Messages): void => {
                switch (message.type) {
            Severity: Major
            Found in src/messages/messageProcessor.ts - About 3 hrs to fix

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

                              it("equates new data", () => {
                                  const store = getBasicStore();
                                  store.store.addQuads(thingStatements);
                                  store.store.addQuads(aboutIsThing);
                                  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 57..63

              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

              Severity
              Category
              Status
              Source
              Language