Skip to content

Commit

Permalink
👻 make code snippets optional in an incident (#112)
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad authored Jun 14, 2024
1 parent 92aea03 commit 257b606
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 219 deletions.
187 changes: 0 additions & 187 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/api/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface IncidentDto {
uri?: string;
file?: string;
message: string;
codeSnip: string;
codeSnip?: string;
lineNumber?: number;
line?: number;
variables: {
Expand Down
2 changes: 1 addition & 1 deletion src/models/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const addIncidentToDispersedFile = (df: DispersedFile, incident: Incident
const left = df.ranges.slice(0, start)
const right = df.ranges.slice(end, df.ranges.length)
df.ranges = left.concat(toPush).concat(right)
df.codeSnips.push(incident.codeSnip)
df.codeSnips.push(incident.codeSnip ? incident.codeSnip : "")
const lineNumber: number = incident.lineNumber || incident.line || 0
df.incidentsUnorganized.push({lineNumber, message: incident.message})
}
Expand Down
6 changes: 6 additions & 0 deletions src/queries/mocks/report.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ if (
codeSnip: "1 First Line\n2 Second Line\n",
variables: {},
},
{
uri: "file://test-files/file3.java",
message: "Test message",
lineNumber: 1,
variables: {},
},
],
},
"rule-002": {
Expand Down
Loading

0 comments on commit 257b606

Please sign in to comment.