Explanation: Rhino style guide
Source:vignettes/explanation/rhino-style-guide.Rmd
rhino-style-guide.Rmd
Rhino follows the tidyverse
style guide, with specific additional rules for box::use
statements to enhance readability and maintainability of code. These rules are designed to work alongside tidyverse
conventions, providing clarity and consistency when using box
modules.
For more details on how to use box::use
statements, see Explanation: Box modules.
For more details on how to configure linter rules in the .lintr
file, see Configuring linters.
Explicit Import
For clarity and ease of tracking function origins, avoid using [...]
for imports. Explicitly declare all packages, modules and functions.
Trailing Commas
Trailing commas in box::use
statements are encouraged. They simplify line additions and reordering.
Separated Statements for Packages and Modules
Use separate box::use
statements for importing packages and modules (R scripts) for better structure and readability.
Order of Imports
Order imports alphabetically to ease locating a specific import. This applies to both packages/modules and functions within them.
Number of Imports
Limit the number of functions imported from a module or package to 8. If more than 8 functions are needed, import the entire package and reference functions using package$function
. Aliases can be used for convenience. Check box::use
documentation for more details.