Skip to content

Use lint text if supported - #284

Merged
renkun-ken merged 15 commits into
REditorSupport:masterfrom
renkun-ken:lint-text
Apr 29, 2021
Merged

renkun-ken merged 15 commits into
REditorSupport:masterfrom
renkun-ken:lint-text

Conversation

@renkun-ken

@renkun-ken renkun-ken commented Jun 25, 2020 •

Copy link
Copy Markdown
Member

Close #80
Close #235
Close #238
Close #282

r-lib/lintr#503 adds a text= argument to lintr::lint to make it easier for code editors to lint a text as if it is from a filename so that lint config is kept effective.

@randy3k

randy3k commented Jun 26, 2020

Copy link
Copy Markdown
Member

LGTM except you might need to redocument. Actually do we really want to document all the internal functions? If they are not needed, perhaps it is easier to remove those documentations.

@renkun-ken

Copy link
Copy Markdown
Member Author

Since r-lib/lintr#503 is merged, we could wait for the latest lintr (probably 3.0.0) to be released, then we could import lintr (>= 3.0.0) and this PR could be merged.

@renkun-ken

renkun-ken commented Apr 4, 2021 •

Copy link
Copy Markdown
Member Author

@randy3k Since we have support for both old lintr (current release) and latest lintr with lint(text=) by checking if the text argument exists, I guess we could merge this without having to rely on the upcoming lintr >= 3.0.0?

@randy3k randy3k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am a bit hesitated to merge it. With that say, I guess it is an acceptable solution for now, just need to put a note here to remind ourselves in the future.

Comment thread R/diagnostics.R Resolved
@renkun-ken

renkun-ken commented Apr 7, 2021 •

Copy link
Copy Markdown
Member Author

The tests only work with latest lintr rather than the current CRAN release. I guess we should postpone this PR until lintr 3.0.0 is released and then we could directly import lintr 3.0.0 and do not have to detect text= like this and those test cases should work too.

Or after this languageserver release, we could put back Remotes: jimhester/lintr for its latest development version in the languageserver dev version.

@renkun-ken

Copy link
Copy Markdown
Member Author

I guess we could merge this PR into master now. The development version of lintr is required until lintr 3.0.0 is released to CRAN.

Comment thread R/diagnostics.R Outdated
# In the upcoming lintr 3.0.0, lint(text=) is supported so that
# we could supply both filename and text and the text will be
# regarded as the content of the file.
lint_text_support <- "text" %in% names(formals(lintr::lint))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we still need this for the version of lintr specified in DESCRIPTION?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now we could safely assume lintr(text=). I'll remove those checking.

@randy3k

randy3k commented Apr 29, 2021

Copy link
Copy Markdown
Member

LGTM

@renkun-ken
renkun-ken merged commit 4280b4c into REditorSupport:master Apr 29, 2021
@randy3k

randy3k commented Jun 6, 2021

Copy link
Copy Markdown
Member

I just realized that there is no roadmap for the release of new version of lintr. Perhaps we should include your original trick of checking the text parameter for now? Otherwise we won't know how much time they need to make a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants