OpenHPS/openhps-solid

View on GitHub

Showing 11 of 19 total issues

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

    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

          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

                    Severity
                    Category
                    Status
                    Source
                    Language