Skip to content

Add an internal affairs cop to require examples

Keeyan Nejad requested to merge cop-description-with-example into master

What does this MR do and why?

As discussed in #74 we should include good and bad examples for all cops so that we can later generate better documentation.

This MR adds that cop (extending RuboCop::Cop::InternalAffairs::CopDescription), and fixes a few examples. It also disables the cop for now. If we're happy, I'll create another issue to fix all the exceptions and enable the cop later on.

For example:

module RuboCop
  module Cop
    module Lint
      # Checks some offenses...
      #
      # @example
      #   # Good
      #   array.any?
      #
      #   # Bad
      #   !array.empty?
      class Foo < Base
      end
    end
  end
end

Merge request reports

Loading