Giter VIP home page Giter VIP logo

todor's Introduction

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:

  • "Find active file TODOs" (for the active file in RStudio editor)
  • "Find package TODOs" (if you are creating package)
  • "Find project TODOs" (if you are inside the RStudio project)

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)

todor's People

Contributors

algogym avatar dokato avatar henninglorenzen-ext-bayer avatar luciorq avatar mcguinlu avatar rkb965 avatar strengejacke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todor's Issues

"sourcemarkers ... Rstudio" error when running in in VSCode

Hi

Does Todor only work in RStudio (RStudio add-in aside, of course)? I only need the Todor function but if I run the following:-

x <- todor(search_path = this.dir())

I get this error:-

Error: Function sourceMarkers not found in RStudio

If Todor is only for Rstudio then that's fine, but if not then I guess this is a problem.

Thanks for writing a great package.

Cheers, Rich

Feature request: add 'exclude renv'

Hi,

Very useful package, thank you. Just wondering if you could add an 'exclude_renv' similar to the code you have for excluding packrat etc.
The use case is that I have a local project-specific renv setup with its own cache of libraries, many of which have '#TODO' in their internal code.

If you're busy, I could potentially submit a PR, I might not be able to get around to it for a week or two though (if you agree with the idea, of course!).

Thanks!

TODOr with Rmd files

Hi dokato - I saw reference to this package as an addin in Rstudio and think this is a great idea!

It appears this currently does not support R markdown files inside of a project. I can use it successfully with *.R files in my project but not *.Rmd (I haven't tested with other text-based files).

Is this functionality you intend to add in the future? I am using Rmd for writing my thesis and foresee many opportunities for likely leaving myself "todo" notes throughout the writing process and so think your tool would make a valuable addition to such a workflow.

Feature request: Add NEWS file

I recently saw that there is an update available for this package. However, it is not obvious what changed since the previous release because this package lacks a NEWS file.
RStudio's package updater let's users view the changelogs of packages by clicking on the NEWS icon. The changelog is also available via the utils::news() function. This is far more convenient than sifting through commit messages.
Please provide a NEWS or NEWS.md file as described in the following sources:

Example: https://github.com/r-lib/devtools/blob/master/NEWS.md

edit: I drafted a pull request related to this.

Search in additional file types

Hi! I really like this package, very useful!

In some projects (e.g., creating a hugo academic website in RStudio with blogdown), I wished todor would also search some additional files types, such as .md, .toml. Would it be possible to extend the types of files todor searches by default? Or add a "generic" way to extend the search scope, defined in terms of file endings? Thanks!

More permissive TODO catching

It seems like you could catch more markers by just expecting the TODO to have a certain structure:

  1. The catchword occurs within 6 characters of the start of the line (not counting whitespace), which would catch # TODO, <!-- TODO and other schemes.
  2. The catchword should be all-caps and the search should be case-sensitive.
  3. The TODO stretches to the end of the line.
  4. The TODO might have a comment wrapper at the end that needs to be removed.
    # TODO Test this thing.
    # TODO: Test this thing.
    # TODO - Test this thing.
    <!-- TODO Test this thing. -->
    <!-- TODO: Test this thing. -->
    <!-- TODO - Test this thing. -->
# TODO Test this thing.
# TODO: Test this thing.
# TODO - Test this thing.
<!-- TODO Test this thing. -->
<!-- TODO: Test this thing. -->
<!-- TODO - Test this thing. -->
    TODO Test this thing.
    TODO: Test this thing.
    TODO - Test this thing.
TODO Test this thing.
TODO: Test this thing.
TODO - Test this thing.

# Fix for R e.g.double-escaping.
Search with:    ^\s{0,}.{0,6}(TODO|DONE|FIXME).+?(\w.*?)\s?(-->)?$
Replace with:   $1\t$2

TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.
TODO	Test this thing.

Issue: "Inline" ToDos not captured

Hi @dokato,

Very last thing (promise!) - when checking out the results of the new functionality in #46, I noticed that "inline" comments are not captured by todor, e.g. if I have the following text in an Rmarkdown doc on line 147:

Participants were followed up, and were censored at the earliest of date of diagnosis, death, date of transfer out of the study cohort or end of follow-up ( <!-- TODO Get date here --> )

This does not appear as a marker when running todor() (no "Line 147"):

Screenshot 2021-05-13 121403

Is this known behaviour?

Find markers in end of line comments

Thank you for this really helpful addin. Would it be possible to let if find TODO, FIXME etc. in comments at the end of a line of code? For example here:
foo <- broken_function() # FIXME: Fix this later.
Currently this does not work for me.

Multi-line comments support

Hey @dokato , is it possible to support multi-line comments?

Currently, todor only displays one line, however many TODO comments are to big to fit in one line, so the second line onwards are omitted.

Having a display mode option to choose between single line and multi-line would be great, what do you think about that?

Thank you

Todos in vignettes not found

The todor::todor_package function only goes through the in inst, R and tests directory. I have some todo's in my vignettes directory, it would be great to also add those to the search path

Find TODO items in Markdown documents by default?

Quite a useful package, thanks! Could you make searching for TODO items the default rather than needing to add it as an option? I don't quite understand the rationale for having it not be the default.

todor reopens another report with same note

Great package. One strange behavior I encountered: I had two similar .RMD reports with the same NOTE in each (in the same project).

Whenever I knitted one, the other would reopen. I finally figured that it was because of the note -- the behavior stopped once I remove the note in the second report.

doesn't work for me

Hi,
I love the idea, but it doesn't work for me, I can't see my comments in the markers
image

Enhancement request: Remove comment syntax from TODO text

Hi @dokato

One last thing - sorry for pinging you so much today!

In addition to #44, the one other thing I would love to see in todor is for comment syntax to be removed from the TODO text. My main use of the package is to write my thesis, and so most of my TODOs are wrapped in markdown comments (<!--- --->), which causes the Marker pane to look very "busy", e.g.:

Screenshot 2021-05-12 152812

It would be really amazing if todor could filter the comment syntax out when presenting the TODOs in the Markers pane, so as to make the TODOs easier to read (i.e. <!--- TODO This is an example ---> would present as [ TODO ] This is an example, rather than [ TODO ] <!--- This is an example --->)

Is this something you would consider? Apologies if you have looked at this before and decided against it!

add keyboard shortcuts

or... as it's difficult to register them automatically, just add to md instruction o how to set them

Stability for long-term use

Hey guys, TODOr is just a fantastic package! Incredibly useful for organization and productivity.

Do you plan to keep it stable and updated? I would like to start to use it in my long-term projects. Thank you

Extend to Rnw/LaTeX comments

todor doesn't search .Rnw files by default when using todor::todor_project_addin(). It also doesn't recognize LaTeX comments (e.g. comments prefixed by % instead of #). Right now, I'm using

%# TODO: thing

and calling todor::todor_file("file.Rnw") to get a list of todos, but it would be nice if it would search all literate documents (Rnw, Rmd, Rhtml) for comments and would also detect comments natively, without the extra # character.

New install Does not work....not sure what is causing issues

I am running v 3.5 so maybe that is the first place to start. When I try to install from cran, I get the following message:
package ‘todor’ is not available (for R version 3.5.1)

So I tried the devtools install directory from github. That seemed to work. Now if I click on add-ins, I can see the two options in the drop down "Find package TODOs" and also "Find project TODOs".

When I click on "Find project TODOs" I get a pop up window that says" R code execution error" and then a message in the console that reads:

Error in dir(path = search_path, pattern = rex::rex(".", one_of("Rr"), :
invalid 'path' argument

So other random settings that may or may not be useful to know:
-I run Rstudio as admin
-I have a default wd() that is set to a subfolder on my c drive within the R 3.5 folder

Any help would be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.