Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add sonarcloud configurations #276

Merged
merged 2 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"reporter": [
"text",
"lcov"
],
"check-coverage": true,
"lines": 90
}
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ node_js:
before_install:
- sudo apt-get update
- sudo apt-get install -y libsecret-1-dev
script:
- npm run test
- sonar-scanner
install: make install
deploy:
- provider: script
Expand All @@ -31,3 +34,7 @@ notifications:
on_failure: change
rooms:
secure: RfnO47KWRcZhzznK2zU7AQBQd8fmuXQFSCNQ0CpPM/4GywA6XBSVHbnI4uEr7lmEdB2WKktGHtKcfC0H/tCFkxBzovlkiHEsOPrc6/4RsJKrPYjO1qX35ttdiILkmClyo2V8cPOu2m5HhTYddn9wuKN/A7tjjNRHz8ani+CmVBnXMkbyRW5DlY1/q99Y4y2GLMhERyMqNZyeaGDoR4UOl2OuRExBZeN2E7gtUhf5LyCsD/995DQRHx0cJrAZh2tMcubdGOKH0hYVohUFjgeTBOu1Fcwn845i3cXp1IG5cx83EEsNSvcmux96EpMTlu+D7ABjFtUjTFXuDDjXhWGhdC3S3C5/UbVX4tNGbGq2ErSGS4TP8WRPthVyFnvOY2j4jWLmiDDUGyVY8rPsKd2PsO9JDMnL9GCJxwUlK222oAqdkObntm8bEjUk8YODgX7SsgeJ4s5Zp5nKnG/GBiWZAYp2WbiSMltEJiL/jTpAgUMfhVAefgHMi362TC97y/nYcUhGTftMqlx+ca3FlEayV0CTQd9CSjBKuZ/IGeE3qlZbZhWqQMt9gtvNaZ5yToAxNxfxIwJqgdaRlQ5ZJRJESrTXVRIo2v4+9qaofK57trz05oLREyTAUk/8hWGFTcOfXSQw/Up1ycGjtLSLFPuU3PJ7px4lQGfATonv1SgXfrg=
addons:
sonarcloud:
token:
secure: HoD6oJ03Y60apDszjFZ8AN+ujnkbQAPM41bBb/YNNMtgslfnJPp63bQy5m0hoCsTVRoPiZvuZRpfxQpcJLmlEScY4ulQI7DRf+FFh6/2B80+kl1FRLsyar0/JtZvn/LDsP5GjksIZUD2cdPho2rRnmGiS9bmrKIc4YRKKxMO/zi33EUPgiwea23rCB/6/CK6AnAyD7ufwM/ldewqKiU5T67IbAQM2mKEMqyM+oPSx/HL6f9NrtpenZs9pP3y8oRCCty8yP5BOyoLqOJvn0lRqdAAL5S8Jsrb6NB7Mk+lrU4AcfcgEmDGbj+wKFdV/xlqZcCDGDvytqGocGsQZLwbaNlOzSTkoJVvzy1crMxySsqVFoGusISPXA3iJgBQn08E8bwSI1SWDfdvQTFZFYcoc/1OWNutH6EvoHC9uM9rmIRJPVDqGeBevlJq7vffspnuwpWZeH6hWQt7kHBGxQSYtCyOUkFU0IntRFiX2KvyP38rRIlfeoDM2fqaD/NUg0+C77YYhi9on74mQrw8EEjq5QErht458shfjiPPoq8PHpN2WNXjJ8lRHc6h8eqNzX0Uz2ooPOvxgFnyjergBbe5KADQkPLhJehZQhNtHiAfAX5dtkP8IJizu0tpwrTkMWrMMT51nbqL/zOtH6yflr1+AjKrLM7YFRSj8by3yokNzI4=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Is this token generated from sonar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used travis encryption for sonar cloud token

travis encrypt --add addons.sonarcloud.token <SONAR_TOKEN>

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lint:fix": "npm run lint -- --fix",
"prepack": "oclif-dev manifest && oclif-dev readme && npm shrinkwrap && git checkout -- package-lock.json",
"postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json",
"test": "nyc --check-coverage --lines 90 --reporter=html --reporter=text mocha --forbid-only \"test/**/*.test.js\"",
"test": "nyc mocha --forbid-only \"test/**/*.test.js\"",
"posttest": "npm run lint && npm audit",
"version": "oclif-dev readme && git add README.md"
},
Expand Down
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.projectKey=twilio_twilio-cli
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Where are we using these properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This key is generated by Sonar dashboard, which needs to be a 1:1 mapping between repositories.
Helps sonar to link a CI build to it's dashboard view.

sonar.projectName=twilio-cli
sonar.organization=twilio

sonar.sources=src/
sonar.tests=test/
# sonar.test.exclusions= < No exclusions currently >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If not required, we can remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deliberately added this to avoid checking documentation back again for skipping some specific test branches.

sonar.javascript.lcov.reportPaths=coverage/lcov.info