mashafrancis/butternut-user

View on GitHub

Showing 12 of 33 total issues

Function createGqlOptions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    createGqlOptions(): GqlModuleOptions {
        return {
            typePaths: [join(process.cwd(), '**/*.graphql')],
            introspection: true,
            playground: true,
Severity: Major
Found in src/app/_helpers/graphql/gql-config.service.ts - About 2 hrs to fix

    Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        constructor(label?: string) {
            const options = {
                file: {
                    level: 'info' || 'error',
                    filename: `${__dirname}/../../logs/app.log`,
    Severity: Minor
    Found in src/app/app.logger.ts - About 1 hr to fix

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

          @MessagePattern({ cmd: USER_CMD_REGISTER })
          public async onUserRegister(user: UserEntity): Promise<void> {
              try {
                  const userRecord = await this.userService.findByEmail(user.email);
                  this.logger.debug(
      Severity: Minor
      Found in src/app/user/user.controller.ts - About 1 hr to fix

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

            generate: (function () {
                // Timestamp of last push, used to prevent local
                // collisions if you push twice in one ms.
                let lastPushTime = 0;
                // We generate 72-bits of randomness which get
        Severity: Minor
        Found in src/utils/fancyGenerator.ts - About 1 hr to fix

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

              @Command({ command: 'create:user [amount]', describe: 'create a user' })
              public async create(@Positional({ name: 'amount' }) amount) {
                  // tslint:disable-next-line:no-parameter-reassignment
                  amount = parseInt(amount || 10, 10);
                  this.logger.debug(`[create] execute for amount ${amount}!`);
          Severity: Minor
          Found in src/app/user/user.command.ts - About 1 hr to fix

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

            const mapToTypeOrm = (key, filter): any => {
                switch (key) {
                    case 'eq':
                        return { $eq: filter[key] };
                    case 'ne':
            Severity: Minor
            Found in src/app/_helpers/database/typeorm-filter.mapper.ts - About 1 hr to fix

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

                  @MessagePattern({ cmd: USER_CMD_PASSWORD_RESET })
                  public async onUserPasswordReset({
                      email,
                  }: {
                      email: string;
              Severity: Minor
              Found in src/app/user/user.controller.ts - About 1 hr to fix

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

                    public async login(credentials: CredentialsDto): Promise<UserEntity> {
                        const user = await this.findByEmail(credentials.email);
                        const validPassword = await verifyPassword(
                            user.password,
                            credentials.password,
                Severity: Minor
                Found in src/app/user/user.service.ts - About 1 hr to fix

                  Function createGqlOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      createGqlOptions(): GqlModuleOptions {
                          return {
                              typePaths: [join(process.cwd(), '**/*.graphql')],
                              introspection: true,
                              playground: true,
                  Severity: Minor
                  Found in src/app/_helpers/graphql/gql-config.service.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 catch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      catch(exception: HttpException, host: ArgumentsHost) {
                          const ctx = host.switchToHttp();
                          const res = ctx.getResponse<Response>();
                          const req = ctx.getRequest<Request>();
                          let status = HttpStatus.BAD_REQUEST;
                  Severity: Minor
                  Found in src/app/_helpers/filters/http-exception.filter.ts - About 1 hr to fix

                    Function decideUnanimous has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private async decideUnanimous(
                            token,
                            attributes,
                            object = null,
                        ): Promise<boolean> {
                    Severity: Minor
                    Found in src/app/security/access-decision/access-decision-manager.ts - About 35 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

                    Function decideConsensus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private async decideConsensus(
                            token,
                            attributes,
                            object = null,
                        ): Promise<boolean> {
                    Severity: Minor
                    Found in src/app/security/access-decision/access-decision-manager.ts - About 25 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