Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 2.99 KB

contributing.md

File metadata and controls

57 lines (36 loc) · 2.99 KB

Contributing

If you are visiting this page, thank you for even just contemplating a contribution. It is much appreciated!

Pretty much anyone is of course welcome to contribute to the initiative, we have an out-of-the-box code of conduct from Contributor Covenant. Please report any bug you encounter or suggest any feature by opening Github issues. Also feel free to contribute on any Github software by creating pull requests.

You are more than welcome to submit a piece of software, there is no review process currently in place: please use the contact form.

Documentation

There is a working newsrdown package that features functions to easily develop news-r styled pkgdown websites.

Coding Standards

If you intend to contribute to anything code-related please try to abide by the style guide as much as you can.

First keep the package name all lowercase.

Use the package assertthat for assertions (namely of inputs) over the base R if and stop combination. If you are integrating an API with R use a setup function called packageName_key which sets the key as an environment variable named PACKAGENAME_API_KEY (with Sys.setenv()). Below is how it is implemented in the newsapi package.

ft_key <- function(key){
  assert_that(!missing(key), msg = "Missing key")
  Sys.setenv(NEWSAPI_API_KEY = key)
}

This allows users to setup their key in their .Renviron file, which is easily done with usethis::edit_r_environ(). This is why such packages also print messages when attaching the package to let the user know whether the key was found and loaded.

.onAttach <- function(...) {
  key <- Sys.getenv("NEWSAPI_API_KEY")

  msg <- "No API key found, see `newsapi_key`"
  if(nchar(key) > 1) msg <- "API key loaded!"

  packageStartupMessage(msg)
}

Then generally this key is accessed with Sys.getenv() internally.

To make various API calls use either httr or, if the API allows large number of calls, async, currently only the package guardian makes use of the latter.

Try, where possible to return a tibble instead of a list.

Style

Below is the main color palette used.

#247BA0 #70C1B3 #B2DBBF #F3FFBD #FF1654

The background color of this page is #f9f7f1 while the font is #2f2f2f in Playfair Display.