diff options
author | Ambroise C <ambroise.christea@sonarsource.com> | 2023-09-13 17:24:05 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-09-13 20:02:56 +0000 |
commit | 51c3da2b324930e5ebaf5ea6e7213ba6b31b885b (patch) | |
tree | 1a07ded5e4f2b7f6c1c0a91f9de8904e8e4014e0 /server/sonar-web/src/main/js/apps/projects/query.ts | |
parent | f055071dede97c2195bc93f82b8e5e59abde899d (diff) | |
download | sonarqube-51c3da2b324930e5ebaf5ea6e7213ba6b31b885b.tar.gz sonarqube-51c3da2b324930e5ebaf5ea6e7213ba6b31b885b.zip |
SONAR-20327 Fix code smells following prettier upgrades
Co-authored-by: David Cho-Lerat <david.cho-lerat@sonarsource.com>
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/query.ts')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projects/query.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/query.ts b/server/sonar-web/src/main/js/apps/projects/query.ts index 4cd3b4936b6..66317147971 100644 --- a/server/sonar-web/src/main/js/apps/projects/query.ts +++ b/server/sonar-web/src/main/js/apps/projects/query.ts @@ -148,14 +148,14 @@ function getAsLevel(value: any): Level | undefined { } function getAsString(value: any): string | undefined { - if (typeof value !== 'string' || !value) { + if (typeof value !== 'string' || value === '') { return undefined; } return value; } function getAsStringArray(value: any): string[] | undefined { - if (typeof value !== 'string' || !value) { + if (typeof value !== 'string' || value === '') { return undefined; } return value.split(','); @@ -172,9 +172,9 @@ function getView(value: any): string | undefined { function convertIssuesRating(metric: string, rating: number): string { if (rating > 1 && rating < 5) { return `${metric} >= ${rating}`; - } else { - return `${metric} = ${rating}`; } + + return `${metric} = ${rating}`; } function convertCoverage(metric: string, coverage: number): string { @@ -262,10 +262,10 @@ function pushMetricToArray( query: Query, property: string, conditionsArray: string[], - convertFunction: (metric: string, value: any) => string, + convertFunction: (metric: string, value: Query[string]) => string, ): void { const metric = mapPropertyToMetric(property); - if (query[property] != null && metric) { + if (query[property] !== undefined && metric !== undefined) { conditionsArray.push(convertFunction(metric, query[property])); } } |