-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mike Heyns
committed
Aug 19, 2024
0 parents
commit 48e74ca
Showing
14 changed files
with
3,538 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true, | ||
"es2017": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:sonarjs/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"tsconfigRootDir": "./packages/" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/interface-name-prefix": [ | ||
"off" | ||
], | ||
"@typescript-eslint/no-var-requires": [ | ||
"off" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
node_modules | ||
dist | ||
results | ||
.nyc_output | ||
*.tsbuildinfo | ||
coverage | ||
.idea | ||
report | ||
.DS_Store | ||
.eslintcache | ||
.jscpd | ||
docs | ||
.cache | ||
tmp | ||
sandbox | ||
tmp/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# jscpd-gitlab-reporter | ||
|
||
## 1.0.0 | ||
|
||
### Initial Release | ||
|
||
- Introduce GitLab Code Quality reporter (CodeClimate format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013-2024 Mike Heyns | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# `jscpd-gitlab-reporter` | ||
|
||
A [GitLab Code Quality](https://docs.gitlab.com/ee/ci/testing/code_quality.html) reporter for [jscpd](https://github.com/kucherenko/jscpd). | ||
|
||
This uses the [custom tool approach](https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool) | ||
which is a subset of the [Code Climate spec](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types). | ||
|
||
## Getting started | ||
|
||
### Install | ||
|
||
```bash | ||
npm install jscpd-gitlab-reporter | ||
``` | ||
|
||
### Usage | ||
|
||
```bash | ||
jscpd [...options] --reporters gitlab /path/to/source | ||
``` | ||
|
||
See the [jspcd CLI docs](https://github.com/kucherenko/jscpd/tree/master/apps/jscpd) for available options and configuration. | ||
|
||
### CI/CD Definition | ||
|
||
Add the following to your `.gitlab-ci.yml` | ||
|
||
```yaml | ||
check:duplicates: | ||
image: node:20.14.0-alpine3.20 | ||
stage: codequality | ||
script: | ||
- npm ci | ||
- npx jscpd --reporters gitlab src/**/* | ||
artifacts: | ||
reports: | ||
codequality: report/gl-codequality.json | ||
``` | ||
## Additional Configuration | ||
### `CI_PROJECT_DIR` | ||
|
||
[Predefined GitLab CI variable](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) is used to determine | ||
the relative file paths in the report. Defaults to the current working directory. | ||
|
||
### `CODE_QUALITY_REPORT` | ||
Specifies a custom report file path. Defaults to `gl-codequality.json` in the jscpd output directory, which itself | ||
defaults to `report/`. | ||
|
||
### `CODE_QUALITY_APPEND` | ||
Merge the produced findings with an existing quality report if it already exists. Useful when utilising multiple tools | ||
in the same GitLab job. Defaults to `false`. | ||
|
||
--- | ||
[MIT](LICENSE) | Based on the [@jscpd/serif-reporter](https://github.com/kucherenko/jscpd/tree/master/packages/sarif-reporter) by Andrey Kucherenko |
Oops, something went wrong.