Skip to content

require-example: Add option to not require for empty arguments #632

@bobpaw

Description

@bobpaw

Motivation

Functions that never take parameters do not need examples. However, users may wish to include examples where necessary. An example that calls a function taking no arguments could only serve to explain the return value, which should be documented by @return.

Current behavior

Always requires an @example tag for all functions. The current behavior encourages examples that equate to quux(), which are by definition unnecessary.

Desired behavior

I would like an optional argument for require-example which exempts functions that take no arguments. I'm not exactly sure of the name for the option, but presumably something like exemptNoArguments. The default of this should be false so as to not break backwards compatibility.

Alternatives considered

For now, I've simply set require-example to warn instead of error.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions