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
Extensibility: Third-party style guide support #10
At it’s core, a style guide is a collection of transformer functions that fulfill certain formal requirements.
It would be nice if styler could support style guides defined by third parties.
In the following, I lay out a potential mechanism for how such a third-party support could look like. This were my first thoughts on the topic. Maybe there are better approaches to it.
Styler could provide a function to import style guides and save them in the local package directory of styler. People who want to create style guides could provide the transformer functions for example in a GitHub repository. The style guide that should be used to format a package’s source code (and potentially further options) could then be specified in a file in the root directory of that package (e.g. in styler.yml). Styler would then use the the information from this .yml file, source the corresponding .R files from the styler package directory and apply them (and potentially further options) to the source code to be formatted. The formal requirements of style guides had to be defined (i.e. before it can be imported). Potential requirements: Style guide must not yield an error when applied to a test source code. Transformer functions must have follow certain naming conventions, must be documented ect. Provide detailed instructions how to create / test style guides etc.
In the vignette I am working on that shows how to cretae custom styler functions, I was wondering how we want to encourage pepole to implement their own style guides. Should people contribute their style guides to styler (or maybe to a new package styleguides, and styler re-rexports those) or should we not say anything about that in the vignette?
Activity
lorenzwalthert commentedon Aug 18, 2017
In the vignette I am working on that shows how to cretae custom styler functions, I was wondering how we want to encourage pepole to implement their own style guides. Should people contribute their style guides to styler (or maybe to a new package
styleguides, and styler re-rexports those) or should we not say anything about that in the vignette?krlmlr commentedon Aug 18, 2017
Let's think about this when we have support for a second style guide, and don't suggest anything for now in the vignette.