OpenHPS/openhps-rdf

View on GitHub

Showing 145 of 145 total issues

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

            Object.keys(data.mirrors).forEach(source => {
                console.log(`\t<${source}> -> <${data.mirrors[source]}>`)
            });
Severity: Major
Found in src/bin/cli.ts and 1 other location - About 1 hr to fix
src/bin/cli.ts on lines 100..102

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

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

    deserializeSet(
        sourceObject: Quad_Object[],
        typeDescriptor: SetTypeDescriptor,
        knownTypes: Map<string, Serializable<any>>,
        memberName: string,
Severity: Major
Found in src/rdf/InternalRDFDeserializer.ts and 2 other locations - About 1 hr to fix
src/rdf/InternalRDFDeserializer.ts on lines 351..375
src/rdf/InternalRDFDeserializer.ts on lines 390..444

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

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

    deserializeMap(
        sourceObject: Quad_Object[],
        typeDescriptor: MapTypeDescriptor,
        knownTypes: Map<string, Serializable<any>>,
        memberName: string,
Severity: Major
Found in src/rdf/InternalRDFDeserializer.ts and 2 other locations - About 1 hr to fix
src/rdf/InternalRDFDeserializer.ts on lines 351..375
src/rdf/InternalRDFDeserializer.ts on lines 446..475

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

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

    deserializeArray(
        sourceObject: Quad_Object[],
        typeDescriptor: ArrayTypeDescriptor,
        knownTypes: Map<string, Serializable<any>>,
        memberName: string,
Severity: Major
Found in src/rdf/InternalRDFDeserializer.ts and 2 other locations - About 1 hr to fix
src/rdf/InternalRDFDeserializer.ts on lines 390..444
src/rdf/InternalRDFDeserializer.ts on lines 446..475

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

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

async function fetchRemoteData(url: string, namespace: string): Promise<Quad[]> {
    const response = await axios.get(url, {
        headers: {
            'Accept': 'text/turtle;q=0.9, application/rdf+xml;q=0.8',
        },
Severity: Minor
Found in src/bin/generateNamespaceTs.ts - About 1 hr to fix

    Function add has 32 lines of code (exceeds 25 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 1 hr to fix

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

                          delete: [
                              {
                                  type: 'bgp',
                                  triples: [
                                      {
      Severity: Major
      Found in src/service/SPARQLGenerator.ts and 1 other location - About 1 hr to fix
      src/service/SPARQLGenerator.ts on lines 103..114

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

      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

                          delete: [
                              {
                                  type: 'bgp',
                                  triples: [
                                      {
      Severity: Major
      Found in src/service/SPARQLGenerator.ts and 1 other location - About 1 hr to fix
      src/service/SPARQLGenerator.ts on lines 152..163

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

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

              function deserializePredicates(predicates: any) {
                  return Object.keys(predicates)
                      .map((predicate: any) => {
                          return {
                              [predicate]: predicates[predicate].map((item: any) => {
      Severity: Minor
      Found in src/mapping/DataObject.ts - About 1 hr to fix

        Function buildProject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static buildProject(directory: string, options: ProjectBuildOptions = {}): Promise<number> {
                return new Promise((resolve, reject) => {
                    // Prepare directories
                    if (fs.existsSync(directory)) {
                        fs.rmSync(directory, { recursive: true });
        Severity: Minor
        Found in src/bin/ProjectGenerator.ts - About 1 hr to fix

          Function serializer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  serializer: (node: Node<any, any>, baseUri: IriString) => {
                      if (!(node instanceof ProcessingNode)) {
                          return undefined;
                      }
          
          
          Severity: Minor
          Found in src/mapping/Node.ts - About 1 hr to fix

            Function objectPatterns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            ).map((predicate) => {
                                const patterns: Pattern[] = [];
                                const selectorPatterns = this.generateSelector(query, predicate, dataType, member, subject);
                                if (selectorPatterns.length > 0) {
                                    patterns.push(...selectorPatterns);
            Severity: Minor
            Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

              Function deserializer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      deserializer: (thing: Thing) => {
                          let yaw = 0;
                          let roll = 0;
                          let pitch = 0;
                          let unit: AngleUnit;
              Severity: Minor
              Found in src/mapping/RelativeOrientation.ts - About 1 hr to fix

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

                        serializer: (pos: GeographicalPosition) => {
                            if (pos.altitude) {
                                return {
                                    predicates: {
                                        [ogc.asWKT]: [
                Severity: Minor
                Found in src/mapping/GeographicalPosition.ts - About 1 hr to fix

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

                                      (predicate) => {
                                          return [
                                              {
                                                  type: 'bgp',
                                                  triples: [
                  Severity: Minor
                  Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

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

                        protected static loadClasses(module: NodeModule = require.main): void {
                            if (module === undefined) {
                                // Use cache instead
                                Object.values(require.cache).map((m) => this.loadClasses(m));
                                return;
                    Severity: Minor
                    Found in src/rdf/RDFModelSerializer.ts - About 1 hr to fix

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

                                      const memberOptions =
                                          member.options && member.options.rdf
                                              ? member
                                              : rootMember && rootMember.options && rootMember.options.rdf
                                                ? rootMember
                      Severity: Major
                      Found in src/rdf/InternalRDFSerializer.ts and 1 other location - About 1 hr to fix
                      src/rdf/InternalRDFDeserializer.ts on lines 223..228

                      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

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

                                  const memberOptions =
                                      member.options && member.options.rdf
                                          ? member
                                          : rootMember && rootMember.options && rootMember.options.rdf
                                            ? rootMember
                      Severity: Major
                      Found in src/rdf/InternalRDFDeserializer.ts and 1 other location - About 1 hr to fix
                      src/rdf/InternalRDFSerializer.ts on lines 237..242

                      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

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

                          protected serializeMap(
                              sourceObject: Map<any, any>,
                              typeDescriptor?: MapTypeDescriptor,
                              memberName?: string,
                              _?: Serializer,
                      Severity: Major
                      Found in src/rdf/InternalRDFSerializer.ts and 1 other location - About 1 hr to fix
                      src/rdf/InternalRDFSerializer.ts on lines 326..337

                      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

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

                          protected serializeSet(
                              sourceObject: Map<any, any>,
                              typeDescriptor?: MapTypeDescriptor,
                              memberName?: string,
                              _?: Serializer,
                      Severity: Major
                      Found in src/rdf/InternalRDFSerializer.ts and 1 other location - About 1 hr to fix
                      src/rdf/InternalRDFSerializer.ts on lines 313..324

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language