Skip to content

Commit c3ce543

Browse files
authored
CM-48119 - Add detection sorting by line number in addition to severity (#128)
1 parent 11acd50 commit c3ce543

16 files changed

Lines changed: 43 additions & 34 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
## [v1.16.0]
6+
7+
- Add detection sorting by line number in addition to severity
8+
59
## [v1.15.0]
610

711
- Add proper support for disabled modules
@@ -141,6 +145,8 @@
141145

142146
The first stable release with the support of Secrets, SCA, TreeView, Violation Card, and more.
143147

148+
[v1.16.0]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.16.0
149+
144150
[v1.15.0]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.15.0
145151

146152
[v1.14.0]: https://github.com/cycodehq/vscode-extension/releases/tag/v1.14.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cycode",
33
"displayName": "Cycode",
4-
"version": "1.15.0",
4+
"version": "1.16.0",
55
"publisher": "cycode",
66
"description": "Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.",
77
"repository": {

src/cli/models/scan-result/iac/iac-detection-details.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ export class IacDetectionDetails extends ScanDetectionDetailsBase {
1717
getFilepath(): string {
1818
return this.fileName;
1919
}
20+
21+
getLineInFile(): number {
22+
return this.lineInFile;
23+
}
2024
}

src/cli/models/scan-result/iac/iac-detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export class IacDetection extends DetectionBase {
2222
}
2323

2424
getFormattedNodeTitle(): string {
25-
return `line ${this.detectionDetails.lineInFile + 1}: ${this.getFormattedMessage()}`;
25+
return `line ${this.detectionDetails.getLineInFile()}: ${this.getFormattedMessage()}`;
2626
}
2727
}

src/cli/models/scan-result/sast/sast-detection-details.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ export class SastDetectionDetails extends ScanDetectionDetailsBase {
1919
getFilepath(): string {
2020
return this.filePath.startsWith('/') ? this.filePath : `/${this.filePath}`;
2121
}
22+
23+
getLineInFile(): number {
24+
return this.lineInFile;
25+
}
2226
}

src/cli/models/scan-result/sast/sast-detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export class SastDetection extends DetectionBase {
2222
}
2323

2424
getFormattedNodeTitle(): string {
25-
return `line ${this.detectionDetails.lineInFile}: ${this.getFormattedMessage()}`;
25+
return `line ${this.detectionDetails.getLineInFile()}: ${this.getFormattedMessage()}`;
2626
}
2727
}

src/cli/models/scan-result/sca/sca-detection-details.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ export class ScaDetectionDetails extends ScanDetectionDetailsBase {
2525
getFilepath(): string {
2626
return this.fileName;
2727
}
28+
29+
getLineInFile(): number {
30+
return this.lineInFile;
31+
}
2832
}

src/cli/models/scan-result/sca/sca-detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ export class ScaDetection extends DetectionBase {
2323
}
2424

2525
getFormattedNodeTitle(): string {
26-
return `line ${this.detectionDetails.lineInFile}: ${this.getFormattedTitle()}`;
26+
return `line ${this.detectionDetails.getLineInFile()}: ${this.getFormattedTitle()}`;
2727
}
2828
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export abstract class ScanDetectionDetailsBase {
22
public abstract getFilepath(): string;
3+
public abstract getLineInFile(): number;
34
}

src/cli/models/scan-result/secret/secret-detection-details.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Exclude } from 'class-transformer';
22
import { ScanDetectionDetailsBase } from '../scan-detection-details-base';
33

4+
const IDE_ENTRY_LINE_NUMBER = 1;
5+
46
export class SecretDetectionDetails extends ScanDetectionDetailsBase {
57
sha512: string;
68
provider: string;
@@ -22,4 +24,8 @@ export class SecretDetectionDetails extends ScanDetectionDetailsBase {
2224
public getFilepath(): string {
2325
return `${this.filePath}${this.fileName}`;
2426
}
27+
28+
public getLineInFile(): number {
29+
return this.line + IDE_ENTRY_LINE_NUMBER;
30+
}
2531
}

0 commit comments

Comments
 (0)