Skip to content

Don't omit trailing non-code lines from knitr files #1403

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

Merged
merged 4 commits into from
Jun 17, 2022

Conversation

AshesITR
Copy link
Collaborator

fixes #1400

NEWS.md Outdated
@@ -5,6 +5,10 @@
* `seq_linter()` additionally lints on `1:n()` (from dplyr)
and `1:.N` (from data.table) (#1396, @IndrajeetPatil).

## Bug fixes

* `get_source_expression()` no longer omits trailing non-code lines from knitr files (#1400, @AshesITR).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_source_expressions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the affected public facing function.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean, is it a typo? i know we have an internal get_source_expression

abc = 123
```

```{r child="some-file.Rmd"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false positive lint here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also note the NA -- seems the linter name has not been picked up correctly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the test code is linted as Rmd for some reason?!
The NA should be investigated in a separate issue. Maybe we stumbled on an actual bug in the extractor code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't seem to find the issue from a quick search but AFAIK that should be related to the known issue where our logic for classifying Rmd is not the best.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #1405 for the NA issue

NEWS.md Outdated
@@ -5,6 +5,12 @@
* `seq_linter()` additionally lints on `1:n()` (from dplyr)
and `1:.N` (from data.table) (#1396, @IndrajeetPatil).

## Bug fixes

* `get_source_expression()` no longer omits trailing non-code lines from knitr files (#1400, @AshesITR).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still hoping to clarify if it's a typo -- shouldn't this have a trailing s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! Yes, it should.


# Construct an Rmd file without terminal newline
tmp3 <- withr::local_tempfile()
# TODO (@AshesITR): Remove \n escapes when #1406 is fixed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: btw I think TODO(#1406) is better in general, then you can assign yourself the issue. makes it easier in case you decide to go on hiatus & not care about the issue for a few years :)

@MichaelChirico MichaelChirico merged commit 2e89c6d into main Jun 17, 2022
@MichaelChirico MichaelChirico deleted the fix/1400-rmd-terminal-newline branch June 17, 2022 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrent line number in "Missing terminal newline" from trailing_blank_lines_linter on .Rmd
2 participants