Skip to content

Commit 27249c9

Browse files
author
ksidoren
committed
feat: github action + typescript
1 parent f96b530 commit 27249c9

21 files changed

+5866
-534
lines changed

.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": "latest",
10+
"sourceType": "module"
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"rules": {}
14+
}

.github/dependabot.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ updates:
55
schedule:
66
interval: daily
77
open-pull-requests-limit: 10
8-
ignore:
9-
- dependency-name: mocha
10-
versions:
11-
- 8.2.1
12-
- 8.3.0
13-
- 8.3.1
14-
- dependency-name: ejs
15-
versions:
16-
- 3.1.5
17-
- dependency-name: lodash
18-
versions:
19-
- 4.17.20
20-
- dependency-name: minimist
21-
versions:
22-
- 1.2.5
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/pipeline.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pipeline
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: actions/setup-node@v2
9+
with:
10+
node-version: '17'
11+
cache: 'npm'
12+
- run: npm install
13+
- run: npm test
14+
- run: npm run build

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Download artifact
11+
uses: dawidd6/action-download-artifact@v2
12+
with:
13+
workflow: pipeline.yml
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: '17'
17+
cache: 'npm'
18+
- run: npm ci
19+
- run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,146 @@
1-
node_modules/
21
sonar-report.html
2+
3+
# Created by https://www.toptal.com/developers/gitignore/api/node
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
5+
6+
### Node ###
7+
# Logs
8+
logs
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
lerna-debug.log*
14+
.pnpm-debug.log*
15+
16+
# Diagnostic reports (https://nodejs.org/api/report.html)
17+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
18+
19+
# Runtime data
20+
pids
21+
*.pid
22+
*.seed
23+
*.pid.lock
24+
25+
# Directory for instrumented libs generated by jscoverage/JSCover
26+
lib-cov
27+
28+
# Coverage directory used by tools like istanbul
29+
coverage
30+
*.lcov
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (https://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
jspm_packages/
50+
51+
# Snowpack dependency directory (https://snowpack.dev/)
52+
web_modules/
53+
54+
# TypeScript cache
55+
*.tsbuildinfo
56+
57+
# Optional npm cache directory
58+
.npm
59+
60+
# Optional eslint cache
61+
.eslintcache
62+
63+
# Optional stylelint cache
64+
.stylelintcache
65+
66+
# Microbundle cache
67+
.rpt2_cache/
68+
.rts2_cache_cjs/
69+
.rts2_cache_es/
70+
.rts2_cache_umd/
71+
72+
# Optional REPL history
73+
.node_repl_history
74+
75+
# Output of 'npm pack'
76+
*.tgz
77+
78+
# Yarn Integrity file
79+
.yarn-integrity
80+
81+
# dotenv environment variable files
82+
.env
83+
.env.development.local
84+
.env.test.local
85+
.env.production.local
86+
.env.local
87+
88+
# parcel-bundler cache (https://parceljs.org/)
89+
.cache
90+
.parcel-cache
91+
92+
# Next.js build output
93+
.next
94+
out
95+
96+
# Nuxt.js build / generate output
97+
.nuxt
98+
dist
99+
100+
# Gatsby files
101+
.cache/
102+
# Comment in the public line in if your project uses Gatsby and not Next.js
103+
# https://nextjs.org/blog/next-9-1#public-directory-support
104+
# public
105+
106+
# vuepress build output
107+
.vuepress/dist
108+
109+
# vuepress v2.x temp and cache directory
110+
.temp
111+
112+
# Docusaurus cache and generated files
113+
.docusaurus
114+
115+
# Serverless directories
116+
.serverless/
117+
118+
# FuseBox cache
119+
.fusebox/
120+
121+
# DynamoDB Local files
122+
.dynamodb/
123+
124+
# TernJS port file
125+
.tern-port
126+
127+
# Stores VSCode versions used for testing VSCode extensions
128+
.vscode-test
129+
130+
# yarn v2
131+
.yarn/cache
132+
.yarn/unplugged
133+
.yarn/build-state.yml
134+
.yarn/install-state.gz
135+
.pnp.*
136+
137+
### Node Patch ###
138+
# Serverless Webpack directories
139+
.webpack/
140+
141+
# Optional stylelint cache
142+
143+
# SvelteKit build / generate output
144+
.svelte-kit
145+
146+
# End of https://www.toptal.com/developers/gitignore/api/node

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ $ npm install -g sonar-report
1919

2020
## Use
2121
- See all options with:
22-
```
22+
23+
```bash
2324
$ sonar-report --help
2425
SYNOPSIS
2526
sonar-report [OPTION]...
2627
```
28+
2729
- Environment:
2830
- http_proxy : the proxy to use to reach the sonarqube instance (`http://<host>:<port>`)
2931
- NODE_EXTRA_CA_CERTS
3032
- the custom certificate authority to trust (troubleshoots `Unable to verify the first certificate`)
3133
- the variable holds a file name that contains the certificate in pem format (root CA or full trust chain)
3234

3335
- Example:
36+
3437
```bash
3538
# Generate report example
3639
sonar-report \
@@ -41,14 +44,16 @@ sonar-report \
4144
--release="1.0.0" \
4245
--branch="feature/branch" \
4346
--sinceleakperiod="false" \
44-
--allbugs="false" > /tmp/sonar-report_sonar-report.html
47+
--allbugs="false"
48+
--reportFile=/tmp/sonar-report_sonar-report.html
4549

4650

4751
# Open in browser
4852
xdg-open /tmp/sonar-report_sonar-report.html
4953
```
5054

5155
## Some parameters explained
56+
5257
### sinceleakperiod
5358

5459
The `sinceleakperiod` parameter activates delta analysis. If `true`, sonar-report will only get the vulnerabilities that were added since a fixed date/version or for a number of days. For this it will:
@@ -64,10 +69,12 @@ More info:
6469
- In sonarQube, /settings : see leak period
6570

6671
### allbugs
72+
6773
- "false": only vulnerabilities are exported
6874
- "true": all bugs are exported
6975

7076
### fixMissingRule
77+
7178
On some versions of sonar (found on 6.5), the `type` of issue and the `type` of the rule don't match (for example `VULNERABILITY` vs `CODE_SMELL` ).
7279

7380
In this case, when `allbugs=false`, it's possible that the issue is extracted but not it's rule. What will happen is that the issue has `/` in the description (because the description is the name of the rule).
@@ -77,6 +84,7 @@ To circumvent this issue, the fixMissingRule will extract all rules without any
7784
Beware that, with this parameter activated, all the issues linked to the rules displayed may not be displayed.
7885

7986
### noSecurityHotspot
87+
8088
Sonar-report will try to find how your sonarqube instance is working with hotspots depending on the running version. However in last resort, you can use the `--noSecurityHotspot="true"` flag in order to deactivate the hotspots processing.
8189

8290
**Note that you may miss out on some vulnerabilities when using this option if your sonarqube instance does support hotspots.**
@@ -121,7 +129,7 @@ Get the dependencies:
121129
npm install
122130
```
123131

124-
Run with the same command as [Use](#use) but use `node index.js` instead of `sonar-report`
132+
Run with the same command as [Use](#use) but use `npm run build && npm run start` instead of `sonar-report`
125133

126134
## Troubleshooting
127135

0 commit comments

Comments
 (0)