79794776

Date: 2025-10-20 10:03:00
Score: 2.5
Natty:
Report link

Just posting an update for anyone using a more recent version of the {lintr} package.

The with_defaults() function has been deprecated and is now linters_with_defaults().

The 'camel_case_linter' doesn't work for me, and I have to replace it with 'object_name_linter'.

My configuration also includes two common adjustments:

commented_code_linter = NULL: Disables warnings about commented-out code (useful for temporarily removing code like install.packages()).

line_length_linter(...): Increases the maximum line length to 120 characters from the default of 80 (far too narrow for the VS Code).

Regarding the file format, the .lintr file uses DCF syntax. The safest way to avoid parsing errors is to write the configuration on a single line (it can work when cut in multiple lines with tabulation but if you have a problem, put it in one line).

Working .lintr file (Single-Line)

linters: linters_with_defaults(object_name_linter = NULL, commented_code_linter = NULL, line_length_linter = line_length_linter(length = 120))

Reasons:
  • RegEx Blacklisted phrase (2): doesn't work for me
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Kristoff