tests/testthat/test-lintr.R

test_that("Package Style", {
  ## For some reason these tests fail on mac.
  testthat::skip_on_os("mac")
  if (requireNamespace("lintr", quietly = TRUE)) {
    lintr::expect_lint_free(linters = list(
      a = lintr::assignment_linter,
      b = lintr::commas_linter,
      ## c = lintr::commented_code_linter,
      d = lintr::infix_spaces_linter,
      e = lintr::line_length_linter(100),
      f = lintr::no_tab_linter,
      ## g = lintr::snake_case_linter, # detects only testthat functions
      h = lintr::object_length_linter(),
      i = lintr::spaces_left_parentheses_linter,
      j = lintr::trailing_blank_lines_linter,
      k = lintr::trailing_whitespace_linter,
      l = lintr::open_curly_linter,
      m = lintr::object_name_linter(c("CamelCase", "camelCase", "dotted.case")),
      n = lintr::closed_curly_linter
    ))
  }
})

Try the modules package in your browser

Any scripts or data that you put into this service are public.

modules documentation built on Aug. 25, 2023, 5:17 p.m.