Skip to content

Commit

Permalink
Describe codemod IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Jul 22, 2024
1 parent de8253d commit 4d12fd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions codetf.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Note that like SARIF, this format is not intended to be a replacement for a diag

It may help to understand the major components of CodeTF from a high levels first before exploring or attemptin to implement the specification. The `results` and `changeset` fields can be seen as a series of patches against a project's directory. Each patch builds on any previous patches seen. Therefore, applying a patch from the middle of a `changeset` without the others may be invalid. Multiple locations can be changed in a single file within the scope of a single codemod and be represented by a single `changeset` array entry.

# Codemod IDs

Codemods are uniquely identified by an ID, which is represented in CodeTF as the `codemod` property of the `result` object.

IDs are descriptive and must conform to the following schema: `<origin>:<language>/<name>`

Each component of the ID has a particular meaning:

* `<origin>`: Origin describes the source of the analysis or transformation. For example, "find and fix" codemods provided by Pixee are labelled with the origin "pixee". Codemods that remediate issues found by a static analysis tool might be labelled with the origin corresponding to that tool name (e.g. "semgrep" or "codeql"). Implementers of custom codemods may use a unique identifier that is specific to their organization or tool.
* `<language>`: The language that is transformed by the codemod. This should be a short, unique identifier for the language. Valid languages include `java`, `python`, and `javascript`.
* `<name>`: The name of the codemod. This should be a short, unique identifier for the transformation that is performed. Individual words in the name should be separated by hyphens. For example: `remove-unused-imports`.

# Notes
Note that the `changeset` array can have multiple entries for the same given file.

Expand Down

0 comments on commit 4d12fd5

Please sign in to comment.