Repository navigation
lint formals and ensure names match >= 1 style - #398
Merged
Merged
Conversation
Previous xml-based version of object_name_linter: - required all names to match every one of the requested styles - disregarded names of formals in newly-defined functions Hence: - added extra xpath clause to catch SYMBOL_FORMALS - used or-reduction to ensure each name matches at least one style. Also: - since multiple styles are allowed, the lint message is now like "Variable and function name style should be style_1, style_2 or style_3". - tests for `object_name_linter` and lint message for `object_name_linter_old` were changed to match this format. - added `...` argument to a unit test to ensure that `object_name_linter` does not flag dots.
Codecov Report
@@ Coverage Diff @@
## name_performance #398 +/- ##
===================================================
Coverage ? 81.57%
===================================================
Files ? 43
Lines ? 1954
Branches ? 0
===================================================
Hits ? 1594
Misses ? 360
Partials ? 0
Continue to review full report at Codecov.
|
Collaborator
Author
|
sorry - forgot the docs. Updated. |
Added UTF-8 encoding to DESCRIPTION to get roxygen to compile the docs
russHyde
pushed a commit
that referenced
this pull request
Aug 23, 2019
* Re-implementation of object_name_linter
Is both more robust and an order of magnitude more performant
microbenchmark(
{lint("R/lint.R", object_name_linter("snake_case"))},
{lint("R/lint.R", object_name_linter_old("snake_case"))})
#> Unit: milliseconds
#> expr min lq mean median uq max neval
#> { lint("R/lint.R", object_name_linter2("snake_case")) } 225.9701 252.2269 265.9434 263.2129 273.7824 483.367 100
#> { lint("R/lint.R", object_name_linter("snake_case")) } 1275.5349 1360.3626 1430.6543 1425.3408 1486.9745 1735.298 100
* Prevent crash following NAMESPACE not found
* Use existing pkg_name() function
* Don't assume that user is in package root
In namespace_import, use package root by default instead of current directory
* Add missing file
* Fix issues when object_name_linter has compound assignments with `$` and `@`.
* Fixed failing example and incomplete line warning
* Fixed mismatch between code and documentation
* lint formals and ensure names match >= 1 style (#398)
* lint formals and ensure names match >= 1 style
Previous xml-based version of object_name_linter:
- required all names to match every one of the requested
styles
- disregarded names of formals in newly-defined functions
Hence:
- added extra xpath clause to catch SYMBOL_FORMALS
- used or-reduction to ensure each name matches at least one
style.
Also:
- since multiple styles are allowed, the lint message is now
like "Variable and function name style should be style_1,
style_2 or style_3".
- tests for `object_name_linter` and lint message for
`object_name_linter_old` were changed to match this
format.
- added `...` argument to a unit test to ensure that
`object_name_linter` does not flag dots.
* change docs to reflect use of >= 1 style
Added UTF-8 encoding to DESCRIPTION to get roxygen to
compile the docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous xml-based version of
object_name_linter:required all names to match every one of the requested
styles
disregarded names of formals in newly-defined functions
Hence:
added extra xpath clause to catch
SYMBOL_FORMALSused or-reduction to ensure each name matches at least one
style.
Also:
since multiple styles are allowed, the lint message is now
like "Variable and function name style should be style_1,
style_2 or style_3".
tests for
object_name_linterand lint message forobject_name_linter_oldwere changed to match thisformat.
added
...argument to a unit test to ensure thatobject_name_linterdoes not flag dots.