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,
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`,
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(
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
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}!`);
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':
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;
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,
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,
- Read upRead up
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;
Function decideUnanimous
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async decideUnanimous(
token,
attributes,
object = null,
): Promise<boolean> {
- Read upRead up
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> {
- Read upRead up
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"