Open IndrajeetPatil opened 5 months ago
We could do that. If so, we'd need to put the change here: https://github.com/nealrichardson/httptest2/blob/main/R/capture-requests.R#L177 I would guess that would involve using deparse()
instead of dput()
to keep the result in a character vector, add the linter/styler comments to that, and then cat()
to the file.
Alternatively, we could do something like this after L177:
if (requireNamespace("styler", quietly = TRUE)) {
styler::style_file(f)
}
@IndrajeetPatil would you be interested in submitting a PR?
@nealrichardson Sure, I can take a stab at this next week :)
Preamble
Is it possible to add directives to turn off formatter and linter for auto-generated
.R
files byhttptest2::with_mock_dir()
?I work with CI systems that mark builds as failed if any lints or formatting issues are found. This is indeed going to be the case for these auto-generated files. But the code in these files need not follow a style guide or linter recommendations. Additionally, it's not even in the control of the user how this output is generated. Therefore, it would be nice if
{httptest2}
itself generated these files with ignore directives.Solution
Tidyverse style guide formatter and linter can be turned off like so: