Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a functionality to check if the roxygen declarations are corresponding to the functions? #1660

Open
vertesy opened this issue Sep 20, 2024 · 4 comments

Comments

@vertesy
Copy link

vertesy commented Sep 20, 2024

Hey,
thank you for this great package, I use it when I'm writing my own packages.

Is there a functionality to check if the roxygen declarations are corresponding to the functions, in. a long file of many function declarations?

I want to check :

  • if all parameters declared in the roxygen documentation are used by the corresponding function and
  • if there are any superfluous declarations.

Thank you!
Abel

@olivroy
Copy link
Contributor

olivroy commented Oct 5, 2024

devtools::check_man()?

@vertesy
Copy link
Author

vertesy commented Oct 23, 2024

Thank you so much, that works really well!

@vertesy vertesy closed this as completed Oct 23, 2024
@vertesy
Copy link
Author

vertesy commented Oct 23, 2024

On a second thought, after using it:

This function does the job, but not most conveniently. If a package has multiple R scripts, then you have to search through all of them to find where is that function declared and in which lines is the argument declaration missing.

Some of the other devtools functions, like document(), give you a direct clickable link in the console so that you can quickly jump to the problematic section of your code, if I recall correctly. (Unfortunately that does not check for missing argument declarations, only works for empty param declarations @ param _nothing follows_, as far as I know)

Updating PackageTools documentation
Writing [NAMESPACE](google.com)
ℹ Loading PackageTools
✖ [PackageTools.R:30](google.com): @param requires two parts: an argument name and a description.
Writing NAMESPACE

Alternatively, some functionality that would automatically place just the empty arguments @param missin wherever it's not declared would be also quite convenient.

If anyone knows about such, please let me know. Thank you.

@vertesy vertesy reopened this Oct 24, 2024
@vertesy
Copy link
Author

vertesy commented Oct 24, 2024

Also, I spent 2+ hours to make devtools::check_man() work for one of my packages, Seurat.utils.

> devtools::check_man("~/GitHub/Packages/Seurat.utils")
ℹ Updating Seurat.utils documentationLoading Seurat.utilsChecking documentation...
Error in gzfile(file, "rb") : cannot open the connection
> rlang::last_trace()
<error/rlang_error>
Error in `package_file()`:
! /GitHub/Packages/Seurat.utils is not a directory.
---
Backtrace:1. └─devtools::check_man("/GitHub/Packages/Seurat.utils")
 2.   └─devtools::as.package(pkg)
 3.     └─devtools::package_file(path = x)
Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.

Admittedly, the package is not in the best shape, but that's exactly why I need a robust helper tool for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants