Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecation message for "with_defaults" is misleading #1438

@russHyde

Description

@russHyde

The deprecation message for with_defaults urges users to use linters_with_defaults. For most uses, I imagine that is the correct replacement. But the deprecation causes some confusion in settings where an old-style config looked like:

linters: with_defaults(
    assignment_linter = NULL,
    undesirable_operator_linter(
      with_defaults(
        "<-" = "Use =, not <-, for assignment.",
        default = default_undesirable_operators
      )
    )
  )

Here, when lintr::lint_package() is called, two deprecation messages are printed to the console. Both suggest using linters_with_defaults in place of with_defaults. But when defining the undesirable-op list, linters_with_defaults is not the appropriate replacement for with_defaults. Here, the recommendation should be modify_defaults.

Could we modify the deprecation warning to print

Warning message:
Function with_defaults was deprecated in lintr version 3.0.0. Use linters_with_defaults or modify_defaults instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions