yard icon indicating copy to clipboard operation
yard copied to clipboard

Feature request: linting / annotation-friendly format for warnings

Open ianfixes opened this issue 4 years ago • 0 comments

Yard warnings seem like a mature feature; there is an explicit --fail-on-warning option. These warnings are very helpful -- they draw attention to incorrectly-documented code.

With the advent of tools like "annotations" in GitHub or syntax highlighters in a variety of modern IDEs (i.e. the ability to provide helpful feedback attached to specific file & line numbers), I'd like to be able to receive warnings in a format explicitly intended to be machine-readable.

For example, consider the following lines from bundle exec yard on a dummy example:

[warn]: @param tag has unknown parameter name: my_bogus_parameter
    in file `lib/my_library/some_file.rb' near line 49

I'd like some command line option that would render the warnings to either the screen in this format (greppable as lines starting with [warn]:):

[warn]:lib/my_library/some_file.rb:49:@param tag has unknown parameter name: my_bogus_parameter

Or, the option to render the warnings into a specific file on disk, in JSON or colon-separated format:

lib/my_library/some_file.rb:49:@param tag has unknown parameter name: my_bogus_parameter
{
  "warnings": [
    {
      "file": "lib/my_library/some_file.rb",
      "line": 49,
      "message": "@param tag has unknown parameter name: my_bogus_parameter"
    }
  ]
}

ianfixes avatar Mar 08 '21 02:03 ianfixes