1

To check the code quality of my package I am using the package lintr using the command

lintr::lint_package()

and get one result that I want to ignore:

functions should have cyclomatic complexity of less than 15

How can I ignore this single "false positive" lintr result of a single lintr (cyclocomp_linter) for a file (line number range)?

Edit 1: Currently I am using this .lintr config file as a workaround (by disabling the lintr completely):

linters: with_defaults(
    cyclocomp_linter = NULL # instead of NULL I could use: cyclocomp_linter(16)
  )
R Yoda
  • 8,358
  • 2
  • 50
  • 87

1 Answers1

2

Although it doesn't solve your problem exactly, you can wrap that function with # nolint start then # nolint end to prevent any linter from flagging that function.

The syntax for preventing a specific linter from flagging a specific set of lines is currently under development - see https://github.com/jimhester/lintr/pull/660 . This will be present in the next major lintr release (3.0.0).

Russ Hyde
  • 2,154
  • 12
  • 21