Generic function for automatic code fixes with Git platform integration.
Runs sonar_fix() to correct code issues, then commits changes and
creates a Merge Request (GitLab) or Pull Request (GitHub).
Usage
sonar_autofix(
provider = c("auto", "gitlab", "github"),
path = ".",
fixes = "all",
formatter = c("styler", "air"),
branch = "auto/rsonar-fix",
target_branch = NULL,
commit_message = "style: automatic fixes by rsonar",
mr_title = "Automatic fixes generated by rsonar",
mr_description = NULL,
dry_run = FALSE,
token = "",
verbose = interactive()
)Arguments
- provider
Character. Git platform to use.
- path
Path to the R project directory. Default
".".- fixes
Fix categories to apply. Default
"all".- formatter
Formatter to use. Default
c("styler", "air").- branch
Name of the branch to create for fixes. Default
"auto/rsonar-fix".- target_branch
Target branch for the MR/PR. Auto-detected from CI.
- commit_message
Git commit message.
- mr_title
Title of the MR/PR.
- mr_description
Description of the MR/PR. If
NULL, a default description is generated including the pipeline ID. Use this to include quality metrics (coverage, goodpractice issues, etc.) in the merge request body.- dry_run
Logical. If
TRUE, only simulate without modifying.- token
Authentication token. Auto-detected if empty.
- verbose
Logical. Show progress messages.