diff options
author | Stan Lo <[email protected]> | 2024-07-17 21:42:58 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-07-17 20:43:08 +0000 |
commit | 239d54dfbce0f38cf4d31fa252b4d9bd65477bac (patch) | |
tree | e45982071e39c601d1e200015d71fae2c81876f1 | |
parent | 573c2893dce90c3254bfcb496be74b652d1cae29 (diff) |
[ruby/rdoc] Improve rubocop setup
(https://github.com/ruby/rdoc/pull/1139)
* Rename rake rubocop to rake format_generated_files
* Add rubocop rules to ensure spaces are applied consistently
* Improve rubocop related CI workflows
https://github.com/ruby/rdoc/commit/27932d001c
-rw-r--r-- | lib/rdoc/code_object/alias.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/code_object/method_attr.rb | 6 | ||||
-rw-r--r-- | lib/rdoc/code_object/top_level.rb | 8 | ||||
-rw-r--r-- | lib/rdoc/generator/pot/message_extractor.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/markup/attribute_manager.rb | 4 | ||||
-rw-r--r-- | lib/rdoc/markup/to_bs.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/options.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/parser/c.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/parser/changelog.rb | 2 |
9 files changed, 15 insertions, 15 deletions
diff --git a/lib/rdoc/code_object/alias.rb b/lib/rdoc/code_object/alias.rb index 446cf9ccb4..92df7e448f 100644 --- a/lib/rdoc/code_object/alias.rb +++ b/lib/rdoc/code_object/alias.rb @@ -70,7 +70,7 @@ class RDoc::Alias < RDoc::CodeObject # HTML id-friendly version of +#new_name+. def html_name - CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '') + CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '') end def inspect # :nodoc: diff --git a/lib/rdoc/code_object/method_attr.rb b/lib/rdoc/code_object/method_attr.rb index 61ddb32f46..27e6599bc1 100644 --- a/lib/rdoc/code_object/method_attr.rb +++ b/lib/rdoc/code_object/method_attr.rb @@ -268,8 +268,8 @@ class RDoc::MethodAttr < RDoc::CodeObject when 'const_get' then 'const' when 'new' then $1.split('::').last. # ClassName => class_name - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). + gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). + gsub(/([a-z\d])([A-Z])/, '\1_\2'). downcase else $2 @@ -291,7 +291,7 @@ class RDoc::MethodAttr < RDoc::CodeObject def html_name require 'cgi/util' - CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '') + CGI.escape(@name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '') end ## diff --git a/lib/rdoc/code_object/top_level.rb b/lib/rdoc/code_object/top_level.rb index 3864f66431..b93e3802fc 100644 --- a/lib/rdoc/code_object/top_level.rb +++ b/lib/rdoc/code_object/top_level.rb @@ -183,8 +183,8 @@ class RDoc::TopLevel < RDoc::Context "#<%s:0x%x %p modules: %p classes: %p>" % [ self.class, object_id, base_name, - @modules.map { |n,m| m }, - @classes.map { |n,c| c } + @modules.map { |n, m| m }, + @classes.map { |n, c| c } ] end @@ -254,8 +254,8 @@ class RDoc::TopLevel < RDoc::Context q.text "base name: #{base_name.inspect}" q.breakable - items = @modules.map { |n,m| m } - items.concat @modules.map { |n,c| c } + items = @modules.map { |n, m| m } + items.concat @modules.map { |n, c| c } q.seplist items do |mod| q.pp mod end end end diff --git a/lib/rdoc/generator/pot/message_extractor.rb b/lib/rdoc/generator/pot/message_extractor.rb index 313dfd2dc7..4938858bdc 100644 --- a/lib/rdoc/generator/pot/message_extractor.rb +++ b/lib/rdoc/generator/pot/message_extractor.rb @@ -29,7 +29,7 @@ class RDoc::Generator::POT::MessageExtractor extract_text(klass.comment_location, klass.full_name) klass.each_section do |section, constants, attributes| - extract_text(section.title ,"#{klass.full_name}: section title") + extract_text(section.title, "#{klass.full_name}: section title") section.comments.each do |comment| extract_text(comment, "#{klass.full_name}: #{section.title}") end diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index f6eb06da95..ed014f255b 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -260,7 +260,7 @@ class RDoc::Markup::AttributeManager def add_word_pair(start, stop, name, exclusive = false) raise ArgumentError, "Word flags may not start with '<'" if - start[0,1] == '<' + start[0, 1] == '<' bitmap = @attributes.bitmap_for name @@ -271,7 +271,7 @@ class RDoc::Markup::AttributeManager @word_pair_map[pattern] = bitmap end - @protectable << start[0,1] + @protectable << start[0, 1] @protectable.uniq! @exclusive_bitmap |= bitmap if exclusive diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb index afd9d6e981..b7b73e73f7 100644 --- a/lib/rdoc/markup/to_bs.rb +++ b/lib/rdoc/markup/to_bs.rb @@ -24,7 +24,7 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc def init_tags add_tag :BOLD, '+b', '-b' add_tag :EM, '+_', '-_' - add_tag :TT, '' , '' # we need in_tt information maintained + add_tag :TT, '', '' # we need in_tt information maintained end ## diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 7518e6cc54..c8fca4a262 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -683,7 +683,7 @@ Usage: #{opt.program_name} [options] [names...] EOF - parsers = Hash.new { |h,parser| h[parser] = [] } + parsers = Hash.new { |h, parser| h[parser] = [] } RDoc::Parser.parsers.each do |regexp, parser| parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index f8f238fd74..4050d7aa49 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -440,7 +440,7 @@ class RDoc::Parser::C < RDoc::Parser # Scans #content for rb_include_module def do_includes - @content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m| + @content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c, m| next unless cls = @classes[c] m = @known_classes[m] || m diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 4014c6eb1c..12a50f8d0e 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -193,7 +193,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser entries << [entry_name, entry_body] if entry_name - entries.reject! do |(entry,_)| + entries.reject! do |(entry, _)| entry == nil end |