OpenHPS/openhps-solid

View on GitHub

Showing 44 of 44 total issues

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

    queryQuads(query: string, options?: Partial<QueryStringContext>, session?: SolidSession): 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 62..73

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

    async getClient(options: IClientRegistrarOptions, issuerConfig: IIssuerConfig): Promise<IClient> {
        // If client secret and/or client id are stored in storage, use those.
        const [storedClientId, storedClientSecret, storedClientName, storedClientType] = await Promise.all([
            this.storageUtility.getForUser(options.sessionId, 'clientId', {
                secure: false,
Severity: Minor
Found in src/common/ClientRegistrar.ts - About 1 hr to fix

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

                        return Promise.all([
                            this.service.getDatasetStore(session, `${propertyContainer.href}/property.ttl`),
                            this.service.getDatasetStore(session, `${propertyContainer.href}/.meta`),
                        ]);
    Severity: Major
    Found in src/common/SolidPropertyService.ts and 1 other location - About 1 hr to fix
    src/common/SolidPropertyService.ts on lines 165..168

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

    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

                Promise.all([
                    this.service.getDatasetStore(session, `${property.id}/property.ttl`),
                    this.service.getDatasetStore(session, `${property.id}/.meta`),
                ])
    Severity: Major
    Found in src/common/SolidPropertyService.ts and 1 other location - About 1 hr to fix
    src/common/SolidPropertyService.ts on lines 117..120

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

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

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

    export class GreaterThanOrEqualToRelation extends Relation {
        test(value: any): boolean {
            return value >= this.value;
        }
    }
    Severity: Major
    Found in src/models/tree/Relation.ts and 3 other locations - About 1 hr to fix
    src/models/tree/Relation.ts on lines 51..55
    src/models/tree/Relation.ts on lines 62..66
    src/models/tree/Relation.ts on lines 73..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 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 bundle has 35 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: Minor
    Found in webpack.config.js - About 1 hr to fix

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

      export class GreaterThanRelation extends Relation {
          test(value: any): boolean {
              return value > this.value;
          }
      }
      Severity: Major
      Found in src/models/tree/Relation.ts and 3 other locations - About 1 hr to fix
      src/models/tree/Relation.ts on lines 40..44
      src/models/tree/Relation.ts on lines 62..66
      src/models/tree/Relation.ts on lines 73..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 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 4 locations. Consider refactoring.
      Open

      export class LessThanOrEqualToRelation extends Relation {
          test(value: any): boolean {
              return value <= this.value;
          }
      }
      Severity: Major
      Found in src/models/tree/Relation.ts and 3 other locations - About 1 hr to fix
      src/models/tree/Relation.ts on lines 40..44
      src/models/tree/Relation.ts on lines 51..55
      src/models/tree/Relation.ts on lines 73..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 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 4 locations. Consider refactoring.
      Open

      export class LessThanRelation extends Relation {
          test(value: any): boolean {
              return value < this.value;
          }
      }
      Severity: Major
      Found in src/models/tree/Relation.ts and 3 other locations - About 1 hr to fix
      src/models/tree/Relation.ts on lines 40..44
      src/models/tree/Relation.ts on lines 51..55
      src/models/tree/Relation.ts on lines 62..66

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

          delete(id: string): Promise<void> {
              return new Promise((resolve, reject) => {
                  let uri: IriString;
                  let currentSession: SolidSession;
                  this.service
      Severity: Minor
      Found in src/common/SolidDataDriver.ts - About 1 hr to fix

        Function addObservation has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            addObservation(session: SolidSession, property: Property, observation: Observation): Promise<void> {
                return new Promise((resolve, reject) => {
                    Promise.all([
                        this.service.getDatasetStore(session, `${property.id}/property.ttl`),
                        this.service.getDatasetStore(session, `${property.id}/.meta`),
        Severity: Minor
        Found in src/common/SolidPropertyService.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 fetchProperties has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fetchProperties(session: SolidSession, profile: SolidProfileObject): Promise<Property[]> {
                    return new Promise((resolve, reject) => {
                        const query = `SELECT DISTINCT ?property ?name WHERE {
                            ?me <${ssn.hasProperty}> ?property .
                            OPTIONAL {
            Severity: Minor
            Found in src/common/SolidPropertyService.ts - About 1 hr to fix

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

                  loginSuccessCallback: async function(req: express.Request, res: express.Response, sessionInfo: any) {
                    const service: SolidService = this;
              
                    const session = await service.findSessionByWebId(sessionInfo.webId);
                    const card = await service.getThing(session, sessionInfo.webId);
              Severity: Minor
              Found in examples/server/src/index.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 deleteRecursively has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      async deleteRecursively(session: SolidSession, dataset: IriString | SolidDataset & WithResourceInfo): Promise<void> {
                          if (typeof dataset === 'string') {
                              const fetchedDataset = await this.getDataset(session, dataset);
                              return await this.deleteRecursively(session, fetchedDataset as SolidDataset & WithResourceInfo);
                          }
                  Severity: Minor
                  Found in src/common/SolidService.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 _onBuild has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private _onBuild(): Promise<void> {
                          return new Promise((resolve, reject) => {
                              if (this.options.authServer) {
                                  if (!Object.keys(this.options.authServer).includes('port')) {
                                      this.express = this.options.authServer as express.Express;
                  Severity: Minor
                  Found in src/node/SolidClientService.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

                            '@openhps/core': module ? "./openhps-core.es" + (env.prod ? ".min" : "") + ".js" : {
                              commonjs: '@openhps/core',
                              commonjs2: '@openhps/core',
                              amd: 'core',
                              root: ['OpenHPS', 'core']
                      Severity: Minor
                      Found in webpack.config.js and 1 other location - About 55 mins to fix
                      webpack.config.js on lines 78..83

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

                      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