ThinkR-open / checkhelper

A package to help deal with devtools::check outputs
https://thinkr-open.github.io/checkhelper/
Other
34 stars 4 forks source link

`find_missing_tags()` may not return an explicit message if the topic is empty #70

Closed ArthurData closed 1 year ago

ArthurData commented 1 year ago

Validation criteria

Image

Image

Image

the_alias <- the_function


![Image](https://user-images.githubusercontent.com/35060481/234313035-faee19d5-0174-4a40-8eb3-05bb423e91fd.png)

## Technical 

- [x] First step: get the class of the object: `res_find_class`
- [ ] Next: add example package in the unit tests with 
    - [x] package doc (`usethis::use_package_doc()`) 
    - [x] pipe operator (NULL) (usethis::use_pipe()` 
    - [ ] dataset doc (a R file that describes a dataset)
    - [ ] => Use `create_example_pkg()` do build this example 
- [ ] Add the class stored in `res_find_class` in the table to test for missing tags. cf. https://github.com/ThinkR-open/checkhelper/pull/75/commits/348d764835d267d15918edd9e9a0e4e6802de7ec)
    - [ ] Use it to detect the three examples above as not missing tags

`find_missing_tags()` uses the topic to write its message. If the topic is empty, then so is the message.

debugonce(find_missing_tags)

> res_return_error <- res_join[res_join$test_has_export_and_return == "not_ok",]

# A tibble: 2 × 11
     id filename     topic has_export has_return return_value has_nord rdname_value not_empty_return_value test_has_exp…¹ test_…²
  <int> <chr>        <chr> <lgl>      <lgl>      <chr>        <lgl>    <chr>        <lgl>                  <chr>          <chr>  
1    NA NA           NA    NA         NA         NA           NA       NA           NA                     NA             NA     
2    16 utils-pipe.R ""    TRUE       FALSE      ""           FALSE    pipe         FALSE                  not_ok         ok     
# … with abbreviated variable names ¹​test_has_export_and_return, ²​test_has_export_or_has_nord

> nrow(res_return_error) != 0 
[1] TRUE

> message("Missing or empty return value for exported functions: ", paste(res_return_error$topic, collapse = ", "), "\n\n")
Missing or empty return value for exported functions: NA,  
DDorch commented 1 year ago

Hi, all

I get false positive on missing return value if I use the roxygen tag @inherit other_function return return

You can try on the repository https://inrae.github.io/hubeau/ for getting one example.

VincentGuyader commented 1 year ago

about alias :

#' @rdname my_other_median
#' @inheritParams my_other_median
plop <- my_other_median

is a FALSE positive when it's in the same file as my_other_median definition

but return a correct error : 'Doc available but need to choose between @export or @noRd' when it's in an other file

ArthurData commented 1 year ago

Hello @VincentGuyader, It's good to start the revision of this MR 👍

VincentGuyader commented 1 year ago

thanks, lets go to the CRAN \o/ (after updating the NEWS :p )