Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eitsupi opened this issue Feb 5, 2022 · 6 comments · Fixed by #1120
Closed

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

eitsupi opened this issue Feb 5, 2022 · 6 comments · Fixed by #1120
Labels
feature a feature request or enhancement

Comments

@eitsupi
Copy link
Contributor

eitsupi commented Feb 5, 2022

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.

@AshesITR
Copy link
Collaborator

AshesITR commented Feb 5, 2022

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.

@AshesITR
Copy link
Collaborator

AshesITR commented May 2, 2022

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

@eitsupi
Copy link
Contributor Author

eitsupi commented May 2, 2022

@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.

@AshesITR
Copy link
Collaborator

AshesITR commented May 2, 2022

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)?

@eitsupi
Copy link
Contributor Author

eitsupi commented May 2, 2022

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.

@eitsupi
Copy link
Contributor Author

eitsupi commented May 18, 2022

closed by fff7808

@eitsupi eitsupi closed this as completed May 18, 2022
@AshesITR AshesITR mentioned this issue May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants