Skip to content

Commit afa6e1b

Browse files
committed
Add rubocop rules to ensure spaces are applied consistently
1 parent 6623b5f commit afa6e1b

File tree

10 files changed

+34
-15
lines changed

10 files changed

+34
-15
lines changed

.rubocop.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
AllCops:
2+
TargetRubyVersion: 3.0
3+
DisabledByDefault: true
4+
SuggestExtensions: false
5+
6+
Layout/TrailingWhitespace:
7+
Enabled: true
8+
9+
Layout/TrailingEmptyLines:
10+
Enabled: true
11+
12+
Layout/SpaceAroundKeyword:
13+
Enabled: true
14+
15+
Layout/SpaceBeforeComma:
16+
Enabled: true
17+
18+
Layout/SpaceAfterComma:
19+
Enabled: true

lib/rdoc/code_object/alias.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def full_old_name
7070
# HTML id-friendly version of +#new_name+.
7171

7272
def html_name
73-
CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
73+
CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
7474
end
7575

7676
def inspect # :nodoc:

lib/rdoc/code_object/method_attr.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ def block_params=(value)
268268
when 'const_get' then 'const'
269269
when 'new' then
270270
$1.split('::').last. # ClassName => class_name
271-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
272-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
271+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
272+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
273273
downcase
274274
else
275275
$2
@@ -291,7 +291,7 @@ def block_params=(value)
291291
def html_name
292292
require 'cgi/util'
293293

294-
CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
294+
CGI.escape(@name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
295295
end
296296

297297
##

lib/rdoc/code_object/top_level.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ def inspect # :nodoc:
183183
"#<%s:0x%x %p modules: %p classes: %p>" % [
184184
self.class, object_id,
185185
base_name,
186-
@modules.map { |n,m| m },
187-
@classes.map { |n,c| c }
186+
@modules.map { |n, m| m },
187+
@classes.map { |n, c| c }
188188
]
189189
end
190190

@@ -254,8 +254,8 @@ def pretty_print q # :nodoc:
254254
q.text "base name: #{base_name.inspect}"
255255
q.breakable
256256

257-
items = @modules.map { |n,m| m }
258-
items.concat @modules.map { |n,c| c }
257+
items = @modules.map { |n, m| m }
258+
items.concat @modules.map { |n, c| c }
259259
q.seplist items do |mod| q.pp mod end
260260
end
261261
end

lib/rdoc/generator/pot/message_extractor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def extract_from_klass klass
2929
extract_text(klass.comment_location, klass.full_name)
3030

3131
klass.each_section do |section, constants, attributes|
32-
extract_text(section.title ,"#{klass.full_name}: section title")
32+
extract_text(section.title, "#{klass.full_name}: section title")
3333
section.comments.each do |comment|
3434
extract_text(comment, "#{klass.full_name}: #{section.title}")
3535
end

lib/rdoc/markup/attribute_manager.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def unmask_protected_sequences
260260

261261
def add_word_pair(start, stop, name, exclusive = false)
262262
raise ArgumentError, "Word flags may not start with '<'" if
263-
start[0,1] == '<'
263+
start[0, 1] == '<'
264264

265265
bitmap = @attributes.bitmap_for name
266266

@@ -271,7 +271,7 @@ def add_word_pair(start, stop, name, exclusive = false)
271271
@word_pair_map[pattern] = bitmap
272272
end
273273

274-
@protectable << start[0,1]
274+
@protectable << start[0, 1]
275275
@protectable.uniq!
276276

277277
@exclusive_bitmap |= bitmap if exclusive

lib/rdoc/markup/to_bs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize markup = nil
2424
def init_tags
2525
add_tag :BOLD, '+b', '-b'
2626
add_tag :EM, '+_', '-_'
27-
add_tag :TT, '' , '' # we need in_tt information maintained
27+
add_tag :TT, '', '' # we need in_tt information maintained
2828
end
2929

3030
##

lib/rdoc/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def parse argv
683683
684684
EOF
685685

686-
parsers = Hash.new { |h,parser| h[parser] = [] }
686+
parsers = Hash.new { |h, parser| h[parser] = [] }
687687

688688
RDoc::Parser.parsers.each do |regexp, parser|
689689
parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source

lib/rdoc/parser/c.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def do_constants
440440
# Scans #content for rb_include_module
441441

442442
def do_includes
443-
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
443+
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c, m|
444444
next unless cls = @classes[c]
445445
m = @known_classes[m] || m
446446

lib/rdoc/parser/changelog.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class << self; prepend Git; end
193193

194194
entries << [entry_name, entry_body] if entry_name
195195

196-
entries.reject! do |(entry,_)|
196+
entries.reject! do |(entry, _)|
197197
entry == nil
198198
end
199199

0 commit comments

Comments
 (0)