Skip to content

[feature request] generate a ".lintr" file function #902

Closed

Description

@eitsupi

New users who are not familiar with the DCF format will have a hard time trying to set up a .lintr file.
I think it would be useful to have a function to generate a basic .lintr file.

Related to #886.

Activity

  1. AshesITR commented on Feb 5, 2022

    @AshesITR
    Collaborator

    That sounds like a nice idea, thanks for the suggestion!
    I wonder whether usethis would be a good place to put this (e.g. usethis::use_lintr()).
    If they're not interested, we could provide it ourselves too, though.

  2. added
    feature
    on May 2, 2022
  3. AshesITR commented on May 2, 2022

    @AshesITR
    Collaborator

    @eitsupi Can you take a look at #1120 and see if use_lintr() would help you? Thanks for your feedback!

  4. eitsupi commented on May 2, 2022

    @eitsupi
    ContributorAuthor

    @AshesITR Thanks for letting me know!

    However, it was a little different from what I had imagined.
    For example, I usually set up a file like the following:

    linters: with_defaults(
      line_length_linter(120),
      commented_code_linter = NULL
      )
    

    The main motivation for setting up this file is to make the length of one line 120.
    So I imagined it would be useful to output a file with all the default settings written to it, such that this could be accomplished by simply editing 80 to 120.

    Of course, if all configuration items are output, it would be too much, so it would be nice to be able to filter the output items with an argument such as type="full" like you did in #1120.

  5. AshesITR commented on May 2, 2022

    @AshesITR
    Collaborator

    Thanks for your swift feedback.

    Dumping all default arguments seems rather advanced. Outputting all default linters would amount to 24 lines of code at the moment and outputting all linters (the equivalent of linters_with_tags(tags = NULL)) would mean 69 lines.
    What do you think about adding a (static) comment that exemplifies the three possible actions (add a linter, reconfigure a linter, remove a linter)?

  6. eitsupi commented on May 2, 2022

    @eitsupi
    ContributorAuthor

    I thought it was wonderful that comments like the following were included in the file, which worked well with R's excellent help functionality.

    exclusions: list("renv", "packrat") # see ?exclude
    

    However, users may not have loaded lintr, so a comment like see ?lintr::exclude would be more clear, I think.

    I thought it would be useful too to add a link to the vignette (maybe vignette("using_lintr") ?) that will be added in lintr 3.0.0 on how to edit .lintr files.

  7. eitsupi commented on May 18, 2022

    @eitsupi
    ContributorAuthor

    closed by fff7808

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions