Skip to content
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

Incorrent line number in "Missing terminal newline" from trailing_blank_lines_linter on .Rmd #1400

Closed
russHyde opened this issue Jun 17, 2022 · 0 comments · Fixed by #1403
Closed
Assignees
Labels
bug an unexpected problem or unintended behavior

Comments

@russHyde
Copy link
Collaborator

russHyde commented Jun 17, 2022

text = '---
title: "Some file"
---

```{r}
abc = 123
```

```{r child="some-file.Rmd"}
```'
cat(text, file = "without-newline.Rmd")
cat(paste0(text, "\n"), file = "with-newline.Rmd")

Then try linting "without-newline.Rmd" and "with-newline.Rmd".

The former gives

without-newline.Rmd|6 col 10 warning| [trailing_blank_lines_linter] Missing terminal newline.

The latter is clean.

But note, that the missing-terminal-newline lint occurs on the line with the expression "abc = 123", rather than on the final line.

library(lintr)
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lintr_3.0.0

loaded via a namespace (and not attached):
 [1] ps_1.7.0        crayon_1.5.1    withr_2.5.0     rprojroot_2.0.3
 [5] R6_2.5.1        cli_3.3.0       lazyeval_0.2.2  remotes_2.4.2  
 [9] callr_3.7.0     rex_1.2.1       xml2_1.3.3      cyclocomp_1.1.0
[13] desc_1.4.1      tools_4.1.3     parallel_4.1.3  compiler_4.1.3 
[17] processx_3.5.3
@AshesITR AshesITR added the bug an unexpected problem or unintended behavior label Jun 17, 2022
@AshesITR AshesITR self-assigned this Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants