OpenHPS/openhps-solid

View on GitHub
src/common/SolidService.ts

Summary

Maintainability
F
4 days
Test Coverage

File SolidService.ts has 619 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    DataFrame,
    DataObject,
    DataServiceDriver,
    MemoryDataService,
Severity: Major
Found in src/common/SolidService.ts - About 1 day to fix

    SolidService has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export abstract class SolidService extends RemoteService {
        protected options: SolidDataServiceOptions;
        storage: IStorage;
        protected storageUtility: StorageUtility;
        readonly clientRegistrar: ClientRegistrar;
    Severity: Minor
    Found in src/common/SolidService.ts - About 3 hrs to fix

      Function getDatasetStore has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getDatasetStore(session: SolidSession, uri: string): Promise<Store> {
              return new Promise((resolve, reject) => {
                  /**
                   *
                   * @param subject
      Severity: Major
      Found in src/common/SolidService.ts - About 2 hrs to fix

        Function convertPredicates has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function convertPredicates(subject: Quad_Subject, predicates: any): Quad[] {
                        return Object.keys(predicates)
                            .map((key) => {
                                const predicate = DataFactory.namedNode(key);
                                const objects: Quad_Object[] = [];
        Severity: Minor
        Found in src/common/SolidService.ts - About 1 hr to fix

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

              storeProfile(object: SolidProfileObject): Promise<SolidProfileObject> {
                  return new Promise((resolve, reject) => {
                      const key = `${SolidService.PREFIX}:webId:${object.webId}`;
                      this.storage
                          .set(key, object.sessionId)
          Severity: Minor
          Found in src/common/SolidService.ts - About 1 hr to fix

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

                findSessionById(sessionId: string): Promise<SolidSession> {
                    return new Promise((resolve, reject) => {
                        let session: SolidSession = undefined;
                        this.findSessionInfoById(sessionId)
                            .then((sessionInfo) => {
            Severity: Minor
            Found in src/common/SolidService.ts - About 1 hr to fix

              Function createThing has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  createThing(session: SolidSession, thing: Thing, dataset?: SolidDataset): Promise<SolidDataset> {
                      return new Promise((resolve, reject) => {
                          const documentURL = new URL(thing.url);
                          documentURL.hash = '';
                          /**
              Severity: Minor
              Found in src/common/SolidService.ts - About 1 hr to fix

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

                                        objects.push(
                                            ...Object.keys(predicates[key].literals ?? {})
                                                .map((dataTypeIRI) => {
                                                    return predicates[key].literals[dataTypeIRI].map((val: string) => {
                                                        return DataFactory.literal(val, dataTypeIRI);
                Severity: Major
                Found in src/common/SolidService.ts and 1 other location - About 4 hrs to fix
                src/common/SolidService.ts on lines 235..243

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

                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

                                        objects.push(
                                            ...Object.keys(predicates[key].langStrings ?? {})
                                                .map((locale) => {
                                                    return predicates[key].langStrings[locale].map((val: string) => {
                                                        return DataFactory.literal(val, locale);
                Severity: Major
                Found in src/common/SolidService.ts and 1 other location - About 4 hrs to fix
                src/common/SolidService.ts on lines 226..234

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

                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

                    deleteContainer(session: SolidSession, url: IriString): Promise<void> {
                        return new Promise((resolve, reject) => {
                            deleteContainer(
                                url,
                                session
                Severity: Major
                Found in src/common/SolidService.ts and 1 other location - About 1 hr to fix
                src/common/SolidService.ts on lines 384..399

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

                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

                    deleteDataset(session: SolidSession, uri: string): Promise<void> {
                        return new Promise((resolve, reject) => {
                            deleteSolidDataset(
                                uri,
                                session
                Severity: Major
                Found in src/common/SolidService.ts and 1 other location - About 1 hr to fix
                src/common/SolidService.ts on lines 361..376

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

                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

                There are no issues that match your filters.

                Category
                Status