Skip to content

Commit

Permalink
Add contribution note to cops documentation generator
Browse files Browse the repository at this point in the history
Occasionally I reviewed direct edit to cops documentation.

This is similar in intent to the following:
#11563

For source code comments, refer to the AsciiDoc documentation:
https://docs.asciidoctor.org/asciidoc/latest/comments/#comment-blocks
  • Loading branch information
koic authored and bbatsov committed Dec 17, 2023
1 parent 6239e91 commit 4843acd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/rubocop/cops_documentation_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,19 @@ def footer_for_department(department)
"\ninclude::../partials/#{filename}[]\n"
end

# rubocop:disable Metrics/MethodLength
def print_cops_of_department(department)
selected_cops = cops_of_department(department)
content = +"= #{department}\n"
content = +<<~HEADER
////
Do NOT edit this file by hand directly, as it is automatically generated.
Please make any necessary changes to the cop documentation within the source files themselves.
////
= #{department}
HEADER
selected_cops.each { |cop| content << print_cop_with_doc(cop) }
content << footer_for_department(department)
file_name = "#{docs_path}/#{department_to_basename(department)}.adoc"
Expand All @@ -262,6 +272,7 @@ def print_cops_of_department(department)
file.write("#{content.strip}\n")
end
end
# rubocop:enable Metrics/MethodLength

def print_cop_with_doc(cop) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
cop_config = config.for_cop(cop)
Expand Down

0 comments on commit 4843acd

Please sign in to comment.