extendr / rextendr

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

Integration with `{lintr}` #169

Closed Ilia-Kosenkov closed 1 year ago

Ilia-Kosenkov commented 2 years ago

{lintr} is a package that highlights issues in the codebase. It can be used as a standalone tool or as a part of an editor/IDE (such as vscode). I propose to research {lintr} application to {rextendr} to improve the quality of code.

eitsupi commented 1 year ago

(This is probably not an appropriate issue but related to lintr)

The fourth line of the following R file generated by extendr is checked by the commented code linter of lintr, so it is recommended to change it.

# Generated by extendr: Do not edit by hand
#
# This file was created with the following call:
#   .Call("wrap__make_helloextendr_wrappers", use_symbols = TRUE, package_name = "helloextendr")
Ilia-Kosenkov commented 1 year ago

@eitsupi , I see, but we would like to keep this information in the wrapper (as it is emitted by extendr itself). Is there a way we can mark it so lintr does not check it?

eitsupi commented 1 year ago

It is described here. https://lintr.r-lib.org/articles/lintr.html?q=nolint#excluding-lines-of-code

The easiest way is to add # nolint at the end on the line.

# Generated by extendr: Do not edit by hand
#
# This file was created with the following call:
#   .Call("wrap__make_helloextendr_wrappers", use_symbols = TRUE, package_name = "helloextendr") # nolint
Ilia-Kosenkov commented 1 year ago

I guess it's better to exclude the whole file, since it is generated by extendr. I'll take a look a this soon.

Ilia-Kosenkov commented 1 year ago

Hey @eitsupi , can you try out {rextendr} from this branch https://github.com/Ilia-Kosenkov/rextendr/tree/exclude-wrappers-from-linting? You can do this like so: remotes::install_github("Ilia-Kosenkov/rextendr", ref = "exclude-wrappers-from-linting") Just install it, and run in your project rextendr::clean() ; rextendr::document() to force re-compilation and wrapper generation. Let me know if it solves the linting issue.

eitsupi commented 1 year ago

@Ilia-Kosenkov I have installed with remotes::install_github("extendr/rextendr#214") and tried on https://github.com/eitsupi/prqlr and this seems to work well, thanks!

Ilia-Kosenkov commented 1 year ago

Great, but it will take some time before I merge it since I need to update some tests now.

yutannihilation commented 1 year ago

I think this is already done by https://github.com/extendr/rextendr/pull/229. Are there anything else to do before closing this issue?

CGMossa commented 1 year ago

You're right. Let me just close this issue as I agree.