rescribet/link-lib

View on GitHub

Showing 153 of 153 total issues

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

        it("returns the content-type for known extensions", () => {
            const response = {
                body: "",
                headers: {"Content-Type": "*/*"},
                requestedURI: "http://example.com/test.ttl",
Severity: Major
Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
src/utilities/__tests__/responses.spec.ts on lines 69..77
src/utilities/__tests__/responses.spec.ts on lines 79..87

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

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 3 locations. Consider refactoring.
Open

export const thingStatements: Quadruple[] = [
    [schemaT, rdf.type, rdfs.Class, defaultGraph],
    [schemaT, rdfs.comment, rdfFactory.literal("The most generic type of item."), defaultGraph],
    [schemaT, rdfs.label, rdfFactory.literal("Thing."), defaultGraph],
];
Severity: Major
Found in src/__tests__/LinkedRenderStore/fixtures.ts and 2 other locations - About 1 hr to fix
src/__tests__/RDFStore.spec.ts on lines 22..26
src/store/__tests__/StructuredStore.spec.ts on lines 16..20

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

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 3 locations. Consider refactoring.
Open

const thingStatements: Quadruple[] = [
    [schemaT, rdf.type, rdfs.Class, defaultGraph],
    [schemaT, rdfs.comment, rdfFactory.literal("The most generic type"), defaultGraph],
    [schemaT, rdfs.label, rdfFactory.literal("Thing."), defaultGraph],
];
Severity: Major
Found in src/__tests__/RDFStore.spec.ts and 2 other locations - About 1 hr to fix
src/__tests__/LinkedRenderStore/fixtures.ts on lines 16..20
src/store/__tests__/StructuredStore.spec.ts on lines 16..20

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

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 3 locations. Consider refactoring.
Open

const thingStatements: Quadruple[] = [
    [schemaT, rdf.type, rdfs.Class, defaultGraph],
    [schemaT, rdfs.comment, rdfFactory.literal("The most generic type"), defaultGraph],
    [schemaT, rdfs.label, rdfFactory.literal("Thing."), defaultGraph],
];
Severity: Major
Found in src/store/__tests__/StructuredStore.spec.ts and 2 other locations - About 1 hr to fix
src/__tests__/LinkedRenderStore/fixtures.ts on lines 16..20
src/__tests__/RDFStore.spec.ts on lines 22..26

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

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 3 locations. Consider refactoring.
Open

        it("returns the first content-type", () => {
            const response = {
                body: "",
                headers: {"Content-Type": "text/html; application/xhtml+xml"},
                requestedURI: "http://example.com/",
Severity: Major
Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
src/utilities/__tests__/responses.spec.ts on lines 59..67
src/utilities/__tests__/responses.spec.ts on lines 69..77

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

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 3 locations. Consider refactoring.
Open

        it("returns the content-type for known values", () => {
            const response = {
                body: "",
                headers: {"Content-Type": "application/rdf+xml; text/xml; application/xml"},
                requestedURI: "http://example.com/",
Severity: Major
Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
src/utilities/__tests__/responses.spec.ts on lines 59..67
src/utilities/__tests__/responses.spec.ts on lines 79..87

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

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

    public mineForTypes(lookupTypes: string[]): string[] {
        if (lookupTypes.length === 0) {
            return [rdfs.Resource.value];
        }

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

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

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

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: RDFAdapter,
                              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?: RDFAdapter,
        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 fieldReferences has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export const fieldReferences = (values: FieldValue, referenced: Id): boolean => {
      if (Array.isArray(values)) {
        for (const value of values) {
          if (value.termType !== TermType.Literal && value.value === referenced) {
            return true;
    Severity: Minor
    Found in src/store/StructuredStore/references.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 quadsForRecord has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      public quadsForRecord(recordId: Id): Quadruple[] {
        const factory = this.rdfFactory;
        const record = this.store.getRecord(recordId);
    
        if (record === undefined) {
    Severity: Minor
    Found in src/store/RDFAdapter.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 match has 29 lines of code (exceeds 25 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 1 hr to fix

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

          store.setRecord("/c", {
            [rdfx.type.value]: [
              rdfs.Class,
              rdfs.Resource,
            ],
      Severity: Major
      Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 1 hr to fix
      src/messages/__tests__/messageProcessor.spec.ts on lines 244..250

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

      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.getRecord("/")).toEqual({
            _id: rdf.namedNode("/"),
            [rdfs.label.value]: rdf.literal("c"),
          });
      Severity: Major
      Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 1 hr to fix
      src/messages/__tests__/messageProcessor.spec.ts on lines 211..214

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

      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

          store.setRecord("/c", {
            [rdfx.type.value]: [
              rdfs.Class,
              rdfs.Resource,
            ],
      Severity: Major
      Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 1 hr to fix
      src/messages/__tests__/messageProcessor.spec.ts on lines 196..202

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

      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.getRecord("/b")).toEqual({
            _id: rdf.namedNode("/b"),
            [rdfs.label.value]: rdf.literal("b"),
          });
      Severity: Major
      Found in src/messages/__tests__/messageProcessor.spec.ts and 1 other location - About 1 hr to fix
      src/messages/__tests__/messageProcessor.spec.ts on lines 180..183

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

      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 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
        Severity
        Category
        Status
        Source
        Language