Skip to content

Commit

Permalink
Merge pull request #418 from jhipster/somesonar
Browse files Browse the repository at this point in the history
Sonar issues
  • Loading branch information
DanielFran authored Sep 17, 2023
2 parents 0cfd528 + a15a4d5 commit 9be1842
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/main/java/io/github/jhipster/online/JhonlineApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private static void logApplicationStartup(Environment env) {
protocol = "https";
}
String serverPort = env.getProperty("server.port");
String applicationName = env.getProperty("spring.application.name");
String contextPath = env.getProperty("server.servlet.context-path");
if (StringUtils.isBlank(contextPath)) {
contextPath = "/";
Expand All @@ -109,7 +110,7 @@ private static void logApplicationStartup(Environment env) {
"Local: \t\t{}://localhost:{}{}\n\t" +
"External: \t{}://{}:{}{}\n\t" +
"Profile(s): \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
applicationName,
protocol,
serverPort,
contextPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
return next.handle(request).pipe(
tap({
error: (err: HttpErrorResponse) => {
if (!(err.status === 401 && (err.message === '' || (err.url && err.url.includes('api/account'))))) {
if (!(err.status === 401 && (err.message === '' || err.url?.includes('api/account')))) {
this.eventManager.broadcast(new JhiEventWithContent('jhonlineApp.httpError', err));
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/webapp/app/home/ci-cd/ci-cd.output.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ export class CiCdOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 2000);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ export class GeneratorOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 500);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayApplicationUrl = true;
}
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ export class JdlMetadataService {
}

private convert(jdlMetadata: JdlMetadata): JdlMetadata {
return Object.assign({}, jdlMetadata);
return { ...jdlMetadata };
}
}
6 changes: 2 additions & 4 deletions src/main/webapp/app/home/jdl-metadata/jdl.output.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ export class JdlOutputDialogComponent implements OnInit {
setTimeout(() => {
this.updateLogsData();
}, 2000);
} else {
if (data.endsWith('Generation finished\n')) {
this.displayBranchUrl = true;
}
} else if (data.endsWith('Generation finished\n')) {
this.displayBranchUrl = true;
}
},
() => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/layouts/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class MainComponent implements OnInit {
}

private getPageTitle(routeSnapshot: ActivatedRouteSnapshot): string {
let title: string = routeSnapshot.data && routeSnapshot.data['pageTitle'] ? routeSnapshot.data['pageTitle'] : '';
let title: string = routeSnapshot.data?.pageTitle ?? '';
if (routeSnapshot.firstChild) {
title = this.getPageTitle(routeSnapshot.firstChild) || title;
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/webapp/app/layouts/profiles/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ export class ProfileService {
map((response: InfoResponse) => {
const profileInfo: ProfileInfo = {
activeProfiles: response.activeProfiles,
inProduction: response.activeProfiles && response.activeProfiles.includes('prod'),
swaggerEnabled: response.activeProfiles && response.activeProfiles.includes('swagger')
inProduction: response.activeProfiles?.includes('prod'),
swaggerEnabled: response.activeProfiles?.includes('swagger')
};
if (response.activeProfiles && response['display-ribbon-on-profiles']) {
const displayRibbonOnProfiles = response['display-ribbon-on-profiles'].split(',');
const ribbonProfiles = displayRibbonOnProfiles.filter(
profile => response.activeProfiles && response.activeProfiles.includes(profile)
);
const ribbonProfiles = displayRibbonOnProfiles.filter(profile => response.activeProfiles?.includes(profile));
if (ribbonProfiles.length > 0) {
profileInfo.ribbonEnv = ribbonProfiles[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h1>You must enable javascript to view this page.</h1>
}
function showError() {
var errorElm = document.getElementById("jhipster-error");
if (errorElm && errorElm.style) {
if (errorElm?.style) {
errorElm.style.display = "block";
}
}
Expand Down

0 comments on commit 9be1842

Please sign in to comment.