Module: RuboCop::Cop::Documentation

Included in:
CopsDocumentationGenerator
Defined in:
lib/rubocop/cop/documentation.rb

Overview

Helpers for builtin documentation

Class Method Summary collapse

Class Method Details

.department_to_basename(department) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
# File 'lib/rubocop/cop/documentation.rb', line 10

def department_to_basename(department)
  "cops_#{department.downcase}"
end

.url_for(cop_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


15
16
17
18
19
# File 'lib/rubocop/cop/documentation.rb', line 15

def url_for(cop_class)
  base = department_to_basename(cop_class.department)
  fragment = cop_class.cop_name.downcase.gsub(/[^a-z]/, '')
  "https://docs.rubocop.org/rubocop/#{base}.html##{fragment}"
end