rescribet/link-lib

View on GitHub

Showing 143 of 143 total issues

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

            describe("small big", () => {
                it("equal before", () => {
                    const store = getBasicStore();
                    store.store.addQuads(thingIsAbout);
                    store.store.addQuads(thingStatements);
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 day to fix
src/__tests__/RDFStore.spec.ts on lines 400..426

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

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("big small", () => {
                it("equal before", () => {
                    const store = getBasicStore();
                    store.store.addQuads(aboutIsThing);
                    store.store.addQuads(thingStatements);
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 day to fix
src/__tests__/RDFStore.spec.ts on lines 428..454

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

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 90..110

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 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 112..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 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("big small", () => {
                it("equates existing data", () => {
                    const store = getBasicStore();
                    store.store.addQuads(aboutIsThing);
                    store.store.addQuads(thingStatements);
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 day to fix
src/__tests__/RDFStore.spec.ts on lines 90..106

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

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("small big", () => {
                it("equates existing data", () => {
                    const store = getBasicStore();
                    store.store.addQuads(thingIsAbout);
                    store.store.addQuads(thingStatements);
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 day to fix
src/__tests__/RDFStore.spec.ts on lines 72..88

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

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

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

    Function Equatable has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    export function Equatable<BC extends Constructable<IndexedStore & BasicStore>>(base: BC) {
        return class extends base {
            public aliases: Node[][] = [];
            public redirections: Node[] = [];
            public classOrder: Record<TermType, number> = {
    Severity: Minor
    Found in src/store/Equatable.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

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

    import rdfFactory, {
      isBlankNode,
      NamedNode,
      Quad,
      QuadPosition,
    Severity: Minor
    Found in src/processor/DataProcessor.ts - About 6 hrs to fix

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

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

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

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

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

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

          Function constructor has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              constructor({ deltaProcessorOpts, innerStore }: RDFStoreOpts = {}) {
                  this.processDelta = this.processDelta.bind(this);
          
                  const g = innerStore || new RDFIndex();
                  this.store = addChangeBufferCallbacks(g, this);
          Severity: Minor
          Found in src/RDFStore.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

          LinkedRenderStore has 35 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 4 hrs to fix

            Function Equatable has 105 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function Equatable<BC extends Constructable<IndexedStore & BasicStore>>(base: BC) {
                return class extends base {
                    public aliases: Node[][] = [];
                    public redirections: Node[] = [];
                    public classOrder: Record<TermType, number> = {
            Severity: Major
            Found in src/store/Equatable.ts - About 4 hrs to fix

              Function constructor has 98 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  constructor({ deltaProcessorOpts, innerStore }: RDFStoreOpts = {}) {
                      this.processDelta = this.processDelta.bind(this);
              
                      const g = innerStore || new RDFIndex();
                      this.store = addChangeBufferCallbacks(g, this);
              Severity: Major
              Found in src/RDFStore.ts - About 3 hrs to fix

                Function processStatement has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                Open

                    processStatement(item: Quad, ctx: VocabularyProcessingContext): Quad[] | null {
                        const result = [item];
                
                        const domainStatements = ctx.store.match(item.predicate, rdfs.domain, null, null);
                        if (domainStatements.length > 0) {
                Severity: Minor
                Found in src/schema/rdfs.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

                            if (!equals(item.subject, rdf.type)) {
                                ctx.dataStore.getInternalStore().newPropertyAction(
                                    item.subject as NamedNode,
                                    (quad: Quad) => {
                                        ctx.store.addQuads([rdfFactory.quad(quad.subject, rdf.type, item.object)]);
                Severity: Major
                Found in src/schema/rdfs.ts and 1 other location - About 3 hrs to fix
                src/schema/rdfs.ts on lines 105..113

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

                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

                            if (!equals(item.subject, rdf.type)) {
                                ctx.dataStore.getInternalStore().newPropertyAction(
                                    item.subject as NamedNode,
                                    (quad: Quad) => {
                                        ctx.store.addQuads([rdfFactory.quad(quad.object, rdf.type, item.object)]);
                Severity: Major
                Found in src/schema/rdfs.ts and 1 other location - About 3 hrs to fix
                src/schema/rdfs.ts on lines 87..95

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

                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