Re: [Bioc-devel] Interpreting BiocCheck output

2022-10-11 Thread Kern, Lori
If you are running locally,  there is also a .BiocCheck folder that 
gets created with a log that has the more specific information as well.

Cheers,


Lori Shepherd - Kern

Bioconductor Core Team

Roswell Park Comprehensive Cancer Center

Department of Biostatistics & Bioinformatics

Elm & Carlton Streets

Buffalo, New York 14263


From: Bioc-devel  on behalf of Sergio Oller 

Sent: Saturday, October 8, 2022 4:38 AM
To: bioc-devel@r-project.org 
Subject: Re: [Bioc-devel] Interpreting BiocCheck output

Hi Giulia, hi all

I often run BiocCheck::BiocCheck() on my packages and end up with errors,
warnings and notes that have not printed specific enough messages, just as
you did.

When that happens, on the same R terminal, I use:

BiocCheck::.BiocCheck$error
BiocCheck::.BiocCheck$warning
BiocCheck::.BiocCheck$note

(please note the leading dot after the double colon)

Those three lists include more specific details. Often even the file names
and line numbers where the error occurred (In my experience I've found line
numbers to not be always perfectly accurate, but it's a good enough
approximation).

There may be a better way to get that information through some BiocCheck
log or other reporting facility, but that's convenient enough for me. I
hope this helps you.

Best
Sergio


El dv., 7 d’oct. 2022, 21:49, Henrik Bengtsson 
va escriure:

> I'm throwing in another 1 cent.
>
> I agree that utils::globalVariables() is risky; since it goes in the
> root of the package code, it applies to *all* functions in the
> package, which is a bit too broad of a stroke for my taste.  The way I
> deal with false globals from non-standard evaluation (NSE), is to
> declare them a as dummy variables local to the function.  In this pl
> case, I would use:
>
> myfcn <- function() {
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   mtcars |> select(mpg, cyl) |> head(3)
> }
>
>
> ADVANCED:
>
> To avoid those dummy assignments from taking place in every call, one
> can also do:
>
> myfcn <- local({
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   function() {
> mtcars |> select(mpg, cyl) |> head(3)
>   }
> })
>
> which is also a bit cleaner, because it keeps the original function body
> as-is.
>
>
> REALLY ADVANCED:
> If you want to be fancy, you can even protect against mistakes by using:
>
> myfcn <- local({
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   ## Prevent developer mistakes
>   lapply(names(environment()), function(name, envir) {
> delayedAssign(
>   name,
>   stop(sprintf("INTERNAL ERROR: %s is not declared",
> sQuote(name)), call. = FALSE),
>   assign.env = envir
> )
>   }, envir = environment())
>
>   function() {
> mtcars |> select(mpg, cyl) |> head(3)
>   }
> })
>
> The latter would throw an error, if you actually end up using 'mpg' or
> 'cyl' in a non-NSE way.
>
> /Henrik
>
> On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan 
> wrote:
> >
> > Just my two cents, but I don’t think using `globalVariables()` is a good
> idea in a package – it’s too easy to say that R should ignore a variable
> that it should not.
> >
> > In the context of dplyr, the alternative is to `importFrom dplyr .data`
> or to use ‘standard’ evaluation, depending on circumstance
> >
> >
> > > mtcars |> as_tibble() |> filter(.data$mpg > 30)  # .data is imported,
> so known…
> > # A tibble: 4 × 11
> > mpg   cyl  disphp  dratwt  qsecvsam  gear  carb
> > 
> > 1  32.4 4  78.766  4.08  2.2   19.5 1 1 4 1
> > 2  30.4 4  75.752  4.93  1.62  18.5 1 1 4 2
> > 3  33.9 4  71.165  4.22  1.84  19.9 1 1 4 1
> > 4  30.4 4  95.1   113  3.77  1.51  16.9 1 1 5 2
> > > mtcars |> select("mpg", "cyl") |> head(3)  # `”mpg”` and `”cyl”` are
> character vectors, not symbols…
> >mpg cyl
> > Mazda RX4 21.0   6
> > Mazda RX4 Wag 21.0   6
> > Datsun 71022.8   4
> >
> > Martin
> >
> > From: Bioc-devel  on behalf of Marcel
> Ramos 
> > Date: Friday, October 7, 2022 at 3:07 PM
> > To: bioc-devel@r-project.org 
> > Subject: Re: [Bioc-devel] Interpreting BiocCheck output
> > Hi Giulia,
> >
> > Thanks for sharing.
> > I took a look at 
> > https://secure-web.cisco.com/1aXcD51cWOTTZe70tiCt6ZRCwUvekoIeEVzYUbBsmd3SAF2biL0Xz4j0btyW2apOx9duGM0EZQoqWUjmigcJoAA6b00uaxgeLzSfgilo-MrXdUTnGVGeCvVcKT0t4HKUFhFlOD5zUpUpYBVZ6yursleQv-rRmLv9jBkwAocGEPrEdGPhcdmRztaKQTX9J-

Re: [Bioc-devel] Interpreting BiocCheck output

2022-10-10 Thread Sergio Oller
Hi Giulia, hi all

I often run BiocCheck::BiocCheck() on my packages and end up with errors,
warnings and notes that have not printed specific enough messages, just as
you did.

When that happens, on the same R terminal, I use:

BiocCheck::.BiocCheck$error
BiocCheck::.BiocCheck$warning
BiocCheck::.BiocCheck$note

(please note the leading dot after the double colon)

Those three lists include more specific details. Often even the file names
and line numbers where the error occurred (In my experience I've found line
numbers to not be always perfectly accurate, but it's a good enough
approximation).

There may be a better way to get that information through some BiocCheck
log or other reporting facility, but that's convenient enough for me. I
hope this helps you.

Best
Sergio


El dv., 7 d’oct. 2022, 21:49, Henrik Bengtsson 
va escriure:

> I'm throwing in another 1 cent.
>
> I agree that utils::globalVariables() is risky; since it goes in the
> root of the package code, it applies to *all* functions in the
> package, which is a bit too broad of a stroke for my taste.  The way I
> deal with false globals from non-standard evaluation (NSE), is to
> declare them a as dummy variables local to the function.  In this pl
> case, I would use:
>
> myfcn <- function() {
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   mtcars |> select(mpg, cyl) |> head(3)
> }
>
>
> ADVANCED:
>
> To avoid those dummy assignments from taking place in every call, one
> can also do:
>
> myfcn <- local({
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   function() {
> mtcars |> select(mpg, cyl) |> head(3)
>   }
> })
>
> which is also a bit cleaner, because it keeps the original function body
> as-is.
>
>
> REALLY ADVANCED:
> If you want to be fancy, you can even protect against mistakes by using:
>
> myfcn <- local({
>   ## To please R CMD check
>   mpg <- cyl <- NULL
>
>   ## Prevent developer mistakes
>   lapply(names(environment()), function(name, envir) {
> delayedAssign(
>   name,
>   stop(sprintf("INTERNAL ERROR: %s is not declared",
> sQuote(name)), call. = FALSE),
>   assign.env = envir
> )
>   }, envir = environment())
>
>   function() {
> mtcars |> select(mpg, cyl) |> head(3)
>   }
> })
>
> The latter would throw an error, if you actually end up using 'mpg' or
> 'cyl' in a non-NSE way.
>
> /Henrik
>
> On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan 
> wrote:
> >
> > Just my two cents, but I don’t think using `globalVariables()` is a good
> idea in a package – it’s too easy to say that R should ignore a variable
> that it should not.
> >
> > In the context of dplyr, the alternative is to `importFrom dplyr .data`
> or to use ‘standard’ evaluation, depending on circumstance
> >
> >
> > > mtcars |> as_tibble() |> filter(.data$mpg > 30)  # .data is imported,
> so known…
> > # A tibble: 4 × 11
> > mpg   cyl  disphp  dratwt  qsecvsam  gear  carb
> > 
> > 1  32.4 4  78.766  4.08  2.2   19.5 1 1 4 1
> > 2  30.4 4  75.752  4.93  1.62  18.5 1 1 4 2
> > 3  33.9 4  71.165  4.22  1.84  19.9 1 1 4 1
> > 4  30.4 4  95.1   113  3.77  1.51  16.9 1 1 5 2
> > > mtcars |> select("mpg", "cyl") |> head(3)  # `”mpg”` and `”cyl”` are
> character vectors, not symbols…
> >mpg cyl
> > Mazda RX4 21.0   6
> > Mazda RX4 Wag 21.0   6
> > Datsun 71022.8   4
> >
> > Martin
> >
> > From: Bioc-devel  on behalf of Marcel
> Ramos 
> > Date: Friday, October 7, 2022 at 3:07 PM
> > To: bioc-devel@r-project.org 
> > Subject: Re: [Bioc-devel] Interpreting BiocCheck output
> > Hi Giulia,
> >
> > Thanks for sharing.
> > I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad
> > you resolved the issue.
> >
> > Just a reminder, you can also use `utils::globalVariables('.')` in your
> > package for functions
> > that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`.
> >
> > Best regards,
> >
> > Marcel
> >
> >
> > On 10/6/22 4:34 AM, Giulia Pais wrote:
> > >
> > > Hi, thanks for the reply. I managed to fix the first error as it was a
> > > minor issue in the code, while for the second one I don’t have a
> > > solution since the problem appears only locally and not on Biconductor
> > > after the build.
> > >
> > > Just for refere

Re: [Bioc-devel] Interpreting BiocCheck output

2022-10-07 Thread Henrik Bengtsson
I'm throwing in another 1 cent.

I agree that utils::globalVariables() is risky; since it goes in the
root of the package code, it applies to *all* functions in the
package, which is a bit too broad of a stroke for my taste.  The way I
deal with false globals from non-standard evaluation (NSE), is to
declare them a as dummy variables local to the function.  In this
case, I would use:

myfcn <- function() {
  ## To please R CMD check
  mpg <- cyl <- NULL

  mtcars |> select(mpg, cyl) |> head(3)
}


ADVANCED:

To avoid those dummy assignments from taking place in every call, one
can also do:

myfcn <- local({
  ## To please R CMD check
  mpg <- cyl <- NULL

  function() {
mtcars |> select(mpg, cyl) |> head(3)
  }
})

which is also a bit cleaner, because it keeps the original function body as-is.


REALLY ADVANCED:
If you want to be fancy, you can even protect against mistakes by using:

myfcn <- local({
  ## To please R CMD check
  mpg <- cyl <- NULL

  ## Prevent developer mistakes
  lapply(names(environment()), function(name, envir) {
delayedAssign(
  name,
  stop(sprintf("INTERNAL ERROR: %s is not declared",
sQuote(name)), call. = FALSE),
  assign.env = envir
)
  }, envir = environment())

  function() {
mtcars |> select(mpg, cyl) |> head(3)
  }
})

The latter would throw an error, if you actually end up using 'mpg' or
'cyl' in a non-NSE way.

/Henrik

On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan  wrote:
>
> Just my two cents, but I don’t think using `globalVariables()` is a good idea 
> in a package – it’s too easy to say that R should ignore a variable that it 
> should not.
>
> In the context of dplyr, the alternative is to `importFrom dplyr .data` or to 
> use ‘standard’ evaluation, depending on circumstance
>
>
> > mtcars |> as_tibble() |> filter(.data$mpg > 30)  # .data is imported, so 
> > known…
> # A tibble: 4 × 11
> mpg   cyl  disphp  dratwt  qsecvsam  gear  carb
> 
> 1  32.4 4  78.766  4.08  2.2   19.5 1 1 4 1
> 2  30.4 4  75.752  4.93  1.62  18.5 1 1 4 2
> 3  33.9 4  71.165  4.22  1.84  19.9 1 1 4 1
> 4  30.4 4  95.1   113  3.77  1.51  16.9 1 1 5 2
> > mtcars |> select("mpg", "cyl") |> head(3)  # `”mpg”` and `”cyl”` are 
> > character vectors, not symbols…
>mpg cyl
> Mazda RX4 21.0   6
> Mazda RX4 Wag 21.0   6
> Datsun 710    22.8   4
>
> Martin
>
> From: Bioc-devel  on behalf of Marcel Ramos 
> 
> Date: Friday, October 7, 2022 at 3:07 PM
> To: bioc-devel@r-project.org 
> Subject: Re: [Bioc-devel] Interpreting BiocCheck output
> Hi Giulia,
>
> Thanks for sharing.
> I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad
> you resolved the issue.
>
> Just a reminder, you can also use `utils::globalVariables('.')` in your
> package for functions
> that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`.
>
> Best regards,
>
> Marcel
>
>
> On 10/6/22 4:34 AM, Giulia Pais wrote:
> >
> > Hi, thanks for the reply. I managed to fix the first error as it was a
> > minor issue in the code, while for the second one I don’t have a
> > solution since the problem appears only locally and not on Biconductor
> > after the build.
> >
> > Just for reference the package is ISAnalytics and the BiocCheck
> > version is the latest one.
> >
> > Thanks again,
> >
> > Giulia
> >
> > *From: *Bioc-devel  on behalf of
> > Marcel Ramos 
> > *Date: *Wednesday, 2022October5 at 23:48
> > *To: *bioc-devel@r-project.org 
> > *Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
> >
> > Hi Giulia,
> >
> > Are you using a recent version of BiocCheck?
> >
> > If so, check the bottom of the BiocCheck::BiocCheck():
> >
> > ---
> > See the .BiocCheck folder and run
> >  browseVignettes(package = 'BiocCheck')
> > for details.
> > ---
> >
> > Can you provide more details, e.g., the repository of the package?
> >
> > Thanks.
> >
> > Best regards,
> >
> > Marcel
> >
> > On 10/4/22 4:44 AM, Giulia Pais wrote:
> > > Hello,
> > > I�m having some issues in interpreting BiocCheck outputs, maybe
> > someone can tell me how to fix the issues.
> > >
> > > I�ve got 2 main issues that cause the check to fail after normal
> > CRAN check has passed:
> > >
> > >1.  I get this error message
> > >
> > > * Checking if other packages can import this one...
> &

Re: [Bioc-devel] Interpreting BiocCheck output

2022-10-07 Thread Martin Morgan
Just my two cents, but I don’t think using `globalVariables()` is a good idea 
in a package – it’s too easy to say that R should ignore a variable that it 
should not.

In the context of dplyr, the alternative is to `importFrom dplyr .data` or to 
use ‘standard’ evaluation, depending on circumstance


> mtcars |> as_tibble() |> filter(.data$mpg > 30)  # .data is imported, so 
> known…
# A tibble: 4 × 11
mpg   cyl  disphp  dratwt  qsecvsam  gear  carb

1  32.4 4  78.766  4.08  2.2   19.5 1 1 4 1
2  30.4 4  75.752  4.93  1.62  18.5 1 1 4 2
3  33.9 4  71.165  4.22  1.84  19.9 1 1 4 1
4  30.4 4  95.1   113  3.77  1.51  16.9 1 1 5 2
> mtcars |> select("mpg", "cyl") |> head(3)  # `”mpg”` and `”cyl”` are 
> character vectors, not symbols…
   mpg cyl
Mazda RX4 21.0   6
Mazda RX4 Wag 21.0   6
Datsun 71022.8   4

Martin

From: Bioc-devel  on behalf of Marcel Ramos 

Date: Friday, October 7, 2022 at 3:07 PM
To: bioc-devel@r-project.org 
Subject: Re: [Bioc-devel] Interpreting BiocCheck output
Hi Giulia,

Thanks for sharing.
I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad
you resolved the issue.

Just a reminder, you can also use `utils::globalVariables('.')` in your
package for functions
that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`.

Best regards,

Marcel


On 10/6/22 4:34 AM, Giulia Pais wrote:
>
> Hi, thanks for the reply. I managed to fix the first error as it was a
> minor issue in the code, while for the second one I don’t have a
> solution since the problem appears only locally and not on Biconductor
> after the build.
>
> Just for reference the package is ISAnalytics and the BiocCheck
> version is the latest one.
>
> Thanks again,
>
> Giulia
>
> *From: *Bioc-devel  on behalf of
> Marcel Ramos 
> *Date: *Wednesday, 2022October5 at 23:48
> *To: *bioc-devel@r-project.org 
> *Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
>
> Hi Giulia,
>
> Are you using a recent version of BiocCheck?
>
> If so, check the bottom of the BiocCheck::BiocCheck():
>
> ---
> See the .BiocCheck folder and run
>  browseVignettes(package = 'BiocCheck')
> for details.
> ---
>
> Can you provide more details, e.g., the repository of the package?
>
> Thanks.
>
> Best regards,
>
> Marcel
>
> On 10/4/22 4:44 AM, Giulia Pais wrote:
> > Hello,
> > I�m having some issues in interpreting BiocCheck outputs, maybe
> someone can tell me how to fix the issues.
> >
> > I�ve got 2 main issues that cause the check to fail after normal
> CRAN check has passed:
> >
> >1.  I get this error message
> >
> > * Checking if other packages can import this one...
> >
> >  * ERROR: Packages providing 2 object(s) used in this package
> should be imported in the NAMESPACE file, otherwise packages importing
> >
> >this package may fail.
> >
> >
> >
> > However it is nowhere mentioned which packages they are and where
> those objects are instantiated so I have no clue how to solve this one
> >
> >1.  Since previous version of the package, which built and passed
> checks without issues, I�ve been using a custom *.Rmd file placed in
> inst/rmd in the vignette to recycle the same chunk of code and
> optimizing time in phase of update (I update info only once instead of
> 4 times). Even if the package passes CRAN checks, BiocCheck errors
> telling me it can�t find this Rmd file and therefore can�t evaluate
> the chunk where it is mentioned. Any suggestion on this?
> >
> > Thanks in advance
> > Giulia
> >
> >[[alternative HTML version deleted]]
> >
> >
> > ___
> > Bioc-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/bioc-devel
> <https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel>
>
>
> This email message may contain legally privileged and/or...{{dropped:2}}
>
> ___
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
> <https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIf

Re: [Bioc-devel] Interpreting BiocCheck output

2022-10-07 Thread Marcel Ramos
Hi Giulia,

Thanks for sharing.
I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad 
you resolved the issue.

Just a reminder, you can also use `utils::globalVariables('.')` in your 
package for functions
that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`.

Best regards,

Marcel


On 10/6/22 4:34 AM, Giulia Pais wrote:
>
> Hi, thanks for the reply. I managed to fix the first error as it was a 
> minor issue in the code, while for the second one I don’t have a 
> solution since the problem appears only locally and not on Biconductor 
> after the build.
>
> Just for reference the package is ISAnalytics and the BiocCheck 
> version is the latest one.
>
> Thanks again,
>
> Giulia
>
> *From: *Bioc-devel  on behalf of 
> Marcel Ramos 
> *Date: *Wednesday, 2022October5 at 23:48
> *To: *bioc-devel@r-project.org 
> *Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
>
> Hi Giulia,
>
> Are you using a recent version of BiocCheck?
>
> If so, check the bottom of the BiocCheck::BiocCheck():
>
> ---
> See the .BiocCheck folder and run
>  browseVignettes(package = 'BiocCheck')
> for details.
> ---
>
> Can you provide more details, e.g., the repository of the package?
>
> Thanks.
>
> Best regards,
>
> Marcel
>
> On 10/4/22 4:44 AM, Giulia Pais wrote:
> > Hello,
> > I�m having some issues in interpreting BiocCheck outputs, maybe 
> someone can tell me how to fix the issues.
> >
> > I�ve got 2 main issues that cause the check to fail after normal 
> CRAN check has passed:
> >
> >    1.  I get this error message
> >
> > * Checking if other packages can import this one...
> >
> >  * ERROR: Packages providing 2 object(s) used in this package 
> should be imported in the NAMESPACE file, otherwise packages importing
> >
> >    this package may fail.
> >
> >
> >
> > However it is nowhere mentioned which packages they are and where 
> those objects are instantiated so I have no clue how to solve this one
> >
> >    1.  Since previous version of the package, which built and passed 
> checks without issues, I�ve been using a custom *.Rmd file placed in 
> inst/rmd in the vignette to recycle the same chunk of code and 
> optimizing time in phase of update (I update info only once instead of 
> 4 times). Even if the package passes CRAN checks, BiocCheck errors 
> telling me it can�t find this Rmd file and therefore can�t evaluate 
> the chunk where it is mentioned. Any suggestion on this?
> >
> > Thanks in advance
> > Giulia
> >
> >    [[alternative HTML version deleted]]
> >
> >
> > ___
> > Bioc-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/bioc-devel 
> 
>
>
> This email message may contain legally privileged and/or...{{dropped:2}}
>
> ___
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel 
> 
>

This email message may contain legally privileged and/or...{{dropped:4}}

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


[Bioc-devel] Interpreting BiocCheck output

2022-10-04 Thread Giulia Pais
Hello,
I�m having some issues in interpreting BiocCheck outputs, maybe someone can 
tell me how to fix the issues.

I�ve got 2 main issues that cause the check to fail after normal CRAN check has 
passed:

  1.  I get this error message

* Checking if other packages can import this one...

* ERROR: Packages providing 2 object(s) used in this package should be 
imported in the NAMESPACE file, otherwise packages importing

  this package may fail.



However it is nowhere mentioned which packages they are and where those objects 
are instantiated so I have no clue how to solve this one

  1.  Since previous version of the package, which built and passed checks 
without issues, I�ve been using a custom *.Rmd file placed in inst/rmd in the 
vignette to recycle the same chunk of code and optimizing time in phase of 
update (I update info only once instead of 4 times). Even if the package passes 
CRAN checks, BiocCheck errors telling me it can�t find this Rmd file and 
therefore can�t evaluate the chunk where it is mentioned. Any suggestion on 
this?

Thanks in advance
Giulia

[[alternative HTML version deleted]]

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel