You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rename functions to match the Tidyverse style #208
In the tidyverse style guide, sections on object names and function names (2.1 Object names; 3.1 Naming; very short sections, so you can read them now) suggest that function names contain only letters, digits, and underscores. Dots . are advised to be used only for S3 methods. Capital letters should be avoided too.
Some of the function names in hyperSpec do not comply with these style rules even though CONTRIBUTING.md states that
This project adheres to the Tidyverse styleguide.
I see an inconsistency here.
Some of the possible suggestions what could be done:
To rename some/most of the function names (except additional methods for base or other packages, e.g., as.data.frame.hyperSpec()), that names do not comply with the tidyverse style and have two versions of function names for backward compatibility.
The same as (1) but deprecate the names that do not comply with the style.
Update CONTRIBUTING.md that all new functions must comply with the tidyverse style, but the package has functions that do not in order to avoid breaking changes.
/ other options are also possible /
My personal position is to rename at least some of the functions. Especially, spc.* and normalize.* series.
(The read.* and write.* series might also be renamed). And now (before splitting hyperSpec into separate packages and releasing 1.0.0, as major release means that breaking changes are introduced.
P.S. If there is a question about styler package, it only does those changes that do not break the code. I.e., it does not rename functions. Thus, this issue is not related to styler.
I see the tidyverse style as a recommendation, i.e. nothing to follow blindly.
I'm fine with naming new functions in snake_case.
OTOH, we will anyways have a mix of naming styles since we need to adhere to the spelling of any function we import/overload. Thus, I don't see any urgency in renaming functions for the sake of having some more snake_case.
The read.*() functions can be renamed to read_*() when moving them into their new packages, though.
The ggplot2-related functions should IMHO be renamed when moving into their own package, since ggplot2 belongs to the tidyverse and itself uses snake_case. Other names would be more surprising than usual here.
As we discussed in the video meeting on 2020-07-20, function names refering to manufacturers/companies, software, standards or abbreviations should use the common/proper spelling of those rather than lower casing it.
use a common prefix for certain types of functions (when applicable; in some cases this requres rearanging function name parts):
prefix hy_ for utility functions;
prefix spc_ for functions that operate on @spc (when it is needed to stress that calculation is made on @spc, in most cases spc_ is not used; Rename functions (3): spc_ #301).
changed the title [-]Should function names in hyperSpec adhere to the tidyverse style?[/-][+]Rename functions to match the Tidyverse style[/+]on Sep 1, 2020
Activity
GegznaV commentedon Jul 15, 2020
The functions can be renamed, but the old names should be properly deprecated.
cbeleites commentedon Jul 24, 2020
I see the tidyverse style as a recommendation, i.e. nothing to follow blindly.
read.*()functions can be renamed toread_*()when moving them into their new packages, though.GegznaV commentedon Aug 31, 2020
I'm going to rename some functions by following these principles:
hy_for utility functions;spc_for functions that operate on@spc(when it is needed to stress that calculation is made on@spc, in most casesspc_is not used; Rename functions (3): spc_ #301).wl_for wavelength-related functions (Rename functions (2): wl_ #300).palette_for functions, that create collor palettes (Rename functions (1): palette_ #299).[-]Should function names in hyperSpec adhere to the tidyverse style?[/-][+]Rename functions to match the Tidyverse style[/+]GegznaV commentedon Jul 12, 2021
I'm closing this issue as there were more specific issues (listed above) opened.