-
Notifications
You must be signed in to change notification settings - Fork 45
Add criteria: vscode, quarto, renv #130
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
base: main
Are you sure you want to change the base?
Conversation
I was looking around to see what else I might need to update. It doesn't seem like here really advertises the criteria is uses for finding the project directory. And empirically it seems like a lot of people think that only an |
Thanks. I wonder if rprojroot should really be a standalone these days. You gave feedback to the documentation of this package some time ago, I never took action. It might be time to evaluate the use of |
I opened a new issue for the documentation ideas (#132), which is related, but I don't think we need to wait on that. I've manually tested that all 3 of the new criteria seem to be working. |
…ke-null test: Snapshot updates for rcc-smoke (null)
man/here.Rd
Outdated
@@ -49,12 +49,15 @@ until a directory with at least one of the following conditions is found: | |||
\itemize{ | |||
\item contains a file \code{.here} | |||
\item contains a file matching \verb{[.]Rproj$} with contents matching \verb{^Version: } in the first line | |||
\item contains a directory \code{.vscode} | |||
\item contains a file \verb{_quarto.yml} | |||
\item contains a file \code{renv.lock} with contents matching "\code{Packages}:\s*\{` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently more escaping is needed here. But it's not easily within the control of this PR 🤔
* checking DESCRIPTION meta-information ...Warning: /home/runner/work/here/here/check/here.Rcheck/00_pkg_src/here/man/here.Rd:54: unknown macro '\s'
man/here.Rd
Outdated
\item contains a file \code{DESCRIPTION} with contents matching \verb{^Package: } | ||
\item contains a file \code{remake.yml} | ||
\item contains a file \code{.projectile} | ||
\item contains a directory \code{.git} | ||
\item contains a file \code{.git} with contents matching \verb{^gitdir: } | ||
\item contains a directory \code{.svn} | ||
\item contains a directory `.svn" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also weird. Why is this not treated the same as .git
? 🤔
I fixed the |
OK now I see where these docs are being produced, so presumably I can fix this. I'll give it a whirl. |
I went in a circles with regex fixups for a long time. The fundamental problem is having double quotes nested inside of double quotes. This comes up because the description of the Eventually I threw in the towel and designed the problem away in rprojroot. So now the docs here depend on dev rprojroot (well, a branch of dev rprojroot at this very moment). First I want to prove that this works. Then we can paper over the dev dependency thing to get here into a CRAN-releasable state. |
@@ -9,7 +9,7 @@ format_root_section <- function() { | |||
"starting with the current working directory during package load time,", | |||
"the directory hierarchy is walked upwards ", | |||
"until a directory with at least one of the following conditions is found:", | |||
gsub('"([^"]+)"', "`\\1`", format_root_criteria_items()), | |||
format_root_criteria_items(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found this easier to reason about by relocating the gsub()
below. Now we do that while each criterion's description is still its own element. This also limits the damage an undesirable regex substitution can do, i.e. limits it to a single item versus communicating across the whole string (that was actually what caused the .svn
weirdness before).
@@ -21,6 +21,7 @@ format_root_section <- function() { | |||
|
|||
format_root_criteria_items <- function(indent = 0) { | |||
format <- format(.root_env$root$crit)[-1L] | |||
format <- gsub("'([^']+)'", "`\\1`", format) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New location for this fixup and now looking for single-quoted strings instead of double-quoted.
- contains a file matching `[.]Rproj$` with contents matching `^Version: ` in the first line | ||
- contains a directory `.vscode` | ||
- contains a file `_quarto.yml` | ||
- contains a file `renv.lock` with contents matching `"Packages":\s*\{` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is the really difficult one!
@@ -49,6 +49,9 @@ until a directory with at least one of the following conditions is found: | |||
\itemize{ | |||
\item contains a file \code{.here} | |||
\item contains a file matching \verb{[.]Rproj$} with contents matching \verb{^Version: } in the first line | |||
\item contains a directory \code{.vscode} | |||
\item contains a file \verb{_quarto.yml} | |||
\item contains a file \code{renv.lock} with contents matching \verb{"Packages":\\s*\\\{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TRICKY
Closes #128
Closes #80