Customize R linters in VSCode

2.5k views Asked by At

I'm trying to customize the linter settings in VSCode for R but I'm a little confused.

I've checked just about every source available, from SO questions to the lintr package vingette, but I'm stumbling on an issue. It could be that since I'm not a programmer I'm just not understanding something basic but essential.

A question about line length linter 80 characters

Disable R-linting in VScode

How to change the line length preference for warnings in Diagnostics? #3

Specify linters in lintr::lint

lintr github page

Lint R code in Visual Studio

lintr v2.0.0

Using lintr

It seems like I need to create a .lintr file in the folder that my script is in. Or possibly make changes in the .lintr file in the lintr package ~lintr/R/ folder?

I guess I'm just confused on the .lintr file. I tried creating files called "lintr", ".lintr" and "ScriptName.lintr", then added the following line to it, as described in the above sources:

linters: with_defaults(line_length_linter=line_length_linter(120L))

Then I reopened the script but whatever I do, lintr continues to default to 80 spaces. I think I'm doing something wrong with the .lintr file but I'm not sure what. I also tried changing file called "lintr" in the lintr package directory, but I can't save the file because it has no extension type (though it appears to be in the Debian Control Field Format, whatever that is). Windows keeps giving me a prompt to save as "txt".

I'd appreciate any step-by-step instructions to get past this issue.

0

There are 0 answers