From 2c0007216c8d2c16175c71b936324934624b2867 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Sat, 14 Aug 2021 16:48:33 +0300 Subject: [PATCH] Fix sub-department cop doc generation If you go to https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html, links to the second-level cops docs are broken. The last one is correct, https://docs.rubocop.org/rubocop-rspec/2.0/cops_rspec.html, while others have anchors, e.g. https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html#cops_capybara.adoc. This is probably due to `cops_docs.adoc` vs `cops_docs/` name clash. Suspect: https://docs.antora.org/antora/2.3/page/page-id/#important Ideally, we would generate `cops_rspec_capybara.adoc` instead of `cops_rspec/capybara.adoc.` Other RuboCop extensions don't seem to make use of sub-departments, and will be unaffected by this change. --- lib/rubocop/cop/documentation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rubocop/cop/documentation.rb b/lib/rubocop/cop/documentation.rb index 651bcde37c9..28e3262f43a 100644 --- a/lib/rubocop/cop/documentation.rb +++ b/lib/rubocop/cop/documentation.rb @@ -8,7 +8,7 @@ module Documentation # @api private def department_to_basename(department) - "cops_#{department.downcase}" + "cops_#{department.to_s.downcase.tr('/', '_')}" end # @api private