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

'Error Retrieving Help' on rcmdcheck::rcmdcheck_process #12568

Closed
4 tasks done
HenningLorenzen-ext-bayer opened this issue Jan 13, 2023 · 12 comments
Closed
4 tasks done
Assignees
Labels

Comments

@HenningLorenzen-ext-bayer
Copy link

HenningLorenzen-ext-bayer commented Jan 13, 2023

System details

RStudio Edition : Desktop
RStudio Version : 2022.12.0+354 Elsbeth Geranium (desktop)
OS Version      : Windows 10 x64 (build 19044)
R Version       : R version 4.2.2 Patched (2023-01-10 r83603 ucrt)

Steps to reproduce the problem

Type rcmdcheck::rcmdcheck_ into R console

Describe the problem in detail

Error window

Error Retrieving Help
(TypeError) : Cannot read properties of null (reading 'rows')

image

Describe the behavior you expected

  • No error window which keeps popping up and interferes with typing code.

  • Nice to have: help on rcmdcheck_process R6 class.

  • I have read the guide for submitting good bug reports.

  • I have installed the latest version of RStudio, and confirmed that the issue still persists.

  • If I am reporting an RStudio crash, I have included a diagnostics report.

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

@HenningLorenzen-ext-bayer HenningLorenzen-ext-bayer added bug new New incoming issues, ready for initial review. labels Jan 13, 2023
@HenningLorenzen-ext-bayer
Copy link
Author

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.2 Patched (2023-01-10 r83603 ucrt)
 os       Windows 10 x64 (build 19044)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  German_Germany.utf8
 ctype    German_Germany.utf8
 tz       Europe/Berlin
 date     2023-01-13
 rstudio  2022.12.0+354 Elsbeth Geranium (desktop)
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 callr         3.7.3   2022-11-02 [1] RSPM (R 4.2.0)
 cli           3.6.0   2023-01-09 [1] RSPM
 crayon        1.5.2   2022-09-29 [1] RSPM (R 4.2.0)
 curl          4.3.3   2022-10-06 [1] RSPM (R 4.2.0)
 desc          1.4.2   2022-09-08 [1] RSPM (R 4.2.0)
 digest        0.6.31  2022-12-11 [1] RSPM
 pkgbuild      1.4.0   2022-11-27 [1] RSPM (R 4.2.0)
 prettyunits   1.1.1   2020-01-24 [1] RSPM (R 4.2.0)
 processx      3.8.0   2022-10-26 [1] RSPM (R 4.2.0)
 ps            1.7.2   2022-10-26 [1] RSPM (R 4.2.0)
 R6            2.5.1   2021-08-19 [1] RSPM (R 4.2.0)
 rcmdcheck     1.4.0   2021-09-27 [1] RSPM
 rprojroot     2.0.3   2022-04-02 [1] RSPM (R 4.2.0)
 rstudioapi    0.14    2022-08-22 [1] RSPM
 sessioninfo   1.2.2   2021-12-06 [1] RSPM
 withr         2.5.0   2022-03-03 [1] RSPM (R 4.2.0)
 xopen         1.0.0   2018-09-17 [1] RSPM

@dbrookeUAB
Copy link

dbrookeUAB commented Jan 17, 2023

Same problem. It happens while using autocomplete to preview package functions (e.g. ggplot2::<tab>). I uploaded an example gif that shows what it looks like. It's only for some packages, and it's only triggered when a specific function is highlighted.
error

@HenningLorenzen-ext-bayer
Copy link
Author

RStudio_Completion_Error

@romainfrancois
Copy link
Contributor

It looks like rcmdcheck:: rcmdcheck _process is not a function but rather an R6 class, and so the Arguments section looks different than what we'd typically get from a function:

https://github.com/r-lib/rcmdcheck/blob/a38200c997f58478c8d3e2c4d2dd5e6244dabcba/R/background.R#L28-L40

so I think the play is to make HelpInfo.java more forgiving here:

parseArguments() assumes that there is a <table> :

private void parseArguments(HashMap<String, String> args,
Element heading)
{
Element table = findArgumentTable(heading);
assert table != null : "Unexpected help format, no argblock table found";
TableElement t = (TableElement) table;
NodeList<TableRowElement> rows = t.getRows();
for (int i = 0; i < rows.getLength(); i++)
{
TableRowElement row = rows.getItem(i);
NodeList<TableCellElement> cells = row.getCells();
TableCellElement argNameCell = cells.getItem(0);
TableCellElement argValueCell = cells.getItem(1);
String argNameText = argNameCell.getInnerText();
String argValueHtml = argValueCell.getInnerHTML();
// argNameCell may be multiple comma-delimited arguments;
// split them up if necessary (duplicate the help across args)
String[] argNameTextSplat = argNameText.split("\\s*,\\s*");
for (int j = 0; j < argNameTextSplat.length; j++)
args.put(argNameTextSplat[j], argValueHtml);
}
}

@romainfrancois
Copy link
Contributor

romainfrancois commented Feb 7, 2023

In the case of limma::anova.<...> method, the Arguments section is also manually generated with a \section{Arguments} rather than a \arguments https://github.com/cran/limma/blob/1b51b3a5295f9feedb72a0df97e9c3e236592464/man/anova-method.Rd#L13-L20
and this goes against what parseArguments() expects to find.

\section{Arguments}{
\describe{
  \item{\code{object}}{object of class \code{MAList}. Missing values in the M-values are not allowed.}
  \item{\code{design}}{numeric vector or single-column matrix containing the design matrix for linear model. The length of the vector or the number of rows of the matrix should agree with the number of columns of M.}
  \item{\code{ndups}}{number of duplicate spots. Each gene is printed ndups times in adjacent spots on each array.}
  \item{\code{...}}{other arguments are not used}
}
}

which gives this html:

<!-- > writeLines(.rs.getHelp("anova.MAList", "limma")$html) -->
<div class="container">

<table style="width: 100%;"><tr><td>anova.MAList-method {limma}</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>ANOVA Table - method</h2>

<h3>Description</h3>

<p>Analysis of variance method for objects of class <code>MAList</code>.
Produces an ANOVA table useful for quality assessment by decomposing between and within gene sums of squares for a series of replicate arrays.
This method produces a single ANOVA Table rather than one for each gene and is not used to identify differentially expressed genes.
</p>


<h3>Usage</h3>

<p><code>anova(object,design=NULL,ndups=2,...)</code>
</p>


<h3>Arguments</h3>


<dl>
<dt><code>object</code></dt><dd><p>object of class <code>MAList</code>. Missing values in the M-values are not allowed.</p>
</dd>
<dt><code>design</code></dt><dd><p>numeric vector or single-column matrix containing the design matrix for linear model. The length of the vector or the number of rows of the matrix should agree with the number of columns of M.</p>
</dd>
<dt><code>ndups</code></dt><dd><p>number of duplicate spots. Each gene is printed ndups times in adjacent spots on each array.</p>
</dd>
<dt><code>...</code></dt><dd><p>other arguments are not used</p>
</dd>
</dl>

@romainfrancois
Copy link
Contributor

The rendered rcmdcheck::rcmdcheck_process() help gives this, which also drifts from what HelpInfo.java expected to find.

<!-- [...] -->
<h3>Arguments</h3>


<ul>
<li> <p><code>cp</code>: A new rcmdcheck_process object.
</p>
</li>
<li> <p><code>path</code>: Path to a package tree or a package archive file. This is the
package to check.
</p>
</li>
<li> <p><code>args</code>: Command line arguments to <code style="white-space: pre;">&#8288;R CMD check&#8288;</code>.
</p>
</li>
<li> <p><code>build_args</code>: Command line arguments to <code style="white-space: pre;">&#8288;R CMD build&#8288;</code>.
</p>
</li>
<li> <p><code>check_dir</code>: Directory for the results.
</p>
</li>
<li> <p><code>libpath</code>: The library path to set for the check.
</p>
</li>
<li> <p><code>repos</code>: The <code>repos</code> option to set for the check.
This is needed for cyclic dependency checks if you use the
<code>--as-cran</code> argument. The default uses the current value.
</p>
</li>
<li> <p><code>env</code>: A named character vector, extra environment variables to
set in the check process.
</p>
</li></ul>

@romainfrancois
Copy link
Contributor

Related to #10844

@kevinushey kevinushey removed the triage label Feb 7, 2023
@kevinushey kevinushey added this to the Cherry Blossom milestone Feb 7, 2023
@ronblum ronblum added console and removed new New incoming issues, ready for initial review. console labels Feb 7, 2023
@ronblum
Copy link
Contributor

ronblum commented Feb 7, 2023

Note: This occurs in both the Console and Editor Panes. Also, this was a problem in previous releases, such as 2022.07.2+576.

@ronblum
Copy link
Contributor

ronblum commented Feb 7, 2023

Verified in RStudio Desktop 2023.03.0-daily+301 on MacOS 13.2. Tested in both Console and Source Editor, both by typing out the _ and using autocomplete.

@ronblum ronblum closed this as completed Feb 7, 2023
@klwilson23
Copy link

@ronblum I see you closed this, but what was the fix? I'm getting the same error now from autocomplete in RStudio 2023.03.0 Build 386 "Cherry Blossom" Release (3c53477, 2023-03-09) for Windows

Error in if (nchar(current) > nchars) { : missing value where TRUE/FALSE needed

@kevinushey
Copy link
Contributor

@klwilson23 the issue you're describing is different and is tracked in #12918.

@klwilson23
Copy link

klwilson23 commented Mar 28, 2023

@klwilson23 the issue you're describing is different and is tracked in #12918.

Fair enough - effectively my error looks like the .gif posted by @HenningLorenzen-ext-bayer associated with autocomplete and the object preview generating an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants