Skip to content

Commit cd4689b

Browse files
authored
Merge pull request #158 from hearde/chore/sonar-ignore
chore: clean up sonar config, add ignore for typescript:S1848
2 parents b5bdba1 + 2a2f100 commit cd4689b

File tree

2 files changed

+37
-67
lines changed

2 files changed

+37
-67
lines changed

buildspec.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ phases:
1717
- ./run-unit-tests.sh
1818
artifacts:
1919
files:
20-
- .gitignore
21-
- deployment/**/*
22-
- source/**/*
23-
- CHANGELOG.md
24-
- buildspec.yml
25-
- NOTICE.txt
26-
- sonar-project.properties
20+
- '**/*'
21+
exclude-paths:
22+
- '**/.pytest_cache/**/*'
23+
- '**/__pycache__/**/*'
24+
- source/node_modules/**/*
25+
- deployment/.venv/**/*
26+
- deployment/temp/**/*

sonar-project.properties

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,36 @@
1-
# Note: Currently testing and supported with code coverage sonarqube
2-
# collection for python lambda (python pytest, python unittest) and javascript jest
3-
# and CDK TypeScript
1+
# scan templates in cdk.out even though they are in .gitignore
2+
sonar.scm.exclusions.disabled = true
43

5-
# Uncomment to enable debugging by default
6-
# sonar.verbose=true
7-
# sonar.log.level=DEBUG
4+
sonar.sources = source/
85

9-
# Disable if needed
10-
sonar.scm.disabled=true
6+
sonar.exclusions = \
7+
**/test/**/*, \
8+
source/jest.config.ts, \
9+
source/coverage/**/*
1110

12-
#
13-
# Refer to https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/
14-
# for details on sources and exclusions. Note also .gitignore
15-
#
16-
sonar.sources= \
17-
source
11+
sonar.tests = \
12+
source/LambdaLayers/test/, \
13+
source/Orchestrator/test/, \
14+
source/playbooks/AFSBP/test/, \
15+
source/playbooks/AFSBP/ssmdocs/scripts/test/, \
16+
source/playbooks/CIS120/test/, \
17+
source/playbooks/CIS140/test/, \
18+
source/playbooks/common/test/, \
19+
source/playbooks/NEWPLAYBOOK/test/, \
20+
source/playbooks/NEWPLAYBOOK/ssmdocs/scripts/test/, \
21+
source/playbooks/PCI321/test/, \
22+
source/playbooks/PCI321/ssmdocs/scripts/test/, \
23+
source/playbooks/SC/test/, \
24+
source/playbooks/SC/ssmdocs/scripts/test/, \
25+
source/remediation_runbooks/scripts/test/, \
26+
source/solution_deploy/source/test/, \
27+
source/test/
1828

19-
# LambdaLayers modules are excluded from lambda folders, where they must be copied for testing
20-
# These files are tested in LambdaLayers
21-
sonar.exclusions= \
22-
**/test/**, \
23-
**/tests/**, \
24-
**/node_modules/**, \
25-
**/python_tests/**, \
26-
**/jest.config.js, \
27-
source/**.js, \
28-
deployment/build/**, \
29-
**/requests/**, \
30-
**/charset_normalizer/**, \
31-
**/chardet/**, \
32-
**/urllib3/**, \
33-
**/idna/**, \
34-
**/certifi/**, \
35-
**/coverage/**, \
36-
**/bin/*.ts, \
37-
deployment/temp/**, \
38-
simtest/**
39-
40-
sonar.tests= \
41-
source/Orchestrator/test, \
42-
source/test, \
43-
source/LambdaLayers/test, \
44-
source/playbooks/AFSBP/test, \
45-
source/playbooks/AFSBP/ssmdocs/scripts/test, \
46-
source/playbooks/CIS120/test, \
47-
source/playbooks/PCI321/test, \
48-
source/playbooks/PCI321/ssmdocs/scripts/test, \
49-
source/solution_deploy/source/test, \
50-
source/remediation_runbooks/scripts/test
29+
sonar.python.version = 3.8, 3.9, 3.10, 3.11
30+
sonar.python.coverage.reportPaths = deployment/test/coverage-reports/*.coverage.xml
5131

52-
sonar.sourceEncoding=UTF-8
32+
sonar.javascript.lcov.reportPaths = source/coverage/lcov.info
5333

54-
## Python Specific Properties*
55-
# coverage
56-
# https://docs.sonarqube.org/pages/viewpage.action?pageId=4784149
57-
# Comma-separated list of ant pattern describing paths to coverage reports, relative to projects
58-
# root. Leave unset to use the default ("coverage-reports/*coverage-*.xml").
59-
sonar.python.coverage.reportPaths=deployment/test/coverage-reports/*.coverage.xml
60-
61-
# Sensor SonarJS Coverage [javascript] was not allowing globbing
62-
# for sonar.javascript.lcov.reportPaths such as this
63-
# source/test/coverage-reports/jest/*/lcov.info
64-
# so we have to provide an explicit list of reportPaths
65-
sonar.javascript.lcov.reportPaths= \
66-
source/coverage/lcov.info
34+
sonar.issue.ignore.multicriteria = ts1
35+
sonar.issue.ignore.multicriteria.ts1.ruleKey = typescript:S1848
36+
sonar.issue.ignore.multicriteria.ts1.resourceKey = **/*.ts

0 commit comments

Comments
 (0)