Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function calls. (#850, #851, @renkun-ken)
* * `object_length_linter()` correctly detects generics and only counts the implementation class towards the length.
This prevents false positive lints in the case of long generic names, e.g.
`very_very_very_long_generic_name.short_class` no longer produces a lint (#871, @AshesITR)
* `object_name_linter()` now correctly detects assignment generics (#843, @jonkeane)

# lintr 2.0.1

Expand Down
4 changes: 2 additions & 2 deletions R/object_name_linters.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ object_name_linter <- function(styles = c("snake_case", "symbols")) {
xml2::xml_text(assignments)
)

generics <- strip_names(c(
generics <- c(
declared_s3_generics(xml),
imported_s3_generics(namespace_imports(find_package(source_file$filename)))$fun,
.base_s3_generics
))
)
generics <- unique(generics[nzchar(generics)])

style_matches <- lapply(styles, function(style) {
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/dummy_packages/clean/R/clean_generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ drink_me.data.frame <- function(x, ...) {
head.my_s3_object <- function(x, ...) {
NULL
}

#' assign names for my_custom_class
#' @export
`names<-.my_custom_class` <- function(x, value) {
NULL
}