Skip to content

Commit 8896b76

Browse files
committed
fix: prettier formatting
1 parent 77716c6 commit 8896b76

File tree

7 files changed

+69
-54
lines changed

7 files changed

+69
-54
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ To release a major you need to add `BREAKING CHANGE: ` to the start of the body
4848

4949
Ensure that your code adheres to the included `.eslintrc` config by running `npm run test:checks`.
5050

51+
Check your code is formatted by running `prettier`m e.g. `npx prettier --check "the-search-path"`
52+
5153
## Sending pull requests
5254

5355
- add tests for newly added code (and try to mirror directory and file structure if possible) or fixes

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ This extension requires that Node.js and npm be installed on the build agent. Th
1919

2020
## Task Parameters
2121

22-
| Parameter | Description | Required | Default | Type |
23-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------- | --------------------------------------------------------------------------------- |
24-
| serviceConnectionEndpoint | The Azure DevOps service connection endpoint where your Snyk API token is defined. Define this within your Azure DevOps project settings / S | no | none | String / Azure Service Connection Endpoint of type SnykAuth / Snyk Authentication |
25-
| testType | Used by the task UI only | no | "application" | string: "app" or "container" |
26-
| dockerImageName | The name of the container image to test. | yes, if container image test | none | string |
27-
| dockerfilePath | The path to the Dockerfile corresponding to the `dockerImageName` | yes, if container image test | none | string |
28-
| targetFile | Applicable to application type tests ony. The path to the manifest file to be used by Snyk. Should only be provided if non-standard. | no | none | string |
29-
| severityThreshold | The severity-threshold to use when testing and reporting. By default, issues of all severity types will be found. | no | "low" | string: "low" or "medium" or "high" or "critical" |
30-
| failOnThreshold | The `severityThreshold` parameter is used to control the interaction with the Snyk CLI and reporting vulnerabilities. The `failOnThreshold` gives you additional control over build failure behaviour. For example, with `failOnIssues` set to `true` and `failOnThreshold` to `critical`, all issues would be reported on but _only_ critical issues would cause a build failure. See Usage Examples for more information | no | "low" | string: "low" or "medium" or "high" or "critical" |
31-
| monitorWhen | When to run `snyk monitor`. Valid options are `always` (default), `noIssuesFound`, and `never`. If set, this option overrides the value of `monitorOnBuild`. | no | "always" | boolean |
32-
| failOnIssues | This specifies if builds should be failed or continued based on issues found by Snyk. Combine with `failOnThreshold` to control which severity of issues causes the build to fail | yes | true | boolean |
33-
| projectName | A custom name for the Snyk project to be created on snyk.io | no | none | string |
34-
| organization | Name of the Snyk organisation name, under which this project should be tested and monitored | no | none | string |
35-
| testDirectory | Alternate working directory. For example, if you want to test a manifest file in a directory other than the root of your repo, you would put in relative path to that directory. | no | none | string |
36-
| ignoreUnknownCA | Use to ignore unknown or self-signed certificates. This might be useful in for self-hosted build agents with unusual network configurations or for Snyk on-prem installs configured with a self-signed certificate. | no | false | boolean |
37-
| additionalArguments | Additional Snyk CLI arguments to be passed in. Refer to the Snyk CLI help page for information on additional arguments. | no | none | string |
22+
| Parameter | Description | Required | Default | Type |
23+
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------- | --------------------------------------------------------------------------------- |
24+
| serviceConnectionEndpoint | The Azure DevOps service connection endpoint where your Snyk API token is defined. Define this within your Azure DevOps project settings / S | no | none | String / Azure Service Connection Endpoint of type SnykAuth / Snyk Authentication |
25+
| testType | Used by the task UI only | no | "application" | string: "app" or "container" |
26+
| dockerImageName | The name of the container image to test. | yes, if container image test | none | string |
27+
| dockerfilePath | The path to the Dockerfile corresponding to the `dockerImageName` | yes, if container image test | none | string |
28+
| targetFile | Applicable to application type tests ony. The path to the manifest file to be used by Snyk. Should only be provided if non-standard. | no | none | string |
29+
| severityThreshold | The severity-threshold to use when testing and reporting. By default, issues of all severity types will be found. | no | "low" | string: "low" or "medium" or "high" or "critical" |
30+
| failOnThreshold | The `severityThreshold` parameter is used to control the interaction with the Snyk CLI and reporting vulnerabilities. The `failOnThreshold` gives you additional control over build failure behaviour. For example, with `failOnIssues` set to `true` and `failOnThreshold` to `critical`, all issues would be reported on but _only_ critical issues would cause a build failure. See Usage Examples for more information | no | "low" | string: "low" or "medium" or "high" or "critical" |
31+
| monitorWhen | When to run `snyk monitor`. Valid options are `always` (default), `noIssuesFound`, and `never`. If set, this option overrides the value of `monitorOnBuild`. | no | "always" | boolean |
32+
| failOnIssues | This specifies if builds should be failed or continued based on issues found by Snyk. Combine with `failOnThreshold` to control which severity of issues causes the build to fail | yes | true | boolean |
33+
| projectName | A custom name for the Snyk project to be created on snyk.io | no | none | string |
34+
| organization | Name of the Snyk organisation name, under which this project should be tested and monitored | no | none | string |
35+
| testDirectory | Alternate working directory. For example, if you want to test a manifest file in a directory other than the root of your repo, you would put in relative path to that directory. | no | none | string |
36+
| ignoreUnknownCA | Use to ignore unknown or self-signed certificates. This might be useful in for self-hosted build agents with unusual network configurations or for Snyk on-prem installs configured with a self-signed certificate. | no | false | boolean |
37+
| additionalArguments | Additional Snyk CLI arguments to be passed in. Refer to the Snyk CLI help page for information on additional arguments. | no | none | string |
3838

3939
## Usage Examples
4040

@@ -67,14 +67,14 @@ Here's a full example:
6767
monitorWhen: 'always'
6868
```
6969

70-
An example that specifies a value for `severityThreshold` as medium and configures `failOnThreshold` to critical. This configuration would _only fail_ the build when critical issues are found, but all issues detected at medium, high and critical would be reported back to your snyk project for analysis
70+
An example that specifies a value for `severityThreshold` as medium and configures `failOnThreshold` to critical. This configuration would _only fail_ the build when critical issues are found, but all issues detected at medium, high and critical would be reported back to your snyk project for analysis
7171

7272
```
7373
- task: SnykSecurityScan@1
7474
inputs:
7575
serviceConnectionEndpoint: 'mySnykToken'
7676
testType: 'app'
77-
severityThreshold: 'medium'
77+
severityThreshold: 'medium'
7878
failOnIssues: true
7979
failOnThreshold: 'critical'
8080
monitorWhen: 'always'

snykTask/src/__tests__/task-lib.test.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
formatDate,
1515
attachReport,
1616
removeRegexFromFile,
17-
doVulnerabilitiesExistForFailureThreshold
17+
doVulnerabilitiesExistForFailureThreshold,
1818
} from '../task-lib';
1919
import { TaskArgs } from '../task-args';
2020

@@ -46,17 +46,22 @@ test('getOptionsToExecuteSnyk builds IExecOptions like we need it', () => {
4646
expect(options.ignoreReturnCode).toBe(true);
4747
});
4848

49-
50-
test('finds vulnerabilities greater than medium threshold', async () => {
49+
test('finds vulnerabilities greater than medium threshold', async () => {
5150
const fixturePath = 'snykTask/test/fixtures/high-vulnerabilities.json';
52-
const itemsFound = await doVulnerabilitiesExistForFailureThreshold(fixturePath, "medium");
51+
const itemsFound = await doVulnerabilitiesExistForFailureThreshold(
52+
fixturePath,
53+
'medium',
54+
);
5355

5456
expect(itemsFound).toBe(true);
5557
});
5658

57-
test('ignores vulnerabilities lower than high threshold', async () => {
59+
test('ignores vulnerabilities lower than high threshold', async () => {
5860
const fixturePath = 'snykTask/test/fixtures/low-vulnerabilities.json';
59-
const itemsFound = await doVulnerabilitiesExistForFailureThreshold(fixturePath, "high");
61+
const itemsFound = await doVulnerabilitiesExistForFailureThreshold(
62+
fixturePath,
63+
'high',
64+
);
6065

6166
expect(itemsFound).toBe(false);
6267
});

snykTask/src/__tests__/test-task-args.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,23 @@ describe('TaskArgs.validate', () => {
129129
});
130130

131131
it('throws error if invalid severity threshold', () => {
132-
expect(
133-
() => {
134-
args.severityThreshold = 'hey';
135-
args.validate();
136-
}
137-
).toThrow(
138-
new Error('If set, severityThreshold must be \'critical\' or \'high\' or \'medium\' or \'low\' (case insensitive). If not set, the default is \'low\'.')
132+
expect(() => {
133+
args.severityThreshold = 'hey';
134+
args.validate();
135+
}).toThrow(
136+
new Error(
137+
"If set, severityThreshold must be 'critical' or 'high' or 'medium' or 'low' (case insensitive). If not set, the default is 'low'.",
138+
),
139139
);
140-
});
140+
});
141141

142-
it.each(validSeverityThresholds)('passes validation for ${level}', (level) => {
143-
args.severityThreshold = level;
144-
args.validate();
145-
});
142+
it.each(validSeverityThresholds)(
143+
'passes validation for ${level}',
144+
(level) => {
145+
args.severityThreshold = level;
146+
args.validate();
147+
},
148+
);
146149
});
147150

148151
const SNYK_TEST_SUCCESS_TRUE = true;

0 commit comments

Comments
 (0)