Permalink
Browse files

fix rubocop 0.41.0

* Style/PreferredHashMethods: Use Hash#key? instead of Hash#has_key?
* Style/SpaceInsidePercentLiteralDelimiters: Do not use spaces inside percent literal delimiters
  • Loading branch information...
1 parent 7430ecf commit f898dd3352ef33fd809f2cd95651a60c93ea9158 @takahashim takahashim committed Jun 26, 2016
View
@@ -198,11 +198,6 @@ Style/CommentIndentation:
Style/ConstantName:
Enabled: false
-# Offense count: 4
-# Cop supports --auto-correct.
-Style/DeprecatedHashMethods:
- Enabled: false
-
# Offense count: 105
Style/Documentation:
Enabled: false
@@ -109,9 +109,9 @@ def footnote_index
end
def image(id)
- return image_index()[id] if image_index().has_key?(id)
- return icon_index()[id] if icon_index().has_key?(id)
- return numberless_image_index()[id] if numberless_image_index().has_key?(id)
+ return image_index()[id] if image_index().key?(id)
+ return icon_index()[id] if icon_index().key?(id)
+ return numberless_image_index()[id] if numberless_image_index().key?(id)
indepimage_index()[id]
end
@@ -79,9 +79,10 @@ def each(&block)
@items.each(&block)
end
- def has_key?(id)
- return @index.has_key?(id)
+ def key?(id)
+ return @index.key?(id)
end
+ alias_method :has_key?, :key?
end
@@ -54,7 +54,7 @@ def self.values
"page_metric" => ReVIEW::Book::PageMetric::A5,
"ext" => '.re',
"image_dir" => 'images',
- "image_types" => %w( .ai .psd .eps .pdf .tif .tiff .png .bmp .jpg .jpeg .gif .svg ),
+ "image_types" => %w(.ai .psd .eps .pdf .tif .tiff .png .bmp .jpg .jpeg .gif .svg),
"image_scale2width" => true, # for LaTeX
"bib_file" => "bib.re",
"colophon_order" => %w(aut csl trl dsr ill cov edt pbl contact prt),
@@ -50,7 +50,7 @@ def builder_init(no_error = false)
def builder_init_file
@warns = []
@errors = []
- @chapter.book.image_types = %w( .png .jpg .jpeg .gif .svg )
+ @chapter.book.image_types = %w(.png .jpg .jpeg .gif .svg)
@column = 0
@sec_counter = SecCounter.new(5, @chapter)
@nonum_counter = 0
@@ -18,7 +18,7 @@ def extname
def builder_init_file
@blank_seen = nil
@ul_indent = 0
- @chapter.book.image_types = %w( .png .jpg .jpeg .gif .svg )
+ @chapter.book.image_types = %w(.png .jpg .jpeg .gif .svg)
end
private :builder_init_file
@@ -107,7 +107,7 @@ def process(inf, outf)
private
- TYPES = %w( file range )
+ TYPES = %w(file range)
def preproc(f)
init_vars
@@ -161,7 +161,7 @@ def preproc(f)
end
end
- KNOWN_DIRECTIVES = %w( require provide warn ok )
+ KNOWN_DIRECTIVES = %w(require provide warn ok)
def known_directive?(op)
KNOWN_DIRECTIVES.index(op)
View
@@ -28,6 +28,16 @@ def test_footnote_index_with_escape2
assert_equal 'bar\\a\\$buz', item.content
end
+ def test_footnote_index_key?
+ fn = Book::FootnoteIndex.parse(['//footnote[foo][bar]'])
+ assert_equal true, fn.key?('foo')
+
+ ## for compatibility
+ # rubocop:disable Style/PreferredHashMethods
+ assert_equal true, fn.has_key?('foo')
+ # rubocop:enable Style/PreferredHashMethods
+ end
+
def test_HeadelineIndex
src = <<-EOB
= chap1

0 comments on commit f898dd3

Please sign in to comment.