Closed GegznaV closed 2 years ago
I agree... I made a similar change to hySpc.read.jdx
though you may wish to make all the messages identical.
though you may wish to make all the messages identical.
Could a function be written in this case?
Perhaps, I've appended below the message issued by jdx
when the data can't be processed. If we want something like this for all import packages it could be worded more generically and is a candidate for inclusion in pkg-skeleton
for automatic updating across all repos.
stop(
"read_jdx() cannot process all types of JCAMP-DX files.\n",
"You may wish to look at readJDX::readJDX() for more information. \n",
"If you have a file you think should work, or wish to suggest an ",
"enhancement, please, create an issue at\n",
packageDescription("hySpc.read.jdx")$BugReports
)
This part of the message can be converted into a function with parameter (string) pkg
(package name):
"If you have a file you think should work, or wish to suggest an ", "enhancement, please, create an issue at\n", packageDescription("hySpc.read.jdx")$BugReports
The function should be used inside of stop()
and return a sting:
msg_open_enhancement_issue <- function(pkg) {
paste0(
"If you have a file you think should work, ",
"or wish to suggest an enhancement, ",
"please, create an issue at \n",
packageDescription(pkg)$BugReports
)
}
``
I agree... I made a similar change to
hySpc.read.jdx
though you may wish to make all the messages identical.
hySpc.read.jdx may be the one package where the messages should be different, and enhancements in the actual file import should go to @bryanhanson's readJDX...
To make things simpler, let's talk just about hySpc.read.txt
. To have messages unified across functions of just hySpc.read.txt
would be a feature.
If a completely generic message can be written, then the real simplification across all packages would be to remove string
from the function argument and hard-wire the string. It looks to me that if the message will be unique for each package then you might as well stick with hard-wiring each one. Before, you were emitting a custom message using paste. With the function and a custom string, you are actually writing more with no fewer lines of code to maintain.
Here's one possible generic message:
paste("Package", packageDescription(pkg)$Package, "does its best to read a wide variety of file formats.
If you run into an error, or have a file you believe fits the standard but cannot be imported, please file
an issue at", packageDescription(pkg)$BugReports, sep = " ")
Some \n
may be needed in there after finalization and testing.
Regarding jdx
I don't think you need a different message as I have a watch on the repo, or even more securely you should probably just make me the maintainer for the long term, as if someone else is the maintainer they'll probably just refer to me anyway.
My $0.02 as they say here in the States, and maybe elsewhere!
There are some messages left that encourage users to contact the maintainer in case of an error or bug. They usually contain code:
or similar. A reference to open a GH issue in this (and not `hyperSpec's) repo should replace the suggestion to contact the maintainer.