Skip to content

Unclear lint message in indentation_linter() #2144

Open
@MEO265

Description

@MEO265

I think the indentation_linter() has a bug. The following code gives me the error message below on line 6.

test_that("unreachable_code_linter works in sub expressions", {
  linter <- unreachable_code_linter()
  msg <- rex::rex("Code and comments coming after a return() or stop()")

  expect_lint(
    lines,
    list(
      list(line_number = 4L, message = msg),
      list(line_number = 7L, message = msg),
      list(line_number = 10L, message = msg),
      list(line_number = 15L, message = msg)
    ),
    linter)
})

Linting gives output:

<text>:7:4: style: [indentation_linter] Hanging indent should be 14 spaces but is 4 spaces.
    lines,
   ^~~~~~~~

See also PR #2141

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions