Skip to content

Commit

Permalink
Merge pull request #27438 from qmonmert/fixreadonly2
Browse files Browse the repository at this point in the history
Sonar: Member is never reassigned; mark it as readonly
  • Loading branch information
DanielFran authored Sep 29, 2024
2 parents 7fe099f + 42521cb commit e04ded7
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class UserManagementService {
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

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

<%_ if (generateUserManagement) { _%>
create(user: IUser): Observable<IUser> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import { TrackerService } from './core/tracker/tracker.service';
],
})
export default class AppComponent {
private applicationConfigService = inject(ApplicationConfigService);
private iconLibrary = inject(FaIconLibrary);
private readonly applicationConfigService = inject(ApplicationConfigService);
private readonly iconLibrary = inject(FaIconLibrary);
<%_ if (communicationSpringWebsocket) { _%>
private trackerService = inject(TrackerService);
private readonly trackerService = inject(TrackerService);
<%_ } _%>
private dpConfig = inject(NgbDatepickerConfig);
private readonly dpConfig = inject(NgbDatepickerConfig);

constructor() {
<%_ if (communicationSpringWebsocket) { _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import { ApplicationConfigService } from '../config/application-config.service';

@Injectable({ providedIn: 'root' })
export class AccountService {
private userIdentity = signal<Account | null>(null);
private authenticationState = new ReplaySubject<Account | null>(1);
private readonly userIdentity = signal<Account | null>(null);
private readonly authenticationState = new ReplaySubject<Account | null>(1);
private accountCache$?: Observable<Account> | null;

<%_ if (enableTranslation) { _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import { Injectable } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class StateStorageService {
private previousUrlKey = 'previousUrl';
private authenticationKey = '<%= jhiPrefixDashed %>-authenticationToken';
private readonly previousUrlKey = 'previousUrl';
private readonly authenticationKey = '<%= jhiPrefixDashed %>-authenticationToken';
<%_ if (enableTranslation) { _%>
private localeKey = 'locale';
private readonly localeKey = 'locale';
<%_ } _%>

storeUrl(url: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import PageRibbonComponent from '../profiles/page-ribbon.component';
})
export default class MainComponent implements OnInit {
<%_ if (enableTranslation) { _%>
private renderer: Renderer2;
private readonly renderer: Renderer2;
<%_ } _%>

private readonly router = inject(Router);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ProfileService {
private readonly http = inject(HttpClient);
private readonly applicationConfigService = inject(ApplicationConfigService);

private infoUrl = this.applicationConfigService.getEndpointFor('management/info');
private readonly infoUrl = this.applicationConfigService.getEndpointFor('management/info');
private profileInfo$?: Observable<ProfileInfo>;

getProfileInfo(): Observable<ProfileInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import { AccountService } from 'app/core/auth/account.service';
export default class HasAnyAuthorityDirective {
public authorities = input<string | string[]>([], { alias: '<%= jhiPrefix %>HasAnyAuthority' });

private templateRef = inject(TemplateRef<any>);
private viewContainerRef = inject(ViewContainerRef);
private readonly templateRef = inject(TemplateRef<any>);
private readonly viewContainerRef = inject(ViewContainerRef);

constructor() {
const accountService = inject(AccountService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { SortState } from './sort-state';

@Injectable({ providedIn: 'root' })
export class SortService {
private collator = new Intl.Collator(undefined, {
private readonly collator = new Intl.Collator(undefined, {
numeric: true,
sensitivity: 'base',
});
Expand Down

0 comments on commit e04ded7

Please sign in to comment.