Skip to content

Commit

Permalink
fix: sonar cloud smells
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoVazquez committed May 23, 2023
1 parent cd72a1b commit d612313
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NoopConsole } from './noop-console.service';
deps: [[new Optional(), new SkipSelf(), NoopConsole]],
provide: lumberjackConsoleToken,
useFactory: (maybeExistingInstance: NoopConsole | null): NoopConsole =>
maybeExistingInstance || new NoopConsole(),
maybeExistingInstance ?? new NoopConsole(),
},
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SpyConsole } from './spy-console.service';
{
deps: [[new Optional(), new SkipSelf(), SpyConsole]],
provide: lumberjackConsoleToken,
useFactory: (maybeExistingInstance: SpyConsole | null): SpyConsole => maybeExistingInstance || new SpyConsole(),
useFactory: (maybeExistingInstance: SpyConsole | null): SpyConsole => maybeExistingInstance ?? new SpyConsole(),
},
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { ObjectPayload } from './object.payload';
@Injectable({ providedIn: 'root' })
export class ObjectService {
log(object?: ObjectPayload): boolean {
return object?.isWorking || false;
return object?.isWorking ?? false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class LumberjackLogBuilder<TPayload extends LumberjackLogPayload | void =
message: this.message,
scope: this.scope,
createdAt: this.time.getUnixEpochTicks(),
payload: (payloadArg[0] || this.payload) as Exclude<TPayload, InternalWithStaticPayload>,
payload: (payloadArg[0] ?? this.payload) as Exclude<TPayload, InternalWithStaticPayload>,
};
}

Expand All @@ -62,7 +62,7 @@ export class LumberjackLogBuilder<TPayload extends LumberjackLogPayload | void =
/**
* Add a scope to the log.
*/
withScope(scope: string): LumberjackLogBuilder<TPayload> {
withScope(scope: string): this {
this.scope = scope;

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class LumberjackLoggerBuilder<TPayload extends LumberjackLogPayload | voi
/**
* Add a scope to the `LumberjackLog`
*/
withScope(scope: string): LumberjackLoggerBuilder<TPayload> {
withScope(scope: string): this {
this.scope = scope;

return this;
Expand Down

0 comments on commit d612313

Please sign in to comment.