Skip to content

Commit 4831740

Browse files
CCM-15866: Address More Sonar Findings (#106)
1 parent e946db0 commit 4831740

6 files changed

Lines changed: 30 additions & 21 deletions

File tree

containers/example-app/src/__tests__/server.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import http from 'http';
1+
import http from 'node:http';
22
import { createRequestHandler, startServer } from '../server';
33

44
describe('example-app server', () => {

scripts/config/sonar-scanner.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sonar.host.url=https://sonarcloud.io
44
sonar.qualitygate.wait=true
55
sonar.sourceEncoding=UTF-8
66
sonar.sources=.
7-
sonar.exclusions=lambdas/*/src/__tests__/**/*,infrastructure/terraform/bin/terraform.sh
7+
sonar.exclusions=lambdas/*/src/__tests__/**/*,containers/**/src/__tests__,infrastructure/terraform/bin/terraform.sh
88
sonar.terraform.provider.aws.version=5.54.1
99
sonar.cpd.exclusions=**.test.*
1010
sonar.coverage.exclusions=tests/, **/*.dev.*, lambdas/**/src/__tests__, utils/utils/src/zod-validators.ts ,**/jest.config.ts,scripts/**/*, containers/**/src/__tests__, eslint.config.mjs, docs/assets/js/nhs-notify.js, containers/example-app/src/server.ts

scripts/githooks/check-todos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function search_todos() {
125125
# If the file is excluded, skip it
126126
if [[ "$skip" = false && -f "$file" ]]; then
127127
file_todos=$(grep -nHiE '\bTODO\b' "$file" || true)
128-
[ -n "$file_todos" ] && todos+="$file_todos\n"
128+
[[ -n "$file_todos" ]] && todos+="$file_todos\n"
129129
fi
130130
done
131131

scripts/maintenance/merge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*******************************************************************************/
1515

16-
const fs = require("fs");
16+
const fs = require("node:fs");
1717

1818
// Read files
1919
const [file1, file2] = process.argv.slice(2);

scripts/setup/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ function main() {
1515
cd "$(git rev-parse --show-toplevel)"
1616

1717
run-setup
18+
19+
return 0
1820
}
1921

2022
function run-setup() {
@@ -23,6 +25,8 @@ function run-setup() {
2325
time make config
2426

2527
check-setup-status
28+
29+
return 0
2630
}
2731

2832
# Check the exit status of tfsec.
@@ -34,6 +38,8 @@ function check-setup-status() {
3438
echo "Setup was unsuccessful."
3539
exit 1
3640
fi
41+
42+
return 0
3743
}
3844

3945
# ==============================================================================

scripts/terraform/trivy-scan.sh

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,38 @@ function main() {
2828
local dir_to_scan="."
2929

3030
while [[ $# -gt 0 ]]; do
31-
case "$1" in
31+
local current_arg="$1"
32+
case "$current_arg" in
3233
--mode|-m)
3334
if [[ $# -lt 2 ]]; then
3435
echo "Error: --mode requires an argument." >&2
3536
usage
3637
exit 1
3738
fi
38-
scan_mode="$2"
39+
local mode_arg="$2"
40+
scan_mode="$mode_arg"
3941
shift 2
42+
exit 0
43+
;;
44+
--)
45+
shift
46+
break
47+
;;
48+
-*)
4049
;;
50+
usage
51+
exit 1
52+
;;
53+
*)
54+
dir_to_scan="$current_arg"
55+
shift
4156
--help|-h)
42-
usage
43-
exit 0
44-
;;
45-
--)
46-
shift
47-
break
48-
;;
49-
-*)
50-
echo "Unknown option: $1" >&2
51-
usage
52-
exit 1
53-
;;
54-
*)
55-
dir_to_scan="$1"
57+
dir_to_scan="$trailing_arg"
5658
shift
5759
;;
5860
esac
59-
done
61+
local trailing_arg="$1"
62+
dir_to_scan="$trailing_arg"
6063

6164
if [[ $# -gt 0 ]]; then
6265
dir_to_scan="$1"

0 commit comments

Comments
 (0)