rescribet/link-lib

View on GitHub

Showing 137 of 137 total issues

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

            const factory = {
                defaultGraph(): NamedNode { return rdfFactory.namedNode("rdf:defaultGraph"); },
                supports: {
                    [Feature.identity]: false,
                    [Feature.idStamp]: true,
Severity: Major
Found in src/__tests__/factoryHelpers.spec.ts and 1 other location - About 1 hr to fix
src/__tests__/factoryHelpers.spec.ts on lines 50..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 63.

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 factory = {
                defaultGraph(): NamedNode { return rdfFactory.namedNode("rdf:defaultGraph"); },
                supports: {
                    [Feature.identity]: true,
                    [Feature.idStamp]: false,
Severity: Major
Found in src/__tests__/factoryHelpers.spec.ts and 1 other location - About 1 hr to fix
src/__tests__/factoryHelpers.spec.ts on lines 31..37

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

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

export function processObject(subject: Node,
                              predicate: NamedNode,
                              datum: DataObject | SerializableDataTypes | null | undefined,
                              store: RDFIndex,
                              ns?: NamespaceMap): NamedBlobTuple[] {
Severity: Minor
Found in src/processor/DataToGraph.ts - About 1 hr to fix

    Function handleStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    async function handleStatus(res: ResponseAndFallbacks): Promise<ResponseAndFallbacks> {
        if (res.status === NOT_FOUND) {
            throw {
                message: `404: '${getURL(res)}' could not be found`,
                res,
    Severity: Minor
    Found in src/processor/DataProcessor.ts - About 1 hr 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 toGraph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export function toGraph(
        iriOrData: SomeNode | DataObject,
        data?: DataObject,
        store?: RDFIndex,
        ns?: NamespaceMap,
    Severity: Minor
    Found in src/processor/DataToGraph.ts - About 1 hr 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 processStatement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        processStatement(
            recordId: Id,
            field: Id,
            value: SomeTerm,
            ctx: VocabularyProcessingContext,
    Severity: Minor
    Found in src/schema/rdfs.ts - About 1 hr to fix

      Function expandProperty has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function expandProperty(prop: NamedNode | Term | string | undefined,
                                     namespaces: NamespaceMap = {}): NamedNode | undefined {
          if (!prop) {
              return prop as undefined;
          }
      Severity: Minor
      Found in src/utilities/memoizedNamespace.ts - About 1 hr 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 references has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public references(recordId: SomeNode): Id[] {
              const references = [];
              const data = this.store.data;
              for (const rId in data) {
                  if (!data.hasOwnProperty(rId)) {
      Severity: Minor
      Found in src/store/RDFIndex.ts - About 1 hr to fix

        Function withAlias has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public withAlias(previous: Id, current: Id): StructuredStore {
            if (previous === current
              || this.aliases[previous] === current
              || this.aliases[current] === previous) {
              return this;
        Severity: Minor
        Found in src/store/StructuredStore.ts - About 1 hr to fix

          Function digDeeper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public digDeeper(subject: Node | undefined, path: Array<NamedNode | NamedNode[]>): [Quadruple[], SomeNode[]] {
                  if (path.length === 0 || typeof subject === "undefined") {
                      return [[], []];
                  }
          
          
          Severity: Minor
          Found in src/LinkedRenderStore.ts - About 1 hr to fix

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

                        expect(store.getResourcePropertyRaw(ex("b"), ex("p")))
                            .toEqual([
                                [ex("b"), ex("p"), ex("xx"), rdfFactory.namedNode("rdf:defaultGraph")],
                                [ex("b"), ex("p"), ex("yy"), rdfFactory.namedNode("rdf:defaultGraph")],
                            ]);
            Severity: Major
            Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 hr to fix
            src/__tests__/RDFStore.spec.ts on lines 223..227

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

            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.getResourcePropertyRaw(ex("a"), [ex("r"), ex("p")]))
                            .toEqual([
                              [ex("a"), ex("r"), ex("y"), rdfFactory.namedNode("rdf:defaultGraph")],
                              [ex("a"), ex("p"), ex("x"), rdfFactory.namedNode("rdf:defaultGraph")],
                            ]);
            Severity: Major
            Found in src/__tests__/RDFStore.spec.ts and 1 other location - About 1 hr to fix
            src/__tests__/RDFStore.spec.ts on lines 208..212

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

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

            const getSortedFieldMembers = (record: DataRecord): MultimapTerm => {
              const values: FieldValue = [];
              const sortedEntries = Object
                  .entries(record)
                  .sort(([k1], [k2]) => {
            Severity: Minor
            Found in src/store/StructuredStore.ts - About 55 mins 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 contentTypeByMimeString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export function contentTypeByMimeString(contentType: string, ext: string): string | undefined {
                if (contentType.includes(F_NTRIPLES) || contentType.includes(F_NTRIPLES_DEP)) {
                    return F_NTRIPLES;
                } else if (contentType.includes(F_PLAIN) && ["ntriples", "nt"].indexOf(ext) >= 0) {
                    return F_NTRIPLES;
            Severity: Minor
            Found in src/utilities/responses.ts - About 55 mins 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 queueDelta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public queueDelta(delta: Quadruple[]): void {
                    this.deltas.push(delta);
                    const store = this.store.getInternalStore().store;
                    const llNS = ll.ns("").value;
                    const ldNS = ld.ns("").value;
            Severity: Minor
            Found in src/processor/DataProcessor.ts - About 55 mins 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 processStatement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                processStatement(
                    recordId: Id,
                    field: Id,
                    value: SomeTerm,
                    ctx: VocabularyProcessingContext,
            Severity: Minor
            Found in src/schema/rdfs.ts - About 55 mins 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 getEntities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public getEntities(resources: ResourceQueueItem[]): Promise<Quadruple[]> {
                    const reload: NamedNode[] = [];
            
                    const toBeFetched = new Set<NamedNode>();
            
            
            Severity: Minor
            Found in src/processor/DataProcessor.ts - About 55 mins 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("returns empty data for empty subject", () => {
                        const res = store.lrs.getResourcePropertyRaw(undefined, rdfs.label);
                        expect(res).toEqual([]);
                    });
            Severity: Minor
            Found in src/__tests__/LinkedRenderStore/data.spec.ts and 1 other location - About 55 mins to fix
            src/__tests__/LinkedRenderStore/data.spec.ts on lines 35..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 53.

            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 empty data for empty subject", () => {
                        const res = store.lrs.getResourceProperties(undefined, rdfs.label);
                        expect(res).toEqual([]);
                    });
            Severity: Minor
            Found in src/__tests__/LinkedRenderStore/data.spec.ts and 1 other location - About 55 mins to fix
            src/__tests__/LinkedRenderStore/data.spec.ts on lines 75..78

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

            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 getEntity(iri: string): Promise<object> {
                    return sendMessage(
                        this.worker,
                        {
                            method: GET_ENTITY,
            Severity: Minor
            Found in src/worker/DataWorkerLoader.ts and 1 other location - About 50 mins to fix
            src/worker/DataWorkerLoader.ts on lines 33..43

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

            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