OpenHPS/openhps-rdf

View on GitHub

Showing 207 of 207 total issues

File InternalRDFSerializer.ts has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    ArrayTypeDescriptor,
    MapTypeDescriptor,
    ObjectMemberMetadata,
    ObjectMetadata,
Severity: Minor
Found in src/rdf/InternalRDFSerializer.ts - About 3 hrs to fix

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

    const urn_comunica_default_rdf_parse_actors_n3 = new (require('@comunica/actor-rdf-parse-n3').ActorRdfParseN3)({
      'mediaTypePriorities': {"application/n-quads":1,"application/n-triples":0.8,"application/trig":0.95,"text/n3":0.35,"text/turtle":0.6},
      'mediaTypeFormats': {"application/n-quads":"http://www.w3.org/ns/formats/N-Quads","application/n-triples":"http://www.w3.org/ns/formats/N-Triples","application/trig":"http://www.w3.org/ns/formats/TriG","text/n3":"http://www.w3.org/ns/formats/N3","text/turtle":"http://www.w3.org/ns/formats/Turtle"},
      'priorityScale': 1,
      'name': 'urn:comunica:default:rdf-parse/actors#n3',
    Severity: Major
    Found in src/service/engine-minimal.js and 1 other location - About 3 hrs to fix
    src/service/engine-default.js on lines 287..293

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

    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

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

    const urn_comunica_default_rdf_parse_actors_n3 = new (require('@comunica/actor-rdf-parse-n3').ActorRdfParseN3)({
      'mediaTypePriorities': {"application/n-quads":1,"application/n-triples":0.8,"application/trig":0.95,"text/n3":0.35,"text/turtle":0.6},
      'mediaTypeFormats': {"application/n-quads":"http://www.w3.org/ns/formats/N-Quads","application/n-triples":"http://www.w3.org/ns/formats/N-Triples","application/trig":"http://www.w3.org/ns/formats/TriG","text/n3":"http://www.w3.org/ns/formats/N3","text/turtle":"http://www.w3.org/ns/formats/Turtle"},
      'priorityScale': 1,
      'name': 'urn:comunica:default:rdf-parse/actors#n3',
    Severity: Major
    Found in src/service/engine-default.js and 1 other location - About 3 hrs to fix
    src/service/engine-minimal.js on lines 287..293

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

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

        serializeObject<T, TD extends TypeDescriptor>(
            sourceObject: T,
            typeDescriptor: TD,
            _: string,
            serializer: Serializer,
    Severity: Minor
    Found in src/rdf/InternalRDFSerializer.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

    Function bundle has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const bundle = (env, module, entry = 'index', suffix = '') => {
      const filename = `${PROJECT_NAME}${suffix}${module ? ".es" : ""}${env.prod ? ".min" : ""}`;
      return {
        name: PROJECT_NAME,
        entry: `./dist/esm5/${entry}.js`,
    Severity: Major
    Found in webpack.config.js - About 3 hrs to fix

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

      export class Address {
          @SerializableMember({
              rdf: {
                  predicate: vcard.street_address,
              },
      Severity: Major
      Found in src/models/Address.ts and 1 other location - About 3 hrs to fix
      examples/nodejs/src/Project.ts on lines 10..24

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

      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

      export class Project {
          @SerializableMember({
              rdf: {
                  predicate: foaf.title
              }
      Severity: Major
      Found in examples/nodejs/src/Project.ts and 1 other location - About 3 hrs to fix
      src/models/Address.ts on lines 9..23

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

      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 urn_comunica_default_rdf_serialize_actors_n3 = new (require('@comunica/actor-rdf-serialize-n3').ActorRdfSerializeN3)({
        'mediaTypePriorities': {"application/n-quads":1,"application/n-triples":0.8,"application/trig":0.95,"text/n3":0.35,"text/turtle":0.6},
        'mediaTypeFormats': {"application/n-quads":"http://www.w3.org/ns/formats/N-Quads","application/n-triples":"http://www.w3.org/ns/formats/N-Triples","application/trig":"http://www.w3.org/ns/formats/TriG","text/n3":"http://www.w3.org/ns/formats/N3","text/turtle":"http://www.w3.org/ns/formats/Turtle"},
        'name': 'urn:comunica:default:rdf-serialize/actors#n3',
        'bus': https___linkedsoftwaredependencies_org_bundles_npm__comunica_bus_rdf_serialize__2_0_0_components_ActorRdfSerialize_jsonld_ActorRdfSerialize_default_bus
      Severity: Major
      Found in src/service/engine-minimal.js and 1 other location - About 2 hrs to fix
      src/service/engine-default.js on lines 230..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 92.

      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 urn_comunica_default_rdf_serialize_actors_n3 = new (require('@comunica/actor-rdf-serialize-n3').ActorRdfSerializeN3)({
        'mediaTypePriorities': {"application/n-quads":1,"application/n-triples":0.8,"application/trig":0.95,"text/n3":0.35,"text/turtle":0.6},
        'mediaTypeFormats': {"application/n-quads":"http://www.w3.org/ns/formats/N-Quads","application/n-triples":"http://www.w3.org/ns/formats/N-Triples","application/trig":"http://www.w3.org/ns/formats/TriG","text/n3":"http://www.w3.org/ns/formats/N3","text/turtle":"http://www.w3.org/ns/formats/Turtle"},
        'name': 'urn:comunica:default:rdf-serialize/actors#n3',
        'bus': https___linkedsoftwaredependencies_org_bundles_npm__comunica_bus_rdf_serialize__2_0_0_components_ActorRdfSerialize_jsonld_ActorRdfSerialize_default_bus
      Severity: Major
      Found in src/service/engine-default.js and 1 other location - About 2 hrs to fix
      src/service/engine-minimal.js on lines 245..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 92.

      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 identifierMember = Array.from(metadata.dataMembers.values()).filter((member) => {
                  return (
                      member &&
                      member.options &&
                      member.options.rdf &&
      Severity: Major
      Found in src/rdf/InternalRDFSerializer.ts and 1 other location - About 2 hrs to fix
      src/rdf/InternalRDFDeserializer.ts on lines 193..200

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

      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 identifierMember = Array.from(metadata.dataMembers.values()).filter((member) => {
                  return (
                      member &&
                      member.options &&
                      member.options.rdf &&
      Severity: Major
      Found in src/rdf/InternalRDFDeserializer.ts and 1 other location - About 2 hrs to fix
      src/rdf/InternalRDFSerializer.ts on lines 128..135

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

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

          protected createConstruct(query: FilterQuery): ConstructQuery {
              const patterns = this.createQuery(query);
              // Variables
              const subjectVar = DataFactory.variable('subject');
              const propVar = DataFactory.variable('prop');
      Severity: Major
      Found in src/service/SPARQLGenerator.ts - About 2 hrs to fix

        Function deserializer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            deserializer: (object: any) => {
                if (!object) {
                    return undefined;
                }
        
        
        Severity: Minor
        Found in src/mapping/DataObject.ts - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function rdfTypeResolver has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            rdfTypeResolver(
                sourceObject: IndexedObject,
                knownTypes: Map<string, Serializable<any>>,
                knownRDFTypes: Map<IriString, string[]>,
            ): Serializable<any> {
        Severity: Minor
        Found in src/rdf/InternalRDFDeserializer.ts - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

        const urn_comunica_default_rdf_resolve_quad_pattern_actors_hypermedia = new (require('@comunica/actor-rdf-resolve-quad-pattern-hypermedia').ActorRdfResolveQuadPatternHypermedia)({
          'cacheSize': 100,
          'httpInvalidator': https___linkedsoftwaredependencies_org_bundles_npm__comunica_actor_rdf_resolve_quad_pattern_hypermedia__2_0_0_components_ActorRdfResolveQuadPatternHypermedia_jsonld_IActorRdfResolveQuadPatternHypermediaArgs_default_invalidator,
          'maxIterators': 64,
          'aggregateStore': false,
        Severity: Major
        Found in src/service/engine-minimal.js and 1 other location - About 2 hrs to fix
        src/service/engine-default.js on lines 793..807

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

        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

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

        const urn_comunica_default_rdf_resolve_quad_pattern_actors_hypermedia = new (require('@comunica/actor-rdf-resolve-quad-pattern-hypermedia').ActorRdfResolveQuadPatternHypermedia)({
          'cacheSize': 100,
          'httpInvalidator': https___linkedsoftwaredependencies_org_bundles_npm__comunica_actor_rdf_resolve_quad_pattern_hypermedia__2_0_0_components_ActorRdfResolveQuadPatternHypermedia_jsonld_IActorRdfResolveQuadPatternHypermediaArgs_default_invalidator,
          'maxIterators': 64,
          'aggregateStore': false,
        Severity: Major
        Found in src/service/engine-default.js and 1 other location - About 2 hrs to fix
        src/service/engine-minimal.js on lines 793..807

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

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

        function main() {
            console.log(chalk.redBright('OpenHPS RDF Generator'));
        
            if (args['c']) {
                const configPath = path.normalize(args['c']);
        Severity: Major
        Found in src/bin/cli.ts - About 2 hrs to fix

          Function rdfTypeResolver has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              rdfTypeResolver(
                  sourceObject: IndexedObject,
                  knownTypes: Map<string, Serializable<any>>,
                  knownRDFTypes: Map<IriString, string[]>,
              ): Serializable<any> {
          Severity: Major
          Found in src/rdf/InternalRDFDeserializer.ts - About 2 hrs to fix

            Function add has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                add(
                    predicate: IriString,
                    object: Quad_Object | Thing | number | string | IriString | object,
                    languageOrDatatype?: string | IriString,
                ): RDFBuilder {
            Severity: Minor
            Found in src/rdf/RDFBuilder.ts - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function convertSingleValue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                convertSingleValue(
                    sourceObject: any,
                    typeDescriptor: TypeDescriptor,
                    memberName: string,
                    memberOptions?: ObjectMemberMetadata,
            Severity: Major
            Found in src/rdf/InternalRDFSerializer.ts - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language