Skip to content

warn when opening a read-only file - #2085

Merged
jmcphers merged 1 commit into
masterfrom
feature/read-only-warning
Feb 1, 2018
Merged

jmcphers merged 1 commit into
masterfrom
feature/read-only-warning

Conversation

@kevinushey

@kevinushey kevinushey commented Jan 29, 2018 •

Copy link
Copy Markdown
Collaborator

cc: #2082

Example of what this looks like when editing an .Rd file generated by Roxygen:

screen shot 2018-01-29 at 2 28 19 pm

@kevinushey
kevinushey requested a review from jmcphers January 31, 2018 23:40
// check for roxygen token specifically
boost::regex reRoxygen(
"% Generated by roxygen2: do not edit by hand\n"
"% Please edit documentation in ([^\n]+)");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to account for files that use other comment delimiters (e.g. # for NAMESPACE)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case no, since NAMESPACE files don't have a single generator that we can link the user back to. (The default check below that checks for the text 'do not edit by hand' will still catch these cases)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good. I think the roxygen2 check here might be a little too sensitive to roxygen2 changes, but I can't think of a way we can do better without substantially more plumbing (e.g. providing some mechanism for the package to give us the string and/or mining the package itself).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try and make sure we don't change accidentally — r-lib/roxygen2#709

@jmcphers
jmcphers merged commit 7843ed4 into master Feb 1, 2018
@hadley

hadley commented Feb 3, 2018

Copy link
Copy Markdown
Member

Is the alternative file path a link?

Have you checked the appearance with an .Rd file that has many source files?

@kevinushey

kevinushey commented Feb 3, 2018 •

Copy link
Copy Markdown
Collaborator Author

It's not (we should probably implement that).

Looks like we don't have the case with multiple files correctly: see e.g.

screen shot 2018-02-03 at 10 06 31 am

Should we try parsing and linking to each file, or just give a blanket "This file is read only." warning?

@hadley

hadley commented Feb 3, 2018

Copy link
Copy Markdown
Member

Blanket warning seems fine to me - parsing and linking seems like more work than it’s worth

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

Successfully merging this pull request may close these issues.

3 participants