HMCFletch
HMCFletch

Reputation: 1076

Remove rubocop comments from Yardoc documentation

We are using Yardoc to create the HTML documentation for a number of gems and my company's apps. We are also using Rubocop to for style guide compliance.

The issue I am running into is that we have to enable/disable some of the method metrics and those comments (# rubocop:disable Metrics/AbcSize, etc...) showing up in our documentation. Is there a plugin that removes these or some guide I can follow on creating my own?

Upvotes: 6

Views: 644

Answers (1)

sxm1972
sxm1972

Reputation: 752

To disable rubocop directives in the code from appearing in YARDOC documentation insert a newline after the comment. e.g.

# rubocop:disable Metrics/AbcSize

# Converts the object into textual markup given a specific format.
#
# @param format [Symbol] the format type, `:text` or `:html`
# @return [String] the object converted into the expected format.
def to_format(format = :html)
  # format the object
end

Upvotes: 6

Related Questions