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

Usage of = instead of <- in tests file results in error #391

Closed
mjsteinbaugh opened this issue Jul 28, 2019 · 9 comments
Closed

Usage of = instead of <- in tests file results in error #391

mjsteinbaugh opened this issue Jul 28, 2019 · 9 comments

Comments

@mjsteinbaugh
Copy link

mjsteinbaugh commented Jul 28, 2019

In case anybody accidentally uses = for assignment instead of <- in a testthat tests file, currently this error comes up in the GitHub version of the package:

Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html,  :
  Opening and ending tag mismatch: expr line 8 and equal_assign [76]
Calls: lint_package ... read_xml.character -> read_xml.raw -> doc_parse_raw
@erikcs
Copy link

erikcs commented Aug 11, 2019

This error doesn't appear with lintr installed from CRAN (but does with install_github), but am not sure which commit caused it.

@mjsteinbaugh
Copy link
Author

@erikcs Yeah I'm only seeing it with the GitHub version and not the CRAN release I think.

@erikcs
Copy link

erikcs commented Aug 12, 2019

I think this is related to #384 . I've also tried installing the github version at various commits, but always get the same doc_parse_raw error, I don't understand what else can differentiate the CRAN version.

@russHyde
Copy link
Collaborator

could you post sessionInfo() please.

@erikcs
Copy link

erikcs commented Aug 12, 2019

Here is my local sessionInfo()

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_3.6.1

(and another travis build, also with R 3.6.1 giving a doc_parse_raw error from an = in the PR)

@russHyde
Copy link
Collaborator

russHyde commented Aug 13, 2019

The test problems in #384 seem to relate to the conversion of code to/from xml (and appear to be restricted to R 3.6x). This uses two libraries: xml2 (which provides the function doc_parse_raw) and xmlparsedata (which constructs the data structure that is analysed by xml2).

The version of lintr that is present on CRAN does not use xml-encoding and so the CRAN version of the package doesn't import xml2 or xmlparsedata (yet). I suspect the problem lies either within xmlparsedata or in the code that precedes the call to xmlparsedata::xml_parse_data in get_source_expressions. (I need to investigate whether xmlparsedata tests all pass on R 3.6.1 amongst other things, to pin down this bug)

You could use R 3.5.1 if you want to use the dev version of lintr, or use the CRAN version of lintr if you definitely want R 3.6.1.

@mjsteinbaugh
Copy link
Author

Thanks @russHyde. I wrote a function named lint_dir() which I can point at either R/ or tests/testthat/ and it will tell me which file is causing the doc_parse_raw error.

@russHyde
Copy link
Collaborator

I think someone wanted to create a lint_dir function for use in an arbitrary project. Here: #217 .

@russHyde
Copy link
Collaborator

Fixed in #395

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

No branches or pull requests

3 participants