Repository navigation
User experience improvements - #245
Conversation
+ linters are of the 'linter' class + lint checks that the 'linters' argument contains 'linter' objects
1/ when using linters of class 'function' instead of 'linter' 2/ when using linter variables (old interface) instead of calling the linter (new consistent interface)
Codecov Report
@@ Coverage Diff @@
## master #245 +/- ##
==========================================
- Coverage 86.13% 85.52% -0.61%
==========================================
Files 39 39
Lines 2178 2204 +26
==========================================
+ Hits 1876 1885 +9
- Misses 302 319 +17
Continue to review full report at Codecov.
|
|
Jim, I'd be interested to read what you think of this branch. |
|
I think the ideas here are good, unfortunately it is now pretty far diverged from the current master :( Would be great if @fangly or someone else would be able to update the code in this PR to merge cleanly with the current lintr codebase. |
|
By now, this has diverged even more. Let me know if you're still interested in this change and I'll try to get the PR going again. |
# Conflicts: # DESCRIPTION # R/T_and_F_symbol_linter.R # R/closed_curly_linter.R # R/commas_linter.R # R/comment_linters.R # R/deprecated.R # R/expect_lint.R # R/extraction_operator_linter.R # R/function_left_parentheses.R # R/line_length_linter.R # R/no_tab_linter.R # R/object_name_linters.R # R/object_usage_linter.R # R/path_linters.R # R/pipe_continuation_linter.R # R/seq_linter.R # R/single_quotes_linter.R # R/spaces_inside_linter.R # R/spaces_left_parentheses_linter.R # R/undesirable_function_linter.R # R/undesirable_operator_linter.R # R/unneeded_concatenation_linter.R # R/zzz.R # man/default_linters.Rd # man/expect_lint.Rd # man/linters.Rd # tests/testthat/test-T_and_F_symbol_linter.R # tests/testthat/test-absolute_path_linter.R # tests/testthat/test-assignment_linter.R # tests/testthat/test-cache.R # tests/testthat/test-closed_curly_linter.R # tests/testthat/test-commas_linter.R # tests/testthat/test-error.R # tests/testthat/test-extraction_operator_linter.R # tests/testthat/test-function_left_parentheses_linter.R # tests/testthat/test-infix_spaces_linter.R # tests/testthat/test-line_length_linter.R # tests/testthat/test-no_tab_linter.R # tests/testthat/test-nonportable_path_linter.R # tests/testthat/test-object_length_linter.R # tests/testthat/test-object_name_linter.R # tests/testthat/test-object_usage_linter.R # tests/testthat/test-open_curly_linter.R # tests/testthat/test-pipe_continuation_linter.R # tests/testthat/test-semicolon_terminator_linter.R # tests/testthat/test-seq_linter.R # tests/testthat/test-single_quotes_linter.R # tests/testthat/test-spaces_inside_linter.R # tests/testthat/test-spaces_left_parentheses_linter.R # tests/testthat/test-todo_comment_linter.R # tests/testthat/test-trailing_blank_lines_linter.R # tests/testthat/test-trailing_whitespace_linter.R # tests/testthat/test-undesirable_function_linter.R # tests/testthat/test-undesirable_operator_linter.R # tests/testthat/test-unneeded_concatenation_linter.R # vignettes/creating_linters.Rmd
|
This changeset is absolutely huge. I merged all R/ files by hand, ported newer linters added since 2017 to the I also updated the deprecation note @fangly added to 2.0.1.9001. |
FWIW highly recommend viewing the diff with whitespace diffs off in the UI. A lot more manageable: |
MichaelChirico
left a comment
There was a problem hiding this comment.
I agree it's good to be more consistent about forcing () on the calls.
Mostly minor changes, I'll have another look at the NEWS file once that's cleaned up -- we'll definitely want to surface this high as a breaking change.
And with that, changing to 3.0.0 is definitely warranted (wasn't 100% sure before).
|
Yep. NB the compatibility layer issues a warning for the old style, so at least lintr configurations and core linting functions shouldn't break. |
Hi Jim,
Please have a look at the code in this branch. My main objective was to ensure a consistence interface to the different linters because the situation is currently confusing; some linters have to be called with an argument while other must just be identified by name. My proposed solution is to have all linters written so that they need to be called.
Before:
semicolon_terminator_linter(semicolon = "compound")T_and_F_symbol_linterAfter:
semicolon_terminator_linter(semicolon = "compound")T_and_F_symbol_linter() # takes no argumentAn advantage of this change is that we can later decide to add optional arguments to any linter without breaking compatibility with prior versions of lintr. So, we introduce an incompatible change now for better user experience and will be able to introduce fewer incompatible changes in the future.
I also gave all the linters the "linter" class and check in
lint()that the 'linters' argument only contains objects of class 'linter'. This is to warn users early when they use the 'linters' argument wrongly and prevent them from encountering obscure error messages.To support these changes, I have added two deprecation messages and work-arounds in
lint(). The users are thus informed of the changes but the code should continue to work as before.Thoughts on the idea or implementation? Cheers,
Florent