Skip to content
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

capture specifically generic names #755

Merged
merged 27 commits into from
Jul 2, 2021
Merged

Conversation

AshesITR
Copy link
Collaborator

fixes #737 by capturing specifically names of declared generics followed by a . and a class specification.

@AshesITR
Copy link
Collaborator Author

NB the way the regression test was added we now have an expect_lint_free() test on all R scripts in the clean test package.
That means for other false positive linter bugs, we can easily add a regression test there as well.

I did make sure the file was linted locally by deliberately adding a lint to the file (a.b <- 42L) and seeing the tests fail.

Copy link
Collaborator

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically looks good. Let's try and do a before/after for this on some packages. @russHyde could you share a script you have ready for that? I could also try it on my CRAN mirror now that I'm moved in finally.

@russHyde
Copy link
Collaborator

@russHyde
Copy link
Collaborator

russHyde commented Feb 15, 2021

Oh, sorry, the script will need modifying to handle the change in the linter-specification api (linters = assignment_linter() vs linters = assignment_linter). Should be fixed

@MichaelChirico
Copy link
Collaborator

Ran it on 50 random packages and see no difference:

DT=fread('~/lintr_compare_branches_1613545056.csv')
pr = DT[source=="pr"]
main = DT[source=="main"]

main[!pr, on = c("filename", "line_number", "column_number")]
# Empty data.table (0 rows and 9 cols): source,package,filename,line_number,column_number,type...
pr[!main, on = c("filename", "line_number", "column_number")]
# Empty data.table (0 rows and 9 cols): source,package,filename,line_number,column_number,type...

Of course it could just be a bad batch. I'll start it running on a bigger sample now.

@MichaelChirico
Copy link
Collaborator

OK I got a bunch on master that aren't on this PR, but not the reverse:

DT=data.table::fread('~/lintr_compare_branches_1613551117.csv')
pr = DT[source=="pr"]
main = DT[source=="main"]

main[!pr, on = c("filename", "line_number", "column_number")]
# <attached>
pr[!main, on = c("filename", "line_number", "column_number")]
# Empty data.table (0 rows and 9 cols): source,package,filename,line_number,column_number,type...

unique_to_master.txt

@AshesITR
Copy link
Collaborator Author

The unique to master lints sometimes appear to contain false positives.
I think the list of possible generics is too long.

@AshesITR
Copy link
Collaborator Author

The test failures seem unrelated to this PR

── Failure (test-sprintf_linter.R:10:3): returns the correct linting ───────────
got 0 lints instead of 1

@AshesITR
Copy link
Collaborator Author

It seems like this is a problem with R 4.0.4 which was released on Feb 15th.

}

# filter namespace_imports() for S3 generics
# this loads all imported namespaces
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB this already happens in namespace_imports() for completely imported packages.
IMO it's worth to verify whether imported functions are actually generics, reducing the false negative rate.

R/object_name_linters.R Outdated Show resolved Hide resolved
@AshesITR
Copy link
Collaborator Author

AshesITR commented Feb 17, 2021

R 3.4.0 makes a lot of trouble due to a bugged isS3stdGeneric() implementation, which fails on 186 / 1220 objects in ls(baseenv()).

lapply(
  ls(baseenv()),
  function(nm) {
    obj <- get(nm)
	cat(nm, ": ")
    if (!is.function(obj)) {
	  cat("not a function\n")
	} else { 
	  res <- try(isS3stdGeneric(obj), silent = TRUE)
      if (inherits(res, "try-error")) {
        cat("failed\n")
      } else if (isTRUE(res)) {
        cat("generic\n")
      } else {
        cat("not a generic\n")
      }
    }
  }
) -> tmp
Detailed log of `isS3stdGeneric()` in R 3.4.0
- : failed
-.Date : not a generic
-.POSIXt : not a generic
! : failed
!.hexmode : not a generic
!.octmode : not a generic
!= : failed
$ : failed
$.data.frame : not a generic
$.DLLInfo : not a generic
$.package_version : not a generic
$<- : failed
$<-.data.frame : not a generic
%% : failed
%*% : failed
%/% : failed
%in% : not a generic
%o% : not a generic
%x% : not a generic
& : failed
&& : failed
&.hexmode : not a generic
&.octmode : not a generic
( : failed
* : failed
*.difftime : not a generic
/ : failed
/.difftime : not a generic
: : failed
:: : not a generic
::: : not a generic
@ : failed
@<- : failed
[ : failed
[.AsIs : not a generic
[.data.frame : not a generic
[.Date : not a generic
[.difftime : not a generic
[.Dlist : not a generic
[.factor : not a generic
[.hexmode : not a generic
[.listof : not a generic
[.noquote : not a generic
[.numeric_version : not a generic
[.octmode : not a generic
[.POSIXct : not a generic
[.POSIXlt : not a generic
[.simple.list : not a generic
[.table : not a generic
[.warnings : not a generic
[[ : failed
[[.data.frame : not a generic
[[.Date : not a generic
[[.factor : not a generic
[[.numeric_version : not a generic
[[.POSIXct : not a generic
[[<- : failed
[[<-.data.frame : not a generic
[[<-.factor : not a generic
[[<-.numeric_version : not a generic
[<- : failed
[<-.data.frame : not a generic
[<-.Date : not a generic
[<-.factor : not a generic
[<-.numeric_version : not a generic
[<-.POSIXct : not a generic
[<-.POSIXlt : not a generic
^ : failed
{ : failed
| : failed
|.hexmode : not a generic
|.octmode : not a generic
|| : failed
~ : failed
+ : failed
+.Date : not a generic
+.POSIXt : not a generic
< : failed
<- : failed
<<- : failed
<= : failed
= : failed
== : failed
> : failed
>= : failed
abbreviate : not a generic
abs : failed
acos : failed
acosh : failed
addNA : not a generic
addTaskCallback : not a generic
agrep : not a generic
agrepl : not a generic
alist : not a generic
all : failed
all.equal : not a generic
all.equal.character : not a generic
all.equal.default : not a generic
all.equal.environment : not a generic
all.equal.envRefClass : not a generic
all.equal.factor : not a generic
all.equal.formula : not a generic
all.equal.language : not a generic
all.equal.list : not a generic
all.equal.numeric : not a generic
all.equal.POSIXt : not a generic
all.equal.raw : not a generic
all.names : not a generic
all.vars : not a generic
any : failed
anyDuplicated : not a generic
anyDuplicated.array : not a generic
anyDuplicated.data.frame : not a generic
anyDuplicated.default : not a generic
anyDuplicated.matrix : not a generic
anyNA : failed
anyNA.numeric_version : not a generic
anyNA.POSIXlt : not a generic
aperm : not a generic
aperm.default : not a generic
aperm.table : not a generic
append : not a generic
apply : not a generic
Arg : failed
args : not a generic
array : not a generic
arrayInd : not a generic
as.array : not a generic
as.array.default : not a generic
as.call : failed
as.character : failed
as.character.condition : not a generic
as.character.Date : not a generic
as.character.default : not a generic
as.character.error : not a generic
as.character.factor : not a generic
as.character.hexmode : not a generic
as.character.numeric_version : not a generic
as.character.octmode : not a generic
as.character.POSIXt : not a generic
as.character.srcref : not a generic
as.complex : failed
as.data.frame : not a generic
as.data.frame.array : not a generic
as.data.frame.AsIs : not a generic
as.data.frame.character : not a generic
as.data.frame.complex : not a generic
as.data.frame.data.frame : not a generic
as.data.frame.Date : not a generic
as.data.frame.default : not a generic
as.data.frame.difftime : not a generic
as.data.frame.factor : not a generic
as.data.frame.integer : not a generic
as.data.frame.list : not a generic
as.data.frame.logical : not a generic
as.data.frame.matrix : not a generic
as.data.frame.model.matrix : not a generic
as.data.frame.noquote : not a generic
as.data.frame.numeric : not a generic
as.data.frame.numeric_version : not a generic
as.data.frame.ordered : not a generic
as.data.frame.POSIXct : not a generic
as.data.frame.POSIXlt : not a generic
as.data.frame.raw : not a generic
as.data.frame.table : not a generic
as.data.frame.ts : not a generic
as.data.frame.vector : not a generic
as.Date : not a generic
as.Date.character : not a generic
as.Date.date : not a generic
as.Date.dates : not a generic
as.Date.default : not a generic
as.Date.factor : not a generic
as.Date.numeric : not a generic
as.Date.POSIXct : not a generic
as.Date.POSIXlt : not a generic
as.difftime : not a generic
as.double : failed
as.double.difftime : not a generic
as.double.POSIXlt : not a generic
as.environment : failed
as.expression : not a generic
as.expression.default : not a generic
as.factor : not a generic
as.function : not a generic
as.function.default : not a generic
as.hexmode : not a generic
as.integer : failed
as.list : not a generic
as.list.data.frame : not a generic
as.list.Date : not a generic
as.list.default : not a generic
as.list.environment : not a generic
as.list.factor : not a generic
as.list.function : not a generic
as.list.numeric_version : not a generic
as.list.POSIXct : not a generic
as.logical : failed
as.logical.factor : not a generic
as.matrix : not a generic
as.matrix.data.frame : not a generic
as.matrix.default : not a generic
as.matrix.noquote : not a generic
as.matrix.POSIXlt : not a generic
as.name : not a generic
as.null : not a generic
as.null.default : failed
as.numeric : failed
as.numeric_version : not a generic
as.octmode : not a generic
as.ordered : not a generic
as.package_version : not a generic
as.pairlist : not a generic
as.POSIXct : not a generic
as.POSIXct.date : not a generic
as.POSIXct.Date : not a generic
as.POSIXct.dates : not a generic
as.POSIXct.default : not a generic
as.POSIXct.numeric : not a generic
as.POSIXct.POSIXlt : not a generic
as.POSIXlt : not a generic
as.POSIXlt.character : not a generic
as.POSIXlt.date : not a generic
as.POSIXlt.Date : not a generic
as.POSIXlt.dates : not a generic
as.POSIXlt.default : not a generic
as.POSIXlt.factor : not a generic
as.POSIXlt.numeric : not a generic
as.POSIXlt.POSIXct : not a generic
as.qr : not a generic
as.raw : failed
as.single : not a generic
as.single.default : not a generic
as.symbol : not a generic
as.table : not a generic
as.table.default : not a generic
as.vector : not a generic
as.vector.factor : not a generic
asin : failed
asinh : failed
asNamespace : not a generic
asS3 : not a generic
asS4 : not a generic
assign : not a generic
atan : failed
atan2 : not a generic
atanh : failed
attach : not a generic
attachNamespace : not a generic
attr : failed
attr.all.equal : not a generic
attr<- : failed
attributes : failed
attributes<- : failed
autoload : not a generic
autoloader : not a generic
backsolve : not a generic
baseenv : failed
basename : not a generic
besselI : not a generic
besselJ : not a generic
besselK : not a generic
besselY : not a generic
beta : not a generic
bindingIsActive : not a generic
bindingIsLocked : not a generic
bindtextdomain : not a generic
bitwAnd : not a generic
bitwNot : not a generic
bitwOr : not a generic
bitwShiftL : not a generic
bitwShiftR : not a generic
bitwXor : not a generic
body : not a generic
body<- : not a generic
bquote : not a generic
break : failed
browser : failed
browserCondition : not a generic
browserSetDebug : not a generic
browserText : not a generic
builtins : not a generic
by : not a generic
by.data.frame : not a generic
by.default : not a generic
bzfile : not a generic
c : failed
c.Date : not a generic
c.difftime : not a generic
c.noquote : not a generic
c.numeric_version : not a generic
c.POSIXct : not a generic
c.POSIXlt : not a generic
c.warnings : not a generic
call : failed
callCC : not a generic
capabilities : not a generic
casefold : not a generic
cat : not a generic
cbind : not a generic
cbind.data.frame : not a generic
ceiling : failed
char.expand : not a generic
character : not a generic
charmatch : not a generic
charToRaw : not a generic
chartr : not a generic
check_tzones : not a generic
chkDots : not a generic
chol : not a generic
chol.default : not a generic
chol2inv : not a generic
choose : not a generic
class : failed
class<- : failed
clearPushBack : not a generic
close : not a generic
close.connection : not a generic
close.srcfile : not a generic
close.srcfilealias : not a generic
closeAllConnections : not a generic
col : not a generic
colMeans : not a generic
colnames : not a generic
colnames<- : not a generic
colSums : not a generic
commandArgs : not a generic
comment : not a generic
comment<- : not a generic
complex : not a generic
computeRestarts : not a generic
conditionCall : not a generic
conditionCall.condition : not a generic
conditionMessage : not a generic
conditionMessage.condition : not a generic
conflicts : not a generic
Conj : failed
contributors : not a generic
cos : failed
cosh : failed
cospi : failed
crossprod : not a generic
Cstack_info : not a generic
cummax : failed
cummin : failed
cumprod : failed
cumsum : failed
curlGetHeaders : not a generic
cut : not a generic
cut.Date : not a generic
cut.default : not a generic
cut.POSIXt : not a generic
data.class : not a generic
data.frame : not a generic
data.matrix : not a generic
date : not a generic
debug : not a generic
debuggingState : not a generic
debugonce : not a generic
default.stringsAsFactors : not a generic
delayedAssign : not a generic
deparse : not a generic
det : not a generic
detach : not a generic
determinant : not a generic
determinant.matrix : not a generic
dget : not a generic
diag : not a generic
diag<- : not a generic
diff : not a generic
diff.Date : not a generic
diff.default : not a generic
diff.difftime : not a generic
diff.POSIXt : not a generic
difftime : not a generic
digamma : failed
dim : failed
dim.data.frame : not a generic
dim<- : failed
dimnames : failed
dimnames.data.frame : not a generic
dimnames<- : failed
dimnames<-.data.frame : not a generic
dir : not a generic
dir.create : not a generic
dir.exists : not a generic
dirname : not a generic
do.call : not a generic
dontCheck : failed
double : not a generic
dput : not a generic
dQuote : not a generic
drop : not a generic
droplevels : not a generic
droplevels.data.frame : not a generic
droplevels.factor : not a generic
dump : not a generic
duplicated : not a generic
duplicated.array : not a generic
duplicated.data.frame : not a generic
duplicated.default : not a generic
duplicated.matrix : not a generic
duplicated.numeric_version : not a generic
duplicated.POSIXlt : not a generic
duplicated.warnings : not a generic
dyn.load : not a generic
dyn.unload : not a generic
dynGet : not a generic
eapply : not a generic
eigen : not a generic
emptyenv : failed
enc2native : failed
enc2utf8 : failed
encodeString : not a generic
Encoding : not a generic
Encoding<- : not a generic
endsWith : not a generic
enquote : not a generic
env.profile : not a generic
environment : not a generic
environment<- : failed
environmentIsLocked : not a generic
environmentName : not a generic
eval : not a generic
eval.parent : not a generic
evalq : not a generic
exists : not a generic
exp : failed
expand.grid : not a generic
expm1 : failed
expression : failed
extSoftVersion : not a generic
F : not a function
factor : not a generic
factorial : not a generic
fifo : not a generic
file : not a generic
file.access : not a generic
file.append : not a generic
file.choose : not a generic
file.copy : not a generic
file.create : not a generic
file.exists : not a generic
file.info : not a generic
file.link : not a generic
file.mode : not a generic
file.mtime : not a generic
file.path : not a generic
file.remove : not a generic
file.rename : not a generic
file.show : not a generic
file.size : not a generic
file.symlink : not a generic
Filter : not a generic
Find : not a generic
find.package : not a generic
findInterval : not a generic
findPackageEnv : not a generic
findRestart : not a generic
floor : failed
flush : not a generic
flush.connection : not a generic
for : failed
force : failed
forceAndCall : failed
formals : not a generic
formals<- : not a generic
format : not a generic
format.AsIs : not a generic
format.data.frame : not a generic
format.Date : not a generic
format.default : not a generic
format.difftime : not a generic
format.factor : not a generic
format.hexmode : not a generic
format.info : not a generic
format.libraryIQR : not a generic
format.numeric_version : not a generic
format.octmode : not a generic
format.packageInfo : not a generic
format.POSIXct : not a generic
format.POSIXlt : not a generic
format.pval : not a generic
format.summaryDefault : not a generic
formatC : not a generic
formatDL : not a generic
forwardsolve : not a generic
function : failed
gamma : failed
gc : not a generic
gc.time : failed
gcinfo : not a generic
gctorture : not a generic
gctorture2 : not a generic
get : not a generic
get0 : not a generic
getAllConnections : not a generic
getCallingDLL : not a generic
getCallingDLLe : not a generic
getConnection : not a generic
getDLLRegisteredRoutines : not a generic
getDLLRegisteredRoutines.character : not a generic
getDLLRegisteredRoutines.DLLInfo : not a generic
getElement : not a generic
geterrmessage : not a generic
getExportedValue : not a generic
getHook : not a generic
getLoadedDLLs : not a generic
getNamespace : not a generic
getNamespaceExports : not a generic
getNamespaceImports : not a generic
getNamespaceInfo : not a generic
getNamespaceName : not a generic
getNamespaceUsers : not a generic
getNamespaceVersion : not a generic
getNativeSymbolInfo : not a generic
getOption : not a generic
getRversion : not a generic
getSrcLines : not a generic
getTaskCallbackNames : not a generic
gettext : not a generic
gettextf : not a generic
getwd : not a generic
gl : not a generic
globalenv : failed
gregexpr : not a generic
grep : not a generic
grepl : not a generic
grepRaw : not a generic
grouping : not a generic
gsub : not a generic
gzcon : not a generic
gzfile : not a generic
I : not a generic
iconv : not a generic
iconvlist : not a generic
icuGetCollate : not a generic
icuSetCollate : not a generic
identical : not a generic
identity : failed
if : failed
ifelse : not a generic
Im : failed
importIntoEnv : not a generic
inherits : not a generic
integer : not a generic
interaction : not a generic
interactive : failed
intersect : not a generic
intToBits : not a generic
intToUtf8 : not a generic
inverse.rle : not a generic
invisible : failed
invokeRestart : not a generic
invokeRestartInteractively : not a generic
is.array : failed
is.atomic : failed
is.call : failed
is.character : failed
is.complex : failed
is.data.frame : not a generic
is.double : failed
is.element : not a generic
is.environment : failed
is.expression : failed
is.factor : not a generic
is.finite : failed
is.function : failed
is.infinite : failed
is.integer : failed
is.language : failed
is.list : failed
is.loaded : not a generic
is.logical : failed
is.matrix : failed
is.na : failed
is.na.data.frame : not a generic
is.na.numeric_version : not a generic
is.na.POSIXlt : not a generic
is.na<- : not a generic
is.na<-.default : not a generic
is.na<-.factor : not a generic
is.na<-.numeric_version : not a generic
is.name : failed
is.nan : failed
is.null : failed
is.numeric : failed
is.numeric.Date : not a generic
is.numeric.difftime : not a generic
is.numeric.POSIXt : not a generic
is.numeric_version : not a generic
is.object : failed
is.ordered : not a generic
is.package_version : not a generic
is.pairlist : failed
is.primitive : not a generic
is.qr : not a generic
is.R : not a generic
is.raw : failed
is.recursive : failed
is.single : failed
is.symbol : failed
is.table : not a generic
is.unsorted : not a generic
is.vector : not a generic
isatty : not a generic
isBaseNamespace : not a generic
isdebugged : not a generic
isIncomplete : not a generic
isNamespace : not a generic
isNamespaceLoaded : not a generic
ISOdate : not a generic
ISOdatetime : not a generic
isOpen : not a generic
isRestart : not a generic
isS4 : failed
isSeekable : not a generic
isSymmetric : not a generic
isSymmetric.matrix : not a generic
isTRUE : not a generic
jitter : not a generic
julian : not a generic
julian.Date : not a generic
julian.POSIXt : not a generic
kappa : not a generic
kappa.default : not a generic
kappa.lm : not a generic
kappa.qr : not a generic
kronecker : not a generic
l10n_info : not a generic
La.svd : not a generic
La_library : not a generic
La_version : not a generic
labels : not a generic
labels.default : not a generic
lapply : not a generic
lazyLoad : not a generic
lazyLoadDBexec : not a generic
lazyLoadDBfetch : failed
lbeta : not a generic
lchoose : not a generic
length : failed
length.POSIXlt : not a generic
length<- : failed
length<-.factor : not a generic
lengths : not a generic
letters : not a function
LETTERS : not a function
levels : not a generic
levels.default : not a generic
levels<- : failed
levels<-.factor : not a generic
lfactorial : not a generic
lgamma : failed
libcurlVersion : not a generic
library : not a generic
library.dynam : not a generic
library.dynam.unload : not a generic
licence : not a generic
license : not a generic
list : not a function
list.dirs : not a generic
list.files : not a generic
list2env : not a generic
load : not a generic
loadedNamespaces : not a generic
loadingNamespaceInfo : not a generic
loadNamespace : not a generic
local : not a generic
lockBinding : not a generic
lockEnvironment : not a generic
log : failed
log10 : failed
log1p : failed
log2 : failed
logb : not a generic
logical : not a generic
lower.tri : not a generic
ls : not a generic
make.names : not a generic
make.unique : not a generic
makeActiveBinding : not a generic
Map : not a generic
mapply : not a generic
margin.table : not a generic
mat.or.vec : not a generic
match : not a generic
match.arg : not a generic
match.call : not a generic
match.fun : not a generic
Math.data.frame : not a generic
Math.Date : not a generic
Math.difftime : not a generic
Math.factor : not a generic
Math.POSIXt : not a generic
matrix : not a generic
max : failed
max.col : not a generic
mean : not a generic
mean.Date : not a generic
mean.default : not a generic
mean.difftime : not a generic
mean.POSIXct : not a generic
mean.POSIXlt : not a generic
mem.limits : not a generic
memCompress : not a generic
memDecompress : not a generic
memory.profile : not a generic
merge : not a generic
merge.data.frame : not a generic
merge.default : not a generic
message : not a generic
mget : not a generic
min : failed
missing : failed
Mod : failed
mode : not a generic
mode<- : not a generic
month.abb : not a function
month.name : not a function
months : not a generic
months.Date : not a generic
months.POSIXt : not a generic
mostattributes<- : not a generic
names : failed
names.POSIXlt : not a generic
names<- : failed
names<-.POSIXlt : not a generic
namespaceExport : not a generic
namespaceImport : not a generic
namespaceImportClasses : not a generic
namespaceImportFrom : not a generic
namespaceImportMethods : not a generic
nargs : failed
nchar : not a generic
ncol : not a generic
NCOL : not a generic
Negate : not a generic
new.env : not a generic
next : failed
NextMethod : not a generic
ngettext : not a generic
nlevels : not a generic
noquote : not a generic
norm : not a generic
normalizePath : not a generic
nrow : not a generic
NROW : not a generic
numeric : not a generic
numeric_version : not a generic
nzchar : failed
objects : not a generic
oldClass : failed
oldClass<- : failed
OlsonNames : not a generic
on.exit : failed
open : not a generic
open.connection : not a generic
open.srcfile : not a generic
open.srcfilealias : not a generic
open.srcfilecopy : not a generic
Ops.data.frame : not a generic
Ops.Date : not a generic
Ops.difftime : not a generic
Ops.factor : not a generic
Ops.numeric_version : not a generic
Ops.ordered : not a generic
Ops.POSIXt : not a generic
options : not a generic
order : not a generic
ordered : not a generic
outer : not a generic
package_version : not a generic
packageEvent : not a generic
packageHasNamespace : not a generic
packageStartupMessage : not a generic
packBits : not a generic
pairlist : not a generic
parent.env : not a generic
parent.env<- : not a generic
parent.frame : not a generic
parse : not a generic
parseNamespaceFile : not a generic
paste : not a generic
paste0 : not a generic
path.expand : not a generic
path.package : not a generic
pcre_config : not a generic
pi : not a function
pipe : not a generic
pmatch : not a generic
pmax : not a generic
pmax.int : not a generic
pmin : not a generic
pmin.int : not a generic
polyroot : not a generic
pos.to.env : failed
Position : not a generic
pretty : not a generic
pretty.default : not a generic
prettyNum : not a generic
print : not a generic
print.AsIs : not a generic
print.by : not a generic
print.condition : not a generic
print.connection : not a generic
print.data.frame : not a generic
print.Date : not a generic
print.default : not a generic
print.difftime : not a generic
print.Dlist : not a generic
print.DLLInfo : not a generic
print.DLLInfoList : not a generic
print.DLLRegisteredRoutines : not a generic
print.eigen : not a generic
print.factor : not a generic
print.function : not a generic
print.hexmode : not a generic
print.libraryIQR : not a generic
print.listof : not a generic
print.NativeRoutineList : not a generic
print.noquote : not a generic
print.numeric_version : not a generic
print.octmode : not a generic
print.packageInfo : not a generic
print.POSIXct : not a generic
print.POSIXlt : not a generic
print.proc_time : not a generic
print.restart : not a generic
print.rle : not a generic
print.simple.list : not a generic
print.srcfile : not a generic
print.srcref : not a generic
print.summary.table : not a generic
print.summaryDefault : not a generic
print.table : not a generic
print.warnings : not a generic
prmatrix : not a generic
proc.time : failed
prod : failed
prop.table : not a generic
provideDimnames : not a generic
psigamma : not a generic
pushBack : not a generic
pushBackLength : not a generic
q : not a generic
qr : not a generic
qr.coef : not a generic
qr.default : not a generic
qr.fitted : not a generic
qr.Q : not a generic
qr.qty : not a generic
qr.qy : not a generic
qr.R : not a generic
qr.resid : not a generic
qr.solve : not a generic
qr.X : not a generic
quarters : not a generic
quarters.Date : not a generic
quarters.POSIXt : not a generic
quit : not a generic
quote : failed
R.home : not a generic
R.version : not a function
R.Version : not a generic
R.version.string : not a function
R_system_version : not a generic
range : failed
range.default : not a generic
rank : not a generic
rapply : not a generic
raw : not a generic
rawConnection : not a generic
rawConnectionValue : not a generic
rawShift : not a generic
rawToBits : not a generic
rawToChar : not a generic
rbind : not a generic
rbind.data.frame : not a generic
rcond : not a generic
Re : failed
read.dcf : not a generic
readBin : not a generic
readChar : not a generic
readline : not a generic
readLines : not a generic
readRDS : not a generic
readRenviron : not a generic
Recall : not a generic
Reduce : not a generic
reg.finalizer : not a generic
regexec : not a generic
regexpr : not a generic
registerS3method : not a generic
registerS3methods : not a generic
regmatches : not a generic
regmatches<- : not a generic
remove : not a generic
removeTaskCallback : not a generic
rep : failed
rep.Date : not a generic
rep.factor : not a generic
rep.int : not a generic
rep.numeric_version : not a generic
rep.POSIXct : not a generic
rep.POSIXlt : not a generic
rep_len : not a generic
repeat : failed
replace : not a generic
replicate : not a generic
require : not a generic
requireNamespace : not a generic
restartDescription : not a generic
restartFormals : not a generic
retracemem : failed
return : failed
returnValue : not a generic
rev : not a generic
rev.default : not a generic
rle : not a generic
rm : not a generic
RNGkind : not a generic
RNGversion : not a generic
round : failed
round.Date : not a generic
round.POSIXt : not a generic
row : not a generic
row.names : not a generic
row.names.data.frame : not a generic
row.names.default : not a generic
row.names<- : not a generic
row.names<-.data.frame : not a generic
row.names<-.default : not a generic
rowMeans : not a generic
rownames : not a generic
rownames<- : not a generic
rowsum : not a generic
rowsum.data.frame : not a generic
rowsum.default : not a generic
rowSums : not a generic
sample : not a generic
sample.int : not a generic
sapply : not a generic
save : not a generic
save.image : not a generic
saveRDS : not a generic
scale : not a generic
scale.default : not a generic
scan : not a generic
search : not a generic
searchpaths : not a generic
seek : not a generic
seek.connection : not a generic
seq : not a generic
seq.Date : not a generic
seq.default : not a generic
seq.int : failed
seq.POSIXt : not a generic
seq_along : failed
seq_len : failed
sequence : not a generic
serialize : not a generic
set.seed : not a generic
setdiff : not a generic
setequal : not a generic
setHook : not a generic
setNamespaceInfo : not a generic
setSessionTimeLimit : not a generic
setTimeLimit : not a generic
setwd : not a generic
shell : not a generic
shell.exec : not a generic
showConnections : not a generic
shQuote : not a generic
sign : failed
signalCondition : not a generic
signif : failed
simpleCondition : not a generic
simpleError : not a generic
simpleMessage : not a generic
simpleWarning : not a generic
simplify2array : not a generic
sin : failed
single : not a generic
sinh : failed
sink : not a generic
sink.number : not a generic
sinpi : failed
slice.index : not a generic
socketConnection : not a generic
socketSelect : not a generic
solve : not a generic
solve.default : not a generic
solve.qr : not a generic
sort : not a generic
sort.default : not a generic
sort.int : not a generic
sort.list : not a generic
sort.POSIXlt : not a generic
source : not a generic
split : not a generic
split.data.frame : not a generic
split.Date : not a generic
split.default : not a generic
split.POSIXct : not a generic
split<- : not a generic
split<-.data.frame : not a generic
split<-.default : not a generic
sprintf : not a generic
sqrt : failed
sQuote : not a generic
srcfile : not a generic
srcfilealias : not a generic
srcfilecopy : not a generic
srcref : not a generic
standardGeneric : failed
startsWith : not a generic
stderr : not a generic
stdin : not a generic
stdout : not a generic
stop : not a generic
stopifnot : not a generic
storage.mode : not a generic
storage.mode<- : failed
strftime : not a generic
strptime : not a generic
strrep : not a generic
strsplit : not a generic
strtoi : not a generic
strtrim : not a generic
structure : not a generic
strwrap : not a generic
sub : not a generic
subset : not a generic
subset.data.frame : not a generic
subset.default : not a generic
subset.matrix : not a generic
substitute : failed
substr : not a generic
substr<- : not a generic
substring : not a generic
substring<- : not a generic
sum : failed
summary : not a generic
summary.connection : not a generic
summary.data.frame : not a generic
Summary.data.frame : not a generic
summary.Date : not a generic
Summary.Date : not a generic
summary.default : not a generic
Summary.difftime : not a generic
summary.factor : not a generic
Summary.factor : not a generic
summary.matrix : not a generic
Summary.numeric_version : not a generic
Summary.ordered : not a generic
summary.POSIXct : not a generic
Summary.POSIXct : not a generic
summary.POSIXlt : not a generic
Summary.POSIXlt : not a generic
summary.proc_time : not a generic
summary.srcfile : not a generic
summary.srcref : not a generic
summary.table : not a generic
suppressMessages : not a generic
suppressPackageStartupMessages : not a generic
suppressWarnings : not a generic
svd : not a generic
sweep : not a generic
switch : failed
sys.call : not a generic
sys.calls : not a generic
Sys.chmod : not a generic
Sys.Date : not a generic
sys.frame : not a generic
sys.frames : not a generic
sys.function : not a generic
Sys.getenv : not a generic
Sys.getlocale : not a generic
Sys.getpid : not a generic
Sys.glob : not a generic
Sys.info : not a generic
Sys.junction : not a generic
sys.load.image : not a generic
Sys.localeconv : not a generic
sys.nframe : not a generic
sys.on.exit : not a generic
sys.parent : not a generic
sys.parents : not a generic
Sys.readlink : not a generic
sys.save.image : not a generic
Sys.setenv : not a generic
Sys.setFileTime : not a generic
Sys.setlocale : not a generic
Sys.sleep : not a generic
sys.source : not a generic
sys.status : not a generic
Sys.time : not a generic
Sys.timezone : not a generic
Sys.umask : not a generic
Sys.unsetenv : not a generic
Sys.which : not a generic
system : not a generic
system.file : not a generic
system.time : not a generic
system2 : not a generic
t : not a generic
T : not a function
t.data.frame : not a generic
t.default : not a generic
table : not a generic
tabulate : not a generic
tan : failed
tanh : failed
tanpi : failed
tapply : not a generic
taskCallbackManager : not a generic
tcrossprod : not a generic
tempdir : not a generic
tempfile : not a generic
testPlatformEquivalence : not a generic
textConnection : not a generic
textConnectionValue : not a generic
tolower : not a generic
topenv : not a generic
toString : not a generic
toString.default : not a generic
toupper : not a generic
trace : not a generic
traceback : not a generic
tracemem : failed
tracingState : not a generic
transform : not a generic
transform.data.frame : not a generic
transform.default : not a generic
trigamma : failed
trimws : not a generic
trunc : failed
trunc.Date : not a generic
trunc.POSIXt : not a generic
truncate : not a generic
truncate.connection : not a generic
try : not a generic
tryCatch : not a generic
typeof : not a generic
unclass : failed
undebug : not a generic
union : not a generic
unique : not a generic
unique.array : not a generic
unique.data.frame : not a generic
unique.default : not a generic
unique.matrix : not a generic
unique.numeric_version : not a generic
unique.POSIXlt : not a generic
unique.warnings : not a generic
units : not a generic
units.difftime : not a generic
units<- : not a generic
units<-.difftime : not a generic
unix.time : not a generic
unlink : not a generic
unlist : not a generic
unloadNamespace : not a generic
unlockBinding : not a generic
unname : not a generic
unserialize : not a generic
unsplit : not a generic
untrace : not a generic
untracemem : failed
unz : not a generic
upper.tri : not a generic
url : not a generic
UseMethod : failed
utf8ToInt : not a generic
validEnc : not a generic
validUTF8 : not a generic
vapply : not a generic
vector : not a generic
Vectorize : not a generic
version : not a function
warning : not a generic
warnings : not a generic
weekdays : not a generic
weekdays.Date : not a generic
weekdays.POSIXt : not a generic
which : not a generic
which.max : not a generic
which.min : not a generic
while : failed
with : not a generic
with.default : not a generic
withAutoprint : not a generic
withCallingHandlers : not a generic
within : not a generic
within.data.frame : not a generic
within.list : not a generic
withRestarts : not a generic
withVisible : not a generic
write : not a generic
write.dcf : not a generic
writeBin : not a generic
writeChar : not a generic
writeLines : not a generic
xor : not a generic
xor.hexmode : not a generic
xor.octmode : not a generic
xpdrows.data.frame : not a generic
xtfrm : failed
xtfrm.AsIs : not a generic
xtfrm.Date : not a generic
xtfrm.default : not a generic
xtfrm.difftime : not a generic
xtfrm.factor : not a generic
xtfrm.numeric_version : not a generic
xtfrm.POSIXct : not a generic
xtfrm.POSIXlt : not a generic
xtfrm.Surv : not a generic
xzfile : not a generic
zapsmall : not a generic

@@ -134,7 +134,7 @@ split.lints <- function(x, f=NULL, ...) {
}

#' @export
as.data.frame.lints <- function(x, row.names = NULL, optional = FALSE, ...) {
as.data.frame.lints <- function(x, row.names = NULL, optional = FALSE, ...) { # nolint: object_name_linter. (row.names)
Copy link
Collaborator Author

@AshesITR AshesITR Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually a false negative before. row() is a function in base, but not a generic, so row.names is not a generic method.
Fun fact: row.names() is a generic so row.names.x would never lint.

@AshesITR
Copy link
Collaborator Author

@MichaelChirico Can you retry this PR?
I'm expecting less lints to disappear now, because the candidate list for generics is much cleaner (ls(baseenv()) replaced by only generics from base)

@AshesITR AshesITR added this to the 3.0.0 milestone Jul 2, 2021
R/namespace.R Outdated Show resolved Hide resolved
Copy link
Collaborator

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, but I don't see any tests? Is clean/R/clean_generics.R already included in an existing test?

@AshesITR
Copy link
Collaborator Author

AshesITR commented Jul 2, 2021

Change looks good, but I don't see any tests? Is clean/R/clean_generics.R already included in an existing test?

As the comment notes, it's tested via expect_lint_free() of dummy_packages/clean.

The associated test is
https://github.com/jimhester/lintr/blob/8cd6adde3c6f08b88fcd1a280ad276784bd4f1f4/tests/testthat/test-expect_lint.R#L57

@MichaelChirico MichaelChirico merged commit 0397cb7 into master Jul 2, 2021
@MichaelChirico MichaelChirico deleted the fix/737-generics-names branch July 2, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User-defined S3 methods & object_name_linter
3 participants