Skip to content

Commit

Permalink
Associate findings with changes + unfixed
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Apr 5, 2024
1 parent d483eba commit 54d9938
Showing 1 changed file with 60 additions and 47 deletions.
107 changes: 60 additions & 47 deletions codetf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
"description": "The changes for a given codemod",
"items": { "$ref": "#/definitions/changeset" },
"minItems": 0
},
"unfixed": {
"type": "array",
"description": "A set of file paths for files that the tool failed to fix",
"items": { "$ref": "#/definitions/unfixedFinding" }
}
},
"required": ["codemod", "summary", "description", "changeset"]
Expand Down Expand Up @@ -152,6 +157,29 @@
"required": ["path", "diff", "changes"]
},

"unfixed": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The path of the file (relative to the directory) that was not fixed"
},
"lineNumber": {
"type": "integer",
"description": "The line number that was not fixed"
},
"reason": {
"type": "string",
"description": "A human-readable description of the reason the file was not fixed"
},
"finding": {
"$ref": "#/definitions/detector/finding",
"description": "The finding that was not fixed at this location"
}
},
"required": ["path", "reason", "finding"]
},

"change": {
"type": "object",
"properties": {
Expand All @@ -177,6 +205,10 @@
"type": "array",
"description": "The package actions that were needed to support changes to the file",
"items": { "$ref": "#/definitions/packageAction" }
},
"finding": {
"$ref": "#/definitions/detector/fixedFinding",
"description": "The finding that was fixed at this location"
}
},
"required": ["lineNumber", "diffSide"]
Expand Down Expand Up @@ -209,19 +241,10 @@
"name": {
"type": "string",
"description": "Name of the tool that detected the issue"
},
"rule": {
"$ref": "#/definitions/detector/rule",
"description": "The rule that detected the issue"
},
"findings": {
"type": "array",
"items": { "$ref": "#/definitions/detector/finding" },
"maxItems": 20
}
},
"additionalProperties": true,
"required": ["name", "rule", "findings"]
"required": ["name"]
},

"detector": {
Expand All @@ -232,48 +255,38 @@
"type": "string",
"description": "A unique identifier for the finding (e.g. 'guid' from SARIF)"
},
"fixed": {
"type": "boolean",
"description": "Whether the finding was fixed by the codemod"
"rule": {
"$ref": "#/definitions/detector/rule",
"description": "The rule that detected the issue"
}
},
"additionalProperties": true,
"required": ["id", "rule", "path"]
},
"fixedFinding": {
"$ref": "#/definitions/detector/finding",
"additionalProperties": true,
// TODO: can we do it this way??
"required": ["id", "rule"]
},
"unfixedFinding": {
"$ref": "#/definitions/detector/finding",
"properties": {
"path": {
"type": "string",
"description": "The path of the file (relative to the directory) that was not fixed"
},
"lineNumber": {
"type": "integer",
"description": "The line number that was not fixed"
},
"reason": {
"type": "array",
"items": {
"failure": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "A human-readable description of the reason the fix failed at this location"
},
"path": {
"type": "string",
"description": "Path of the file where the fix failed to apply"
},
"line": {
"type": "integer",
"description": "(Optional) line number where the fix failed to apply"
},
"snippet": {
"type": "string",
"description": "(Optional) snippet of code that we failed to fix"
}
},
"required": ["description", "path"],
"additionalProperties": true
}
},
"minItems": 1
"type": "string",
"description": "A human-readable description of the reason the file was not fixed"
}
},
"additionalProperties": true,
"required": ["id", "fixed"],
"if": {
"properties": {
"fixed": { "boolean": false }
},
"required": ["reason"]
}
"required": ["id", "rule", "path", "reason"]
},
"rule": {
"type": "object",
Expand Down

0 comments on commit 54d9938

Please sign in to comment.