Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci-cd): resolve sonar issues #2180

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const debug = debugFactory('loopback:socketio:controller');
export class SocketIoController {
constructor(
@socketio.socket() // Equivalent to `@inject('ws.socket')`
private socket: Socket,
private readonly socket: Socket,
) {}

/**
Expand Down Expand Up @@ -80,7 +80,6 @@ export class SocketIoController {
registerChannel(msg: string[]) {
if (Array.isArray(msg) && msg.length > 0) {
msg.forEach(item => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.socket.join(item);
});
} else {
Expand Down
4 changes: 3 additions & 1 deletion sandbox/oauth-example/src/controllers/ping.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const PING_RESPONSE: ResponseObject = {
* A simple controller to bounce back http requests
*/
export class PingController {
constructor(@inject(RestBindings.Http.REQUEST) private req: Request) {}
constructor(
@inject(RestBindings.Http.REQUEST) private readonly req: Request,
) {}

// Map to `GET /ping`
@get('/ping')
Expand Down
3 changes: 2 additions & 1 deletion sandbox/workflow-ms-example/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ export class WorkflowHelloworldApplication extends BootMixin(
this.component(WorkflowServiceComponent);

this.bind(WorkflowServiceBindings.WorkflowManager).toProvider(BpmnProvider);
// sonarignore:start
this.registerWorkers().catch(err => {
throw new Error('Error while registering workers.');
});

// sonarignore:end
this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
this.bootOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ records. */
export class StateTrackingController {
constructor(
@inject('services.StateTrackingService')
private stateTrackingService: StateTrackingService,
private readonly stateTrackingService: StateTrackingService,
) {}
@authenticate(STRATEGY.BEARER, {passReqToCallback: true})
@authorize({permissions: [PermissionKeys.DeleteIngestionMappings]})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
// https://opensource.org/licenses/MIT
import {authenticate, STRATEGY} from 'loopback4-authentication';
export function authenticateOnCondition(condition = false) {
// sonarignore:start
if (condition) {
return authenticate(STRATEGY.BEARER);
} else {
return () => {}; //NOSONAR
return () => {};
}
// sonarignore:end
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ export function getOnCondition(
path: string,
spec?: OperationObject | undefined,
) {
// sonarignore:start
if (condition) {
return get(path, spec);
} else {
return () => {}; //NOSONAR
return () => {};
}
// sonarignore:end
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class EventWorkflowRepository extends SequelizeUserModifyCrudRepository<
@inject(`datasources.${TaskDbSourceName}`)
dataSource: SequelizeDataSource,
@inject.getter(AuthenticationBindings.CURRENT_USER)
private userGetter: Getter<IAuthUserWithPermissions>,
private readonly userGetter: Getter<IAuthUserWithPermissions>,
@inject('models.EventWorkflow')
private readonly eventWorkflow: typeof Entity & {prototype: EventWorkflow},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class TaskWorkFlowRepository extends SequelizeUserModifyCrudRepository<
@inject(`datasources.${TaskDbSourceName}`)
dataSource: SequelizeDataSource,
@inject.getter(AuthenticationBindings.CURRENT_USER)
private userGetter: Getter<IAuthUserWithPermissions>,
private readonly userGetter: Getter<IAuthUserWithPermissions>,
@inject('models.TaskWorkflow')
private readonly taskWorkflow: typeof Entity & {prototype: TaskWorkflow},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class TaskRepository extends SequelizeUserModifyCrudRepository<
@repository.getter('UserTaskRepository')
userTaskRepo: Getter<UserTaskRepository>,
@inject.getter(AuthenticationBindings.CURRENT_USER)
private userGetter: Getter<IAuthUserWithPermissions>,
private readonly userGetter: Getter<IAuthUserWithPermissions>,
@inject('models.Task')
private readonly task: typeof Entity & {prototype: Task},
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class UserTaskRepository extends SequelizeUserModifyCrudRepository<
@inject(`datasources.${TaskDbSourceName}`)
dataSource: SequelizeDataSource,
@inject.getter(AuthenticationBindings.CURRENT_USER)
private userGetter: Getter<IAuthUserWithPermissions>,
private readonly userGetter: Getter<IAuthUserWithPermissions>,
@inject('models.UserTask')
private readonly userTask: typeof Entity & {prototype: UserTask},
) {
Expand Down
Loading