Skip to content

Unexpected indentation_linter and trailing_whitespace_linter lints for .Rtex #2013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jabenninghoff opened this issue Jul 22, 2023 · 2 comments
Labels
false-positive code that shouldn't lint, but does

Comments

@jabenninghoff
Copy link

Linting this file, adapted from https://github.com/r-lib/lintr/blob/main/tests/testthat/dummy_packages/package/vignettes/test.Rtex, generates unexpected lints:

test.Rtex:

\documentclass{article}
\usepackage{graphicx}
\title{Test}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.

%% begin.rcode test_chunk
% b <- function(x) {
%   x
% }
%
% c <- 2
%% end.rcode
% Rscript -e 'lintr::lint("test.Rtex", lintr::linters_with_defaults())' 
/Users/agamemnon/GitHub/rdev/tests/testthat/test-ci/test.Rtex:11:2: style: [indentation_linter] Indentation should be 0 spaces but is 2 spaces.
  b <- function(x) {
~^
/Users/agamemnon/GitHub/rdev/tests/testthat/test-ci/test.Rtex:14:1: style: [trailing_whitespace_linter] Trailing whitespace is superfluous.
 
^
/Users/agamemnon/GitHub/rdev/tests/testthat/test-ci/test.Rtex:15:2: style: [indentation_linter] Indentation should be 0 spaces but is 2 spaces.
  c <- 2
~^

Previous versions of lintr, including 3.0.2 did not generate indentation_linter lints, but do generate the trailing_whitespace_linter lint. I expected this test file to be lint-free.

@MichaelChirico MichaelChirico added the false-positive code that shouldn't lint, but does label Jul 25, 2023
@MichaelChirico
Copy link
Collaborator

indentation_linter() is new for 3.1.0, and was not part of 3.0.2.

@AshesITR
Copy link
Collaborator

This is a known issue with Rtex, see #1043.
You'll unfortunately have to disable indentation linter manually for .Rtex files, or altogether until we fix the underlying issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive code that shouldn't lint, but does
Projects
None yet
Development

No branches or pull requests

3 participants