-
Notifications
You must be signed in to change notification settings - Fork 186
Writing R code in a DCF is unappealing #1210
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
Comments
Not sure about the .R extension. Most IDEs allow you to configure the default language per extension, and that makes it easy to confuse the config with an actual (productive) script within the project. Other packages tend to use |
Rather minimal changes to the linters <- linters_with_defaults( # The following TODOs are part of an effort to have {lintr} lint-free (#584)
line_length_linter = line_length_linter(120),
# TODO add implicit_integer_linter()
cyclocomp_linter = cyclocomp_linter(37), # TODO reduce to 15
)
exclusions <- list(
"inst/doc/creating_linters.R" = 1,
"inst/example/bad.R",
"tests/testthat/default_linter_testcode.R",
"tests/testthat/dummy_packages",
"tests/testthat/dummy_projects",
"tests/testthat/exclusions-test",
"tests/testthat/knitr_formats",
"tests/testthat/knitr_malformed"
) @MichaelChirico WDYT? |
Allowing There's some related art in Roxygen2 — you can configure simple options in |
Not a big fan of allowing two separate configuration files - what to do if both files exist in the same directory? I must admit though, that the DCF format took a bit to get used to, especially the akward indentation requirements. |
The easiest solution is to error if both files are present. If you find the idea of a |
Hmm that seems hard because we intend on linters:
- with: defaults
line_length_linter:
length: 120
cyclocomp_linter:
limit: 37
exclusions:
- inst/doc/creating_linters.R: 1
- inst/example/bad.R
- tests/testthat/default_linter_testcode.R
- tests/testthat/dummy_packages
- tests/testthat/dummy_projects
- tests/testthat/exclusions-test
- tests/testthat/knitr_formats
- tests/testthat/knitr_malformed |
I also find the DCF approach a bit awkward... what's the appeal of it besides back-compatibility? |
The only other advantage I can think of is |
the R-based approach just needs |
Yeah, right. If we want to use R as the "format". |
right... that basically maps to the current setup though right? DCF keys/values --> variable names/values in config environment |
True. But in |
If you were worried about that you could inspect the environment and error if there were unexpected variables. PS. I'd suggest |
if we're going to switch we could also offer a script (maybe a snippet in NEWS) to convert an existing DCF->R |
I guess this would supersede #886 |
Isn't it a more common method to validate YAML with a schema? |
If we go with R, we should export a |
I'm just using Finding an alternative way for configuration is very desirable. The |
@HaHeho Could you share an R file that's giving you this issue (in a new bug report please)? .lintr.R is plain R code, completely independent of DCF implementation, so there should be no such issue. |
Hmm, maybe my R Studio session was borked then. I started with I did some more testing now by repeating the above process. I learned that executing
The
Is this a known issue that can be fixed easily? Should I file a bug report for this one? |
Indeed it looks like a bug, thanks! This Line 15 in 106dfb4
Please file a new bug. |
Since you don't get syntax highlighting, help, autocomplete, ...
What do you think about supporting some additional way of defining custom linters that uses a file with a
.R
extension?The text was updated successfully, but these errors were encountered: