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

fix r cmd check note about #! interpreter line #83

Merged
merged 3 commits into from
Dec 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion R/rstan_package_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@
if (!has_file || is_stanfile) {
if (noedit && (file_lines[1] != noedit_msg)) {
# add "noedit" to top of file
file_lines <- c(noedit_msg, "", file_lines)
if (startsWith(file_lines[1], "#!")) {
# in this case no edit msg goes on 2nd line so file starts with #! interpreter line
# see https://github.com/stan-dev/rstantools/issues/82
file_lines <- c(file_lines[1], "", noedit_msg, "", file_lines[-1])
} else {
file_lines <- c(noedit_msg, "", file_lines)
}
}
if (is_stanfile) {
# stan file found: check if it needs to be overwritten
Expand Down