Skip to content

Commit

Permalink
WEB-1570 configure sonarqube
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ladaria committed Oct 3, 2023
1 parent 98e98ad commit 5f22c76
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
Empty file added .scannerwork/.sonar_lock
Empty file.
6 changes: 6 additions & 0 deletions .scannerwork/report-task.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
projectKey=mistica-web
serverUrl=http://epg-sonar.hi.inet:9000
serverVersion=10.2.0.77647
dashboardUrl=http://epg-sonar.hi.inet:9000/dashboard?id=mistica-web
ceTaskId=AYr10eumyF5njyJkf40j
ceTaskUrl=http://epg-sonar.hi.inet:9000/api/ce/task?id=AYr10eumyF5njyJkf40j
13 changes: 13 additions & 0 deletions jest.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ module.exports = {
...require('./jest.base.config'),
testTimeout: 10000,
displayName: 'unit',

collectCoverage: true,
collectCoverageFrom: [
'**/src/**/*.[jt]s(x)?',
'!**/node_modules/**',
'!**/__*__/**', // ignore tests, acceptance, stories, etc
'!**/src/generated/**', // ignore generated files
'!**/*.d.ts',
],

coverageReporters: ['lcov'],
coverageDirectory: './reports/coverage',

testEnvironment: 'jsdom',
testMatch: ['**/__tests__/*-test.tsx'],
testEnvironmentOptions: {url: 'http://test.tuenti.com'},
Expand Down
15 changes: 15 additions & 0 deletions scripts/sonarqube-scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Change working directory to the root of the project
cd "$(dirname "$0")"/..

# Extract version from package.json
SONAR_PROJECT_VERSION=`node -e "console.log(require('./package.json').version)"`

echo "Running SonarQube analysis for mistica-web..."
docker run \
--rm \
-e SONAR_TOKEN="${SONAR_TOKEN}" \
-e SONAR_PROJECT_VERSION="${SONAR_PROJECT_VERSION}" \
-v "${PWD}:/usr/src" \
sonarsource/sonar-scanner-cli
48 changes: 48 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
sonar.projectVersion=${env.SONAR_PROJECT_VERSION}

# must be unique in a given SonarQube instance
sonar.projectKey=mistica-web

sonar.host.url=http://epg-sonar.hi.inet:9000

sonar.exclusions=\
**/__screenshot_tests__/**,\
**/__acceptance_tests__/**,\
**/__stories__/**,\
**/__private_stories__/**,\
**/__tests__/**,\
**/__type_tests__/**,\
**/.yarn/**,\
**/codemods/**,\
**/css/**,\
**/dist-es/**,\
**/dist/**,\
**/examples/**,\
**/node_modules/**,\
**/packages/**,\
**/playroom/**,\
**/public/**,\
**/reports/**,\
**/scripts/**,\
src/generated/**,\
src/test-utils/**

# https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/test-coverage/test-coverage-parameters/#sonarjavascriptlcovreportpaths
sonar.typescript.lcov.reportPaths=./reports/coverage/lcov.info

sonar.test.inclusions=\
**/__tests__/**/*-test.tsx,\
**/__tests__/**/*-test.ts,\
**/__tests__/**/*-test.js

# defaults to project key
sonar.projectName=mistica-web

# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=.

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

# https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scm-integration/
sonar.scm.disabled=True
1 change: 1 addition & 0 deletions src/touchable.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const base = style([
cursor: 'pointer',
}),
{
margin: 0,
verticalAlign: 'bottom', // required to remove bottom gap when rendered as inline-block div
fontFamily: 'inherit',
appearance: 'none',
Expand Down

0 comments on commit 5f22c76

Please sign in to comment.