Skip to content

Commit

Permalink
adding fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-c committed Aug 16, 2024
1 parent 37df917 commit 864e6e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parse, GrammarItem } from '@aivenio/tsc-output-parser';
import { Issue } from 'codeclimate-types';
import { createHash } from "node:crypto";

export default function format (input: string): Issue[] {
const foo: GrammarItem[] = parse(input);
Expand All @@ -11,6 +12,7 @@ export default function format (input: string): Issue[] {
check_name: inputItem.value.tsError.value.errorString,
description: inputItem.value.message.value,
severity: 'major',
fingerprint: createHash("sha256").update(inputItem.value.path.value + ":" +inputItem.value.tsError.value.errorString).digest("hex"),
location: {
path: inputItem.value.path.value,
positions: {
Expand Down
2 changes: 2 additions & 0 deletions test/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe("format", () => {
],
"check_name": "TS7006",
"description": " Parameter 'node' implicitly has an 'any' type.\n",
"fingerprint": "20066f3363e75e58f37a5d94dc4b2e833e31166d7be38fa3e3e13788ff644747",
"location": {
"path": "node_modules/example/example.d.ts",
"positions": {
Expand All @@ -32,6 +33,7 @@ describe("format", () => {
],
"check_name": "TS7006",
"description": " Parameter 'node' implicitly has an 'any' type.\n",
"fingerprint": "e76aa9fe395c5050ed3cc53bb4ee5d12c3d15afadb361a436a8db8bd1f42670e",
"location": {
"path": "example/example.d.ts",
"positions": {
Expand Down

0 comments on commit 864e6e3

Please sign in to comment.