Skip to content

New warning in 'designer' from object_usage_linter #1986

Closed

Description

@MichaelChirico

Haven't confirmed this is a regression yet, but we observe this warning on main that is not present on v3.0.2:

Possible bug in lintr: Couldn't parse usage message ‘<anonymous>: no visible global function definition for 'find_cache_dir'
’. Ignoring 1 usage warnings. Please report an issue at https://github.com/r-lib/lintr/issues.

Activity

  1. added this to the milestone on Jun 28, 2023
  2. MichaelChirico commented on Jun 28, 2023

    @MichaelChirico
    CollaboratorAuthor

    Similar warnings also in other packages:

    ** latrend
    Possible bug in lintr: Couldn't parse usage message ‘<anonymous>: no visible binding for global variable 'id'
    ’. Ignoring 1 usage warnings. Please report an issue at https://github.com/r-lib/lintr/issues.
    ** mlrCPO
    Possible bug in lintr: Couldn't parse usage message ‘<anonymous>: local variable 't' assigned but may not be used
    ’. Ignoring 1 usage warnings. Please report an issue at https://github.com/r-lib/lintr/issues.
    ** rextendr
    Possible bug in lintr: Couldn't parse usage message ‘<anonymous>: no visible binding for global variable 'wrap__hello_world'
    ’. Ignoring 1 usage warnings. Please report an issue at https://github.com/r-lib/lintr/issues.
    
  3. MichaelChirico commented on Jun 29, 2023

    @MichaelChirico
    CollaboratorAuthor

    Here's an MRE for the type of error that's unrecognized:

    lintr::lint(linters = lintr::object_usage_linter(), "
    foo <- function() bar()
    ")
    Warning message:
    In parse_check_usage(fun, known_used_symbols = known_used_symbols,  :
      Possible bug in lintr: Couldn't parse usage message ‘<anonymous>: no visible global function definition for 'bar'
    ’. Ignoring 1 usage warnings. Please report an issue at https://github.com/r-lib/lintr/issues.
  4. MichaelChirico commented on Jun 29, 2023

    @MichaelChirico
    CollaboratorAuthor

    c.f. the codetools::checkUsage() output:

    codetools::checkUsage({
      foo <- function() bar()
    })
    # <anonymous>: no visible global function definition for ‘bar’
    
    codetools::checkUsage({
      foo <- function() {
        bar()
      }
    })
    # <anonymous>: no visible global function definition for ‘bar’ (:3)
  5. AshesITR commented on Jun 30, 2023

    @AshesITR
    Collaborator

    Not really a regression, the old version just kept silent about the problem.

    We should try to fix this though.
    At this point I'm wondering whether it might be worthwhile to fork and fix the issues in codetools directly.

  6. MichaelChirico commented on Jun 30, 2023

    @MichaelChirico
    CollaboratorAuthor

    would you mind having a crack at a fix?

    I thought it would be as simple as making this a maybe() but I think that's having an interaction with all the other maybe()s I couldn't figure out quickly:

    line_info

  7. modified the milestones: , 3.1.1 on Jun 30, 2023
  8. AshesITR commented on Jul 1, 2023

    @AshesITR
    Collaborator

    I can take a look, do you have MWEs for all the "Couldn't parse usage message" warnings you found?

  9. added a commit that references this issue on Jul 1, 2023
    cae45d1
  10. added
    bugan unexpected problem or unintended behavior
    on Jul 1, 2023
  11. AshesITR commented on Jul 1, 2023

    @AshesITR
    Collaborator

    It was surprisingly easy to remedy - you were almost there. Just had to make the message part fit lazily.

  12. modified the milestones: 3.1.1, on Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions