Skip to content

Extensibility: Third-party style guide support #10

Closed

Description

@lorenzwalthert

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.

Activity

  1. modified the milestone: on Aug 17, 2017
  2. lorenzwalthert commented on Aug 18, 2017

    @lorenzwalthert
    CollaboratorAuthor

    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?

  3. krlmlr commented on Aug 18, 2017

    @krlmlr
    Member

    Let's think about this when we have support for a second style guide, and don't suggest anything for now in the vignette.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions