Skip to content

JVM BUILD file symbol help text isn't shown in help/help-all #20979

Open
@huonw

Description

@huonw

Describe the bug

There's a few "JVM shading rules" (and similar types) that set help as instructed by their ABC:

class JvmShadingRule(ABC):
"""Base class for defining JAR shading rules as valid aliases in BUILD files.
Subclasses need to provide with an `alias` and a `help` message. The `alias` represents
the name that will be used in BUILD files to instantiate the given subclass.
Set the `help` class property with a description, which will be used in `./pants help`. For the
best rendering, use soft wrapping (e.g. implicit string concatenation) within paragraphs, but
hard wrapping (`\n`) to separate distinct paragraphs and/or lists.
"""
alias: ClassVar[str]
help: ClassVar[str | Callable[[], str]]

However, it seems like this isn't hooked up right: these rules are BUILD file symbols and the help isn't obeyed: for instance, for

class JvmShadingZapRule(JvmShadingRule):
alias = "shading_zap"
help = "Removes from the final artifact the occurrences of the `pattern`."

PANTS_VERSION=2.22.0.dev3 pants --backend-packages=pants.backend.experimental.java help shading_zap
`shading_zap` BUILD file symbol
-------------------------------

Signature: shading_zap(pattern: 'str') -> None

JvmShadingZapRule(pattern: 'str')

The default JvmShadingZapRule(...) text appears to just be reiterating the dataclass definition.

I think these BUILD file symbols use the doc string, not help, so potentially the example above should be formatted as something like this:

class JvmShadingZapRule(JvmShadingRule): 
    "Removes from the final artifact the occurrences of the `pattern`." 

    alias = "shading_zap" 

This appears to affect:

  • shading_keep
  • shading_relocate
  • shading_rename
  • shading_zap
  • duplicate_rule
  • jvm_exclude
  • scala_exclude

(The last three aren't JvmShadingRule subclasses but follow a similar pattern.)

Pants version

2.22.0.dev3

OS
both

Additional info

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions