Diffs
Pipe in a diff to judge only what changed:
git diff main | decide run code-risk --each functiondecide reads a diff from git diff, git show, git format-patch, or
gh pr diff, and any .diff or .patch file.
Choose the unit
Section titled “Choose the unit”--each |
One item is | Named like |
|---|---|---|
hunk |
each block of changed lines | server.go:42 |
function |
each function a change touches, whole | server.go#L40 Handler.Delete |
file |
every change to one file | server.go |
line |
each added line | server.go:43 |
The default is hunk, unless the template sets a unit of its own.
code-risk judges each changed file:
gh pr diff 42 | decide run code-riskgh pr diff 42 | decide run code-risk --each hunkChanged functions
Section titled “Changed functions”--each function judges the whole of each function a diff touches, so the
model sees the code around the change. It works on Go, Python, JavaScript,
TypeScript, and Java.
Run it in the repository the diff came from. decide reads each function from the file on disk.
What decide skips
Section titled “What decide skips”decide skips deleted files, binary files, lockfiles, and generated files, and says which. When a diff has nothing left to judge, decide exits 0.
decide is Apache 2.0. Made by Deep Noodle, after some very hard thinking.