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

Correct syntax for linters option in lint() #224

Closed
jessjaco opened this issue Mar 20, 2017 · 1 comment
Closed

Correct syntax for linters option in lint() #224

jessjaco opened this issue Mar 20, 2017 · 1 comment

Comments

@jessjaco
Copy link

I'm trying to pass a list of linters I would like to use to lint. I cannot find the right syntax.

THis works:

lint('aoi.R', linters=assignment_linter)
aoi.R:8:13: style: Use <-, not =, for assignment.
values(aoi) = 1
            ^

But not this (no output, seems to be the desired syntax though):

lint('aoi.R', linters=list(assignment_linter))

This doesn't work either (multiple linters; no output):

lint('aoi.R', linters=list(assignment_linter, single_quotes_linter))

But this does:

lint('aoi.R', linters=list('assignment_linter'=assignment_linter, 'single_quotes_linter'=single_quotes_linter))
aoi.R:3:8: style: Only use double-quotes. 
source('code/constants.R')
       ^~~~~~~~~~~~~~~~~~
aoi.R:8:13: style: Use <-, not =, for assignment.
values(aoi) = 1
            ^

Is the last option correct? Seems a little long...

@jimhester
Copy link
Member

lintr needs a named list, but will now automatically name any unnamed elements, so you can pass an unnamed list.

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

No branches or pull requests

2 participants