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

lint() output should be class c("lints", "list") for S3 dispatch #1494

Closed
MichaelChirico opened this issue Aug 5, 2022 · 1 comment · Fixed by #1641
Closed

lint() output should be class c("lints", "list") for S3 dispatch #1494

MichaelChirico opened this issue Aug 5, 2022 · 1 comment · Fixed by #1641
Labels
internals Issues related to inner workings of lintr, i.e., not user-visible

Comments

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Aug 5, 2022

I am working on something where I need to edit the line numbers of the lint() output; a natural way to do that is like so:

l <- lint(...)
l <- lapply(l, within, line_number <- line_number + 1)

But this fails because within attempts to dispatch on lints class. For now, we need to call the method explicitly:

l <- lapply(l, within.list, line_number <- line_number + 1)

We could also define a within.lints() method, but that only works for this specific case, I think the problem is more general (it will affect other generics used too process the lint() output, too).

@MichaelChirico MichaelChirico added the internals Issues related to inner workings of lintr, i.e., not user-visible label Aug 5, 2022
@MichaelChirico MichaelChirico added this to the 3.0.1 milestone Aug 5, 2022
@AshesITR
Copy link
Collaborator

AshesITR commented Aug 9, 2022

Ditto for Lint(), right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Issues related to inner workings of lintr, i.e., not user-visible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants