Skip to content

Commit

Permalink
Revert unintended
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Jun 7, 2024
1 parent 9437949 commit 35882ae
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# reuseme (development version)

* `proj_outline()` now detects [knitr notebooks](https://rmarkdown.rstudio.com/articles_report_from_r_script.html) that use the default options. Internally, the file is transformed into a md file by stripping roxygen comments, and is processed as such.
* `proj_outline()` now detects [knitr notebooks](https://rmarkdown.rstudio.com/articles_report_from_r_script.html) that use the default options. Internally, the file is transformed into a md file by stripping roxygen comments, and is processed as such. (#30)

* `proj_outline()` no longer shows `complete_todo()` links for items in non-interactive sessions. `complete_todo()` links are now only shown when calling `file_outline()` on the active file.

Expand Down
14 changes: 8 additions & 6 deletions R/outline-criteria.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ define_outline_criteria <- function(.data, print_todo) {
x$content[x$is_notebook] <- sub("^#'\\s?", "", x$content[x$is_notebook])
x$is_md <- (x$is_md | x$is_roxygen_comment | x$is_notebook) & !x$is_news # treating news and other md files differently.
x$is_roxygen_comment <- x$is_roxygen_comment & !x$is_notebook
x <- dplyr::mutate(
x,
# Remove any files that contain noRd roxy tag to avoid false positive (this limitation can be overcome if / when I use roxygen2 parser)
is_roxygen_comment = is_roxygen_comment & !any(startsWith(content, "#' @noRd")),
.by = file
)
# TODO extract title in roxy comments (@title too.L)
# x <- dplyr::mutate(
# x,
# # Remove any files that contain noRd roxy tag to avoid false positive (this limitation can be overcome if / when I use roxygen2 parser)
# is_roxygen_comment = is_roxygen_comment & !any(startsWith(content, "#' @noRd")),
# .by = file
# )
# x$is_object_title <- x$is_roxygen_comment & (x$line == 1 | dplyr::lag(x$ccontent, "Nothing") %in% c("", " ", " ") & dplyr::lead(x$ccontent) %in% c("#'", "#' ", "#' "))
} else {
x$is_notebook <- FALSE
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bench::mark(
#> # A tibble: 1 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 outline <- proj_outline() 503ms 503ms 1.99 22.5MB 3.98
#> 1 outline <- proj_outline() 523ms 523ms 1.91 22.2MB 3.82
```

<details>
Expand Down Expand Up @@ -218,6 +218,7 @@ outline
#>
#> ── `R/outline-criteria.R`
#> `i` Add variable to outline data frame
#> `i` TODO extract title in roxy comments (@title too.L)
#> `i` TODO strip is_cli_info in Package? only valid for EDA
#> `i` FIXME try to detect all the chunk caption, but would have to figure out the end of it maybe lightparser.
#> `i` it is 'R/outline.R'
Expand Down Expand Up @@ -247,7 +248,6 @@ outline
#> ── `R/todo.R`
#> `i` TODO think about maybe using todo = clipr::read_clip()
#> `i` TODO nice to have, but would need to extract duplicates
#> `i` TODO, WORK, FIXME)
#> `i` Helpers
#>
#> ── `R/utils-proj.R` usethis adaptions utils
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-outline-criteria.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ test_that("o_is_todo_fixme() works", {
expect_false(o_is_todo_fixme(" expect_true(o_is_todo_fixme(\" # TODO this is important\"))"))
# avoid finding comments.
expect_false(o_is_todo_fixme("# another TODO item"))
expect_false(o_is_todo_fixme("#' TODO, WORK, FIXME)", is_roxygen_comment = T))

})

test_that("o_is_work_item() works", {
Expand Down

0 comments on commit 35882ae

Please sign in to comment.