Skip to content

Commit

Permalink
Sonar: Member is never reassigned; mark it as readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Sep 28, 2024
1 parent b50af74 commit b34591e
Show file tree
Hide file tree
Showing 53 changed files with 127 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export default class ActivateComponent implements OnInit {
error = signal(false);
success = signal(false);

private activateService = inject(ActivateService);
private route = inject(ActivatedRoute);
private readonly activateService = inject(ActivateService);
private readonly route = inject(ActivatedRoute);

ngOnInit(): void {
this.route.queryParams.pipe(mergeMap(params => this.activateService.get(params.key))).subscribe({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { ApplicationConfigService } from 'app/core/config/application-config.ser

@Injectable({ providedIn: 'root' })
export class ActivateService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

get(key: string): Observable<{}> {
return this.http.get(this.applicationConfigService.getEndpointFor('api/activate'), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export default class PasswordResetFinishComponent implements OnInit, AfterViewIn
}),
});

private passwordResetFinishService = inject(PasswordResetFinishService);
private route = inject(ActivatedRoute);
private readonly passwordResetFinishService = inject(PasswordResetFinishService);
private readonly route = inject(ActivatedRoute);

ngOnInit(): void {
this.route.queryParams.subscribe(params => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { ApplicationConfigService } from 'app/core/config/application-config.ser

@Injectable({ providedIn: 'root' })
export class PasswordResetFinishService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

save(key: string, newPassword: string): Observable<{}> {
return this.http.post(this.applicationConfigService.getEndpointFor('api/account/reset-password/finish'), { key, newPassword });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default class PasswordResetInitComponent implements AfterViewInit {
success = signal(false);
resetRequestForm;

private passwordResetInitService = inject(PasswordResetInitService);
private fb = inject(FormBuilder);
private readonly passwordResetInitService = inject(PasswordResetInitService);
private readonly fb = inject(FormBuilder);

constructor() {
this.resetRequestForm = this.fb.group({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { ApplicationConfigService } from 'app/core/config/application-config.ser

@Injectable({ providedIn: 'root' })
export class PasswordResetInitService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

save(mail: string): Observable<{}> {
return this.http.post(this.applicationConfigService.getEndpointFor('api/account/reset-password/init'), mail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import SharedModule from 'app/shared/shared.module';
export default class PasswordStrengthBarComponent {
colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0'];

private renderer = inject(Renderer2);
private elementRef = inject(ElementRef);
private readonly renderer = inject(Renderer2);
private readonly elementRef = inject(ElementRef);

measureStrength(p: string): number {
let force = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default class PasswordComponent implements OnInit {
}),
});

private passwordService = inject(PasswordService);
private accountService = inject(AccountService);
private readonly passwordService = inject(PasswordService);
private readonly accountService = inject(AccountService);

ngOnInit(): void {
this.account$ = this.accountService.identity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { ApplicationConfigService } from 'app/core/config/application-config.ser

@Injectable({ providedIn: 'root' })
export class PasswordService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

save(newPassword: string, currentPassword: string): Observable<{}> {
return this.http.post(this.applicationConfigService.getEndpointFor('api/account/change-password'), { currentPassword, newPassword });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default class RegisterComponent implements AfterViewInit {
}),
});

<%_ if (enableTranslation) { _%>private translateService = inject(TranslateService);<%_ } _%>
private registerService = inject(RegisterService);
<%_ if (enableTranslation) { _%>private readonly translateService = inject(TranslateService);<%_ } _%>
private readonly registerService = inject(RegisterService);

ngAfterViewInit(): void {
this.login().nativeElement.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Registration } from './register.model';

@Injectable({ providedIn: 'root' })
export class RegisterService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

save(registration: Registration): Observable<{}> {
return this.http.post(this.applicationConfigService.getEndpointFor('api/register'), registration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default class SessionsComponent implements OnInit {
success = false;
sessions: Session[] = [];

private sessionsService = inject(SessionsService);
private accountService = inject(AccountService);
private readonly sessionsService = inject(SessionsService);
private readonly accountService = inject(AccountService);

ngOnInit(): void {
this.sessionsService.findAll().subscribe(sessions => (this.sessions = sessions));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Session } from './session.model';

@Injectable({ providedIn: 'root' })
export class SessionsService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

private resourceUrl = this.applicationConfigService.getEndpointFor('api/account/sessions');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default class SettingsComponent implements OnInit {
login: new FormControl(initialAccount.login, { nonNullable: true }),
});

private accountService = inject(AccountService);
private readonly accountService = inject(AccountService);
<%_ if (enableTranslation) { _%>
private translateService = inject(TranslateService);
private readonly translateService = inject(TranslateService);
<%_ } _%>

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default class ConfigurationComponent implements OnInit {
return data;
});

private sortService = inject(SortService);
private configurationService = inject(ConfigurationService);
private readonly sortService = inject(SortService);
private readonly configurationService = inject(ConfigurationService);

ngOnInit(): void {
this.configurationService.getBeans().subscribe(beans => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { Bean, Beans, ConfigProps, Env, PropertySource } from './configuration.m

@Injectable({ providedIn: 'root' })
export class ConfigurationService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

getBeans(): Observable<Bean[]> {
return this.http.get<ConfigProps>(this.applicationConfigService.getEndpointFor('management/configprops')).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { GatewayRoute } from './gateway-route.model';

@Injectable()
export class GatewayRoutesService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

findAll(): Observable<GatewayRoute[]> {
return this.http.get<GatewayRoute[]>(this.applicationConfigService.getEndpointFor('api/gateway/routes'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class GatewayComponent implements OnInit {
gatewayRoutes: GatewayRoute[] = [];
updatingRoutes = false;

private gatewayRoutesService = inject(GatewayRoutesService);
private readonly gatewayRoutesService = inject(GatewayRoutesService);

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import HealthModalComponent from './modal/health-modal.component';
export default class HealthComponent implements OnInit {
health?: Health;

private modalService = inject(NgbModal);
private healthService = inject(HealthService);
private readonly modalService = inject(NgbModal);
private readonly healthService = inject(HealthService);

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Health } from './health.model';

@Injectable({ providedIn: 'root' })
export class HealthService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

checkHealth(): Observable<Health> {
return this.http.get<Health>(this.applicationConfigService.getEndpointFor('management/health'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { HealthKey, HealthDetails } from '../health.model';
export default class HealthModalComponent {
health?: { key: HealthKey; value: HealthDetails };

private activeModal = inject(NgbActiveModal);
private readonly activeModal = inject(NgbActiveModal);

readableValue(value: any): string {
if (this.health?.key === 'diskSpace') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export default class LogsComponent implements OnInit {
selectedService: string | undefined = undefined;
<%_ } _%>

private logsService = inject(LogsService);
private sortService = inject(SortService);
<%= applicationTypeGateway && gatewayServicesApiAvailable ? 'private gatewayRoutesService = inject(GatewayRoutesService);' : '' %>
private readonly logsService = inject(LogsService);
private sreadonly ortService = inject(SortService);
<%= applicationTypeGateway && gatewayServicesApiAvailable ? 'private readonly gatewayRoutesService = inject(GatewayRoutesService);' : '' %>

ngOnInit(): void {
this.findAndExtractLoggers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { LoggersResponse, Level } from './log.model';

@Injectable({ providedIn: 'root' })
export class LogsService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

changeLevel(name: string, configuredLevel: Level<%= applicationTypeGateway && gatewayServicesApiAvailable ? ', service?: string' : '' %>): Observable<{}> {
return this.http.post(this.applicationConfigService.getEndpointFor(`management/loggers/${name}`<%= applicationTypeGateway && gatewayServicesApiAvailable ? ', service' : '' %>), { configuredLevel });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class MetricsModalThreadsComponent implements OnInit {
threadDumpTimedWaiting = 0;
threadDumpWaiting = 0;

private activeModal = inject(NgbActiveModal);
private readonly activeModal = inject(NgbActiveModal);

ngOnInit(): void {
this.threads?.forEach(thread => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export default class MetricsComponent implements OnInit {
threads = signal<Thread[] | undefined>(undefined);
updatingMetrics = signal(true);

private metricsService = inject(MetricsService);
private changeDetector = inject(ChangeDetectorRef);
private readonly metricsService = inject(MetricsService);
private readonly changeDetector = inject(ChangeDetectorRef);

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Metrics, ThreadDump } from './metrics.model';

@Injectable({ providedIn: 'root' })
export class MetricsService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

getMetrics(): Observable<Metrics> {
return this.http.get<Metrics>(this.applicationConfigService.getEndpointFor('management/jhimetrics'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class TrackerComponent implements OnInit, OnDestroy {
activities: TrackerActivity[] = [];
subscription?: Subscription;

private trackerService = inject(TrackerService);
private readonly trackerService = inject(TrackerService);

showActivity(activity: TrackerActivity): void {
let existingActivity = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import { UserManagementService } from '../service/user-management.service';
export default class UserManagementDeleteDialogComponent {
user?: User;

private userService = inject(UserManagementService);
private activeModal = inject(NgbActiveModal);
private readonly userService = inject(UserManagementService);
private readonly activeModal = inject(NgbActiveModal);

cancel(): void {
this.activeModal.dismiss();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ export default class UserManagementComponent implements OnInit {
sortState = sortStateSignal({});
<%_ } _%>

private userService = inject(UserManagementService);
private readonly userService = inject(UserManagementService);
<%_ if (!databaseTypeCassandra) { _%>
private activatedRoute = inject(ActivatedRoute);
private router = inject(Router);
private sortService = inject(SortService);
private readonly activatedRoute = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly sortService = inject(SortService);
<%_ } _%>
private modalService = inject(NgbModal);
private readonly modalService = inject(NgbModal);

ngOnInit(): void {
<%_ if (databaseTypeCassandra) { _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import { Authority } from 'app/config/authority.constants';

@Injectable({ providedIn: 'root' })
export class UserManagementService {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

private resourceUrl = this.applicationConfigService.getEndpointFor('api/admin/users');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export default class UserManagementUpdateComponent implements OnInit {
authorities: new FormControl(userTemplate.authorities, { nonNullable: true }),
});

private userService = inject(UserManagementService);
private route = inject(ActivatedRoute);
private readonly userService = inject(UserManagementService);
private readonly route = inject(ActivatedRoute);

ngOnInit(): void {
this.route.data.subscribe(({ user }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export class AccountService {
private accountCache$?: Observable<Account> | null;

<%_ if (enableTranslation) { _%>
private translateService = inject(TranslateService);
private readonly translateService = inject(TranslateService);
<%_ } _%>
private http = inject(HttpClient);
private stateStorageService = inject(StateStorageService);
private router = inject(Router);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly stateStorageService = inject(StateStorageService);
private readonly router = inject(Router);
private readonly applicationConfigService = inject(ApplicationConfigService);

<%_ if (generateUserManagement) { _%>
save(account: Account): Observable<{}> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ type JwtToken = {

@Injectable({ providedIn: 'root' })
export class AuthServerProvider {
private http = inject(HttpClient);
private stateStorageService = inject(StateStorageService);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly stateStorageService = inject(StateStorageService);
private readonly applicationConfigService = inject(ApplicationConfigService);

getToken(): string {
return this.stateStorageService.getAuthenticationToken() ?? '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { Login } from 'app/login/login.model';

@Injectable({ providedIn: 'root' })
export class AuthServerProvider {
private http = inject(HttpClient);
private applicationConfigService = inject(ApplicationConfigService);
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

<%_ if (!authenticationTypeOauth2) { _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CookieService } from 'ngx-cookie-service';

@Injectable({ providedIn: 'root' })
export class CSRFService {
private cookieService = inject(CookieService);
private readonly cookieService = inject(CookieService);

getCSRF(name = 'XSRF-TOKEN'): string {
return this.cookieService.get(name);
Expand Down
Loading

0 comments on commit b34591e

Please sign in to comment.