bioc_style: Tidyverse style made Bioconductor-friendly

Description Usage Arguments Details Value Examples

View source: R/bioc_style.R

Description

This function uses styler::tidyverse_style() and modifies it to make it Bioconductor friendly. The full Bioconductor coding style is described at https://bioconductor.org/developers/how-to/coding-style/ and it shares many properties with the Tidyverse coding style guide https://style.tidyverse.org/. This function defines the transformers code that you can then use with other styler functions such as styler::style_pkg().

Usage

1
bioc_style(indent_by = 4, ...)

Arguments

indent_by

How many spaces of indention should be inserted after operators such as '('. Unlike styler::tidyverse_style(), the default is 4 to conform with the Bioconductor coding style.

...

Other arguments passed to styler::tidyverse_style().

Details

The styler package seems to be more actively maintained and better performance than formatR, though that package can also be useful. This function does not produce an exact Bioconductor coding style, but it gets you close enough! =)

For more details on how this function came to be, check https://github.com/r-lib/styler/issues/636 https://github.com/Bioconductor/BiocCheck/issues/57 https://github.com/Bioconductor/bioconductor.org/issues/54

Value

A list() object with the information required by functions in the transformers argument in the styler package functions such as styler::style_pkg().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
## Run these functions in your package
styler::style_pkg(transformers = biocthis::bioc_style())
styler::style_dir(usethis::proj_path("dev"), transformers = biocthis::bioc_style())

## End(Not run)

## Create an example package for illustrative purposes.
## Note: you do not need to run this for your own package!
pkgdir <- biocthis_example_pkg()

## Automatically style the example package
styler::style_pkg(pkgdir, transformers = biocthis::bioc_style())

biocthis documentation built on Feb. 28, 2021, 2:02 a.m.