Skip to content

Commit 8c56056

Browse files
authored
ci(circleci): added sonar and git hooks (CORE-4768) (#16)
* ci(circleci): added sonar and git hooks * fix: move pr check to circleci and eslint finished
1 parent 059c77b commit 8c56056

File tree

7 files changed

+665
-118
lines changed

7 files changed

+665
-118
lines changed

.circleci/config.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: 2.1
22

33
orbs:
44
codecov: codecov/[email protected]
5-
vfcommon: voiceflow/[email protected]
5+
vfcommon: voiceflow/[email protected]
6+
sonarcloud: sonarsource/[email protected]
7+
validate-title: qventus/[email protected]
68

79
jobs:
810
build-and-test:
@@ -11,6 +13,7 @@ jobs:
1113
- checkout
1214
- vfcommon/install_node_modules
1315
- vfcommon/lint_source
16+
- vfcommon/lint_report
1417
- vfcommon/unit_tests
1518
- codecov/upload:
1619
file: nyc_coverage/lcov.info
@@ -19,8 +22,22 @@ jobs:
1922
- codecov/upload:
2023
file: nyc_coverage/lcov.info
2124
flags: integration
25+
- sonarcloud/scan
2226

2327
workflows:
28+
pr-checker:
29+
jobs:
30+
- validate-title/validate:
31+
context: dev-test
32+
regex: >-
33+
$PR_REGEX
34+
filters:
35+
branches:
36+
ignore:
37+
- /env-.*/
38+
- staging
39+
- master
40+
2441
test-and-release:
2542
jobs:
2643
- build-and-test

.codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ coverage:
1313
- unit
1414
- integration
1515
paths:
16-
- src
16+
- lib
1717
only_pulls: true

.eslintrc.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
extends: '@voiceflow/eslint-config',
3-
rules: {
4-
'no-continue': 'off',
5-
'quotes': ['error', 'single', 'avoid-escape'],
6-
'sonarjs/cognitive-complexity': 'warn',
7-
'promise/always-return': 'off',
8-
}
95
};

package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
},
1414
"dependencies": {
15-
"@voiceflow/logger": "^1.1.10",
15+
"@voiceflow/logger": "^1.4.2",
1616
"@voiceflow/verror": "^1.1.0",
1717
"bluebird": "^3.7.2",
1818
"chai": "^4.2.0",
@@ -26,9 +26,9 @@
2626
},
2727
"devDependencies": {
2828
"@commitlint/config-conventional": "^8.0.0",
29-
"@voiceflow/eslint-config": "^2.0.1",
30-
"@voiceflow/git-branch-check": "^1.0.2",
31-
"@voiceflow/prettier-config": "^1.0.4",
29+
"@voiceflow/eslint-config": "^2.0.5",
30+
"@voiceflow/git-branch-check": "^1.1.3",
31+
"@voiceflow/prettier-config": "^1.0.5",
3232
"codacy-coverage": "^3.4.0",
3333
"commitizen": "^3.1.1",
3434
"commitlint": "^8.0.0",
@@ -41,7 +41,8 @@
4141
"lint-staged": "^8.2.1",
4242
"mocha": "^6.1.4",
4343
"nyc": "^14.1.0",
44-
"prettier": "^1.18.2",
44+
"prettier": "^1.19.1",
45+
"prettier-eslint-cli": "^5.0.0",
4546
"semantic-release": "^15.13.17",
4647
"supertest": "^4.0.2"
4748
},
@@ -71,6 +72,7 @@
7172
],
7273
"**/*.js": [
7374
"eslint --fix",
75+
"prettier-eslint --write",
7476
"git add"
7577
]
7678
},
@@ -85,10 +87,11 @@
8587
"lint": "eslint \"**/*.js\"",
8688
"lint:fix": "yarn lint --fix",
8789
"lint:quiet": "yarn lint --quiet",
90+
"lint:report": "yarn lint --format json -o sonar/report.json",
8891
"prepare": "fixpack",
8992
"test": "nyc mocha --opts ./config/tests/mocha.opts 'tests/**/*.{unit,it}.js'",
90-
"test:unit": "nyc mocha --opts ./config/tests/mocha.opts 'tests/**/*.unit.js'",
9193
"test:integration": "nyc mocha --opts ./config/tests/mocha.opts 'tests/**/*.it.js'",
92-
"test:single": "mocha --opts ./config/tests/mocha.opts"
94+
"test:single": "mocha --opts ./config/tests/mocha.opts",
95+
"test:unit": "nyc mocha --opts ./config/tests/mocha.opts 'tests/**/*.unit.js'"
9396
}
9497
}

sonar-project.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sonar.organization=voiceflow
2+
sonar.projectKey=voiceflow_backend-utils
3+
sonar.projectName=backend-utils
4+
sonar.sources=lib
5+
sonar.tests=tests
6+
sonar.eslint.reportPaths=sonar/report.json
7+
sonar.typescript.tsconfigPath=./tsconfig.json
8+
sonar.coverage.exclusions=**/**

tests/.eslintrc.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
extends: '../.eslintrc.js',
3-
rules: {
4-
'no-continue': 'off',
5-
'quotes': ['error', 'single', 'avoid-escape'],
6-
'sonarjs/cognitive-complexity': 'warn',
7-
'promise/always-return': 'off',
8-
'require-jsdoc': 'off',
9-
'no-unused-expressions': 'off',
10-
'sonarjs/no-duplicate-string': 'off',
11-
'eslint-comments/disable-enable-pair': 'off'
12-
}
135
};

0 commit comments

Comments
 (0)