extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
181 stars 27 forks source link

Set lintr for linting R codes #229

Closed eitsupi closed 1 year ago

eitsupi commented 1 year ago

Addresses #169.

A series of fixes resolved all but one error.

> lintr::lint_package()
.......................................
R/sanitize_code.R:25:1: style: [cyclocomp_linter] Functions should have cyclomatic complexity of less than 15, this has 16.
fill_block_comments <- function(lns, fill_with = " ") {
^

All errors can be corrected by refactoring the fill_block_comments function or allowing this in the rules.

@Ilia-Kosenkov Sorry to I do this even though you are the assignee of #169. Feel free to edit this PR.

eitsupi commented 1 year ago

All errors can be corrected by refactoring the fill_block_comments function or allowing this in the rules.

Curiously, the last commit did not raise this error. The lint workflow is now green.

Ilia-Kosenkov commented 1 year ago

By all means, feel free to take a shot at any issue, or create your own issues for discussion. No hard feelings here. fill_block_comment() is indeed quite large, but it is the cost of not using any third-party parsers for rust code (and thus keeping the package purely R). It can be reworked for sure (and there are lots of typos in the comments that can be fixed). Let's open an issue for this and fix it separately.

Otherwise, great job! If you are ready, mark this PR as ready for review & I'll merge it

eitsupi commented 1 year ago

Thanks. I think you can merge this as the work I can do seems to be complete.