Guides
Risks & one-click fixes
For any finding that is located in code, Riscly can generate a fix, explain why it works, and commit it directly to your repository — no manual PR juggling.
The fix flow
- Preview. Generate the fix and an explanation without changing anything (
code/fix). - Review. Read the explanation, the corrected code, tips and references.
- Apply. Commit the fix directly to the default branch (
code/fix/commit). You get a link to the commit.
Always review before applying
Automated fixes are suggestions. Riscly cannot guarantee it catches or correctly fixes every issue — review and test each change before relying on it. Responsibility for your systems stays with you (see the Terms).1. Preview a fix
Pass the located finding (file, rule, title). The response contains the original snippet, the proposed fixed code and a human-readable explanation.
const preview = await riscly(`/projects/${projectId}/code/fix`, {
method: "POST",
body: JSON.stringify({
file: "src/server/auth.ts",
line: 42,
rule: "no-hardcoded-secret",
title: "Hardcoded credential",
description: "A secret is committed in source.",
}),
}).then((r) => r.json());
console.log(preview.explanation);
console.log(preview.fixed); // null if no automated fix was possible2. Apply the fix (direct commit)
Applying commits the corrected file straight to the repository's default branch and returns the commit URL. No pull request window, no branch switching.
const result = await riscly(`/projects/${projectId}/code/fix/commit`, {
method: "POST",
body: JSON.stringify({
file: "src/server/auth.ts",
line: 42,
rule: "no-hardcoded-secret",
title: "Hardcoded credential",
}),
}).then((r) => r.json());
console.log("Pushed:", result.url); // commit html_urlPrefer a pull request?
A PR-based variant (code/fix/pr) opens a branch and pull request instead of committing directly. See the Code & fixes reference.