OpenHPS/openhps-solid

View on GitHub

Showing 32 of 32 total issues

File SolidService.ts has 615 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

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

    export class ObservableProperty extends SerializableNamedNode {
        @SerializableMember({
            rdf: {
                predicate: rdfs.label,
                language: "en"
    Severity: Major
    Found in examples/server/src/models/ObservableProperty.ts and 1 other location - About 7 hrs to fix
    examples/cli/src/ObservableProperty.ts on lines 11..36

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

    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

    export class ObservableProperty extends SerializableNamedNode {
        @SerializableMember({
            rdf: {
                predicate: rdfs.label,
                language: "en"
    Severity: Major
    Found in examples/cli/src/ObservableProperty.ts and 1 other location - About 7 hrs to fix
    examples/server/src/models/ObservableProperty.ts on lines 11..36

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

    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

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

    export abstract class SolidService extends RemoteService implements IStorage {
        protected options: SolidDataServiceOptions;
        protected driver: DataServiceDriver<string, string>;
        model: Model<any, any>;
        private static readonly PREFIX = 'OpenHPS:solid';
    Severity: Minor
    Found in src/common/SolidService.ts - About 4 hrs to fix

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

          findOne(query: SolidFilterQuery<T>, options: FindOptions = {}): Promise<T> {
              return this.service
                  .findSessionByWebId(query.webId)
                  .then((session) => {
                      return this.service.getThing(session, query.uri);
      Severity: Major
      Found in src/common/SolidDataDriver.ts and 1 other location - About 4 hrs to fix
      src/common/SolidDataDriver.ts on lines 103..116

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

      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

          findAll(query: SolidFilterQuery<T>, options: FindOptions = {}): Promise<T[]> {
              return this.service
                  .findSessionByWebId(query.webId)
                  .then((session) => {
                      return this.service.getThing(session, query.uri);
      Severity: Major
      Found in src/common/SolidDataDriver.ts and 1 other location - About 4 hrs to fix
      src/common/SolidDataDriver.ts on lines 88..101

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

      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 148..156

      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].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 157..165

      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

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

            insert(_, object: T): Promise<T> {
                return new Promise((resolve, reject) => {
                    if (!object.webId) {
                        if (this.service.session) {
                            object.webId = this.service.session.info.webId;
        Severity: Major
        Found in src/common/SolidDataDriver.ts - About 2 hrs to fix

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

                          session
                              .login({
                                  oidcIssuer,
                                  clientId: this.options.clientId,
                                  clientSecret: this.options.clientSecret,
          Severity: Major
          Found in src/node/SolidClientService.ts and 1 other location - About 1 hr to fix
          src/browser/SolidClientService.ts on lines 88..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 71.

          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

                      session
                          .login({
                              oidcIssuer,
                              clientName: this.options.clientName,
                              clientId: this.options.clientId,
          Severity: Major
          Found in src/browser/SolidClientService.ts and 1 other location - About 1 hr to fix
          src/node/SolidClientService.ts on lines 67..91

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

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

              login(oidcIssuer: string = this.options.defaultOidcIssuer, interactive: boolean = false): Promise<Session> {
                  const session = this.createSession({
                      storage: this,
                  });
                  if (!interactive) {
          Severity: Minor
          Found in src/node/SolidClientService.ts - About 1 hr to fix

            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 306..321

            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 283..298

            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

                queryBindings(query: string, session?: SolidSession, options?: Partial<QueryStringContext>): Promise<Bindings[]> {
                    if (session) {
                        return super.queryBindings(query, {
                            '@comunica/actor-http-inrupt-solid-client-authn:session': session,
                            sources: [session.info.webId],
            Severity: Major
            Found in src/common/SolidDataDriver.ts and 1 other location - About 1 hr to fix
            src/common/SolidDataDriver.ts on lines 47..58

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

            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

                queryQuads(query: string, session?: SolidSession, options?: Partial<QueryStringContext>): Promise<Store> {
                    if (session) {
                        return super.queryQuads(query, {
                            '@comunica/actor-http-inrupt-solid-client-authn:session': session,
                            sources: [session.info.webId],
            Severity: Major
            Found in src/common/SolidDataDriver.ts and 1 other location - About 1 hr to fix
            src/common/SolidDataDriver.ts on lines 60..71

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

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

                  login(oidcIssuer: string = this.options.defaultOidcIssuer): Promise<Session> {
                      return new Promise((resolve, reject) => {
                          const session = new Session({
                              insecureStorage: this,
                              secureStorage: this,
              Severity: Minor
              Found in src/browser/SolidClientService.ts - About 1 hr to fix

                Function bundle has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                Found in webpack.config.js - 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

                Severity
                Category
                Status
                Source
                Language