Skip to content

Commit 5018374

Browse files
Merge 30dd346 into 9565050
2 parents 9565050 + 30dd346 commit 5018374

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

R/object_overwrite_linter.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,21 @@ object_overwrite_linter <- function(
5959
stop("Package '", package, "' is not available.")
6060
}
6161
}
62-
pkg_exports <- lapply(
63-
packages,
64-
# .__C__ etc.: drop 150+ "virtual" names since they are very unlikely to appear anyway
65-
function(pkg) setdiff(grep("^[.]__[A-Z]__", getNamespaceExports(pkg), value = TRUE, invert = TRUE), allow_names)
66-
)
62+
pkg_exports <- lapply(packages, getNamespaceExports)
6763
pkg_exports <- data.frame(
6864
package = rep(packages, lengths(pkg_exports)),
6965
name = unlist(pkg_exports),
7066
stringsAsFactors = FALSE
7167
)
7268

69+
pkg_exports <- pkg_exports[
70+
# .__C__ etc.: drop 150+ "virtual" names since they are very unlikely to appear anyway
71+
!grepl("^[.]__[A-Z]__", pkg_exports$name) &
72+
# exclude non-syntactic names. this might be supported upon user request.
73+
make.names(pkg_exports$name) == pkg_exports$name &
74+
!pkg_exports$name %in% allow_names,
75+
]
76+
7377
# test that the symbol doesn't match an argument name in the function
7478
# NB: data.table := has parse token LEFT_ASSIGN as well
7579
xpath <- glue("

0 commit comments

Comments
 (0)