dokato / todor

TODOr - RStudio add-in for finding TODO, FIXME, CHANGED etc. comments in your code.
Other
246 stars 12 forks source link
addins markers r rstudio

TODOr

CRAN status cranlogs total R-CMD-check

This is RStudio addin that finds all TODO, FIXME, CHANGED etc. comments in your project or package and shows them as a markers list.

Installation

Stable release from CRAN:

install.packages("todor")

The latest version:

devtools::install_github("dokato/todor")
# or
remotes::install_github("dokato/todor")

How to use it?

When you write an R package, sometimes it's useful to make a note in comments about a place for improvement.

simple_function <- function(a, b) {
  # TODO in the future check the type of input here
  a + b
}

With TODOr, detecting such places in the forest of code lines is simple. There are several options to do so. You can click at "Addins" button in the top panel and select one of the options:

Addins panel

It is also possible to call todor directly from RStudio console:

> todor::todor()

or you can call:

> todor::todor(c("TODO"))

to limit todor detection only to "TODO" tags.

HINT: By default todor works on projects, but you can call todor_package to search an entire package.

Regardless of the option that you have chosen, as a result you should see the Markers tab next to your console window in RStudio.

TODO Markers

To perform the search on a single file just call:

> todor::todor_file("path_to_file.R")

For more thorough walkthrough check this video-tutorial: https://youtu.be/f4mTYyD2C-8

What can it detect?

By default TODOr looks for the following notes: FIXME, TODO, CHANGED, IDEA, HACK, NOTE, REVIEW, BUG, QUESTION, COMBAK, TEMP.

But you may change it by setting todor_patterns option, for example:

options(todor_patterns = c("FIXME", "TODO", "CUSTOM"))

Markdown

In markdown you probably don't want to use # comments. But that's okay, as TODOr supports HTML-like comments too.

# Section

<!-- TODO Change this section. -->

* Very important element.

You can switch off the markdown search:

options(todor_rmd = FALSE)

Other options

Searching through Rnw files (a default option is set below).

options(todor_rnw = TRUE)

Searching through Rhtml files.

options(todor_rhtml = FALSE)

Searching through R, r files.

options(todor_exclude_r = FALSE)

Excluding packrat directory.

options(todor_exclude_packrat = TRUE)

Including extra file formats.

options(todor_extra = c("txt", "dat"))
options(todor_extra = NULL)