OpenHPS/openhps-solid

View on GitHub

Showing 19 of 19 total issues

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

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

import {
    DataFrame,
    DataObject,
    DataServiceDriver,
    MemoryDataService,
Severity: Minor
Found in src/common/SolidService.ts - About 5 hrs 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 95..103

    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 86..94

    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

    SolidService has 24 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 2 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

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

              queryBindingsSolid(
                  query: string,
                  session?: SolidSession,
                  options?: Partial<QueryStringContext>,
              ): Promise<Bindings[]> {
          Severity: Major
          Found in src/common/SolidDataDriver.ts and 1 other location - About 1 hr to fix
          src/common/SolidDataDriver.ts on lines 38..48

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

          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

              queryQuadsSolid(query: string, session?: SolidSession, options?: Partial<QueryStringContext>): Promise<Store> {
                  if (!session) {
                      return Promise.reject('Solid session not provided!');
                  }
                  return this.queryQuads(query, {
          Severity: Major
          Found in src/common/SolidDataDriver.ts and 1 other location - About 1 hr to fix
          src/common/SolidDataDriver.ts on lines 50..64

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

          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

          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

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

                private _initialize(): Promise<void> {
                    return new Promise((resolve, reject) => {
                        if (this.options.autoLogin) {
                            this.login(this.options.defaultOidcIssuer)
                                .then(() => resolve())
            Severity: Minor
            Found in src/browser/SolidClientService.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 interactiveLogin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    interactiveLogin(oidcIssuer: string = this.options.defaultOidcIssuer): Promise<Session> {
                        const session = new Session({
                            insecureStorage: this,
                            secureStorage: this,
                        });
                Severity: Minor
                Found in src/node/SolidClientService.ts - About 1 hr to fix

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

                      findSessionById(sessionId: string): Promise<Session> {
                          return new Promise((resolve, reject) => {
                              const clientAuth = getClientAuthenticationWithDependencies({
                                  secureStorage: this,
                                  insecureStorage: this,
                  Severity: Minor
                  Found in src/browser/SolidClientService.ts - About 1 hr to fix

                    Function getDocumentURL has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        getDocumentURL(session: SolidSession, path?: string): URL {
                            const podURL = new URL(session.info.webId.replace('/profile/card#me', ''));
                            const documentURL = new URL(session.info.webId);
                            if (path) {
                                const filteredPath = (podURL.pathname.length > 1 ? podURL.pathname : '') + path.replace(podURL.href, '');
                    Severity: Minor
                    Found in src/common/SolidService.ts - About 55 mins 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 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

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

                          '@openhps/rdf': module ? "./openhps-rdf.es" + (env.prod ? ".min" : "") + ".js" : {
                            commonjs: '@openhps/rdf',
                            commonjs2: '@openhps/rdf',
                            amd: 'rdf',
                            root: ['OpenHPS', 'rdf']
                    Severity: Minor
                    Found in webpack.config.js and 1 other location - About 55 mins to fix
                    webpack.config.js on lines 72..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 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