Skip to content

styler has an implicit dplyr dependency #323

Closed

Description

@lorenzwalthert

If you run styler without dplyr installed, in some cases the following error message appears:

styler::style_text("a = b")
#> Error: `map_df()` requires dplyr

Created on 2018-01-18 by the reprex package (v0.1.1.9000).

Resolution: Install the dplyr package via install.packages("dplyr").

Details

As reported here, styler depends on dplyr via purrr::map_dfr() which we need to fix asap. Potentially this affects the upcoming reprex release that lists styler under suggests and the planned dependency in usethis.
cc: @krlmlr

Activity

  1. krlmlr commented on Jan 18, 2018

    @krlmlr
    Member

    Can we implement our own version of map_dfr()? Need to take special care of the corner case of zero-length input, is this tested anywhere (implicitly or explicitly)?

  2. krlmlr commented on Jan 18, 2018

    @krlmlr
    Member

    FWIW, this problem seems to affect only users that don't have dplyr installed and use = for assignment in their code. So, we should update soon, but in the meantime it feels enough if the problem is discoverable. I adapted the description of this issue to that effect.

  3. krlmlr commented on Jan 18, 2018

    @krlmlr
    Member

    Zero-length input doesn't seem to be relevant for our use case here.

  4. lorenzwalthert commented on Jan 18, 2018

    @lorenzwalthert
    CollaboratorAuthor

    Yes, thanks @krlmlr. I think the error is pretty informative, so it's not too bad. However, only if style_text() is used, in the other cases (e.g. with style_dir()) it will simply show in the summary table that there was an error with styling without further explanation. So this is unsatisfactory.

  5. lorenzwalthert commented on Jan 18, 2018

    @lorenzwalthert
    CollaboratorAuthor

    @krlmlr maybe you can have a look at #324 where I simply c/p purrr code and import the required functions from purrr. bind_rows() was already implemented when we removed the dplyr dependency in #182. It seems pretty straight forward.

  6. krlmlr commented on Jan 18, 2018

    @krlmlr
    Member

    Should we show a summary of the error messages with style_dir()?

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions