Skip to content

Commit ae36f89

Browse files
committedNov 7, 2020
Fix frozen_string_literal, other Rubocop offenses
Disabled `Metrics/BlockLength`, as this would require refactoring some methods. Disabled `Gemspec/RequiredRubyVersion`.
1 parent 7af13ca commit ae36f89

21 files changed

+64
-13
lines changed
 

‎.rubocop.yml

+9
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ Metrics/LineLength:
66

77
Style/FileName:
88
Enabled: false
9+
10+
Metrics/BlockLength:
11+
Enabled: false
12+
13+
Gemspec/RequiredRubyVersion:
14+
Enabled: false
15+
16+
AllCops:
17+
NewCops: disable

‎Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
# Specify your gem's dependencies in auto_html-contrib.gemspec

‎Rakefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'rspec/core/rake_task'
35
require 'rubocop/rake_task'
46

57
RSpec::Core::RakeTask.new(:spec)
68
RuboCop::RakeTask.new
79

8-
task default: [:rubocop, :spec]
10+
task default: %i[rubocop spec]

‎auto_html-contrib.gemspec

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# coding: utf-8
1+
# frozen_string_literal: true
22

33
Gem::Specification.new do |spec|
44
spec.name = 'auto_html-contrib'
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
1818

1919
spec.add_dependency 'tag_helper', '~> 0.5'
2020

21-
spec.add_development_dependency 'bundler', '~> 1.10'
22-
spec.add_development_dependency 'rake', '~> 10.0'
21+
spec.add_development_dependency 'bundler', '~> 2.1'
22+
spec.add_development_dependency 'fakeweb', '~> 1.3'
23+
spec.add_development_dependency 'rake', '~> 13.0'
2324
spec.add_development_dependency 'rspec', '~> 3.3'
2425
spec.add_development_dependency 'rubocop', '~> 0.33'
25-
spec.add_development_dependency 'fakeweb', '~> 1.3'
2626
end

‎bin/console

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require 'bundler/setup'
45
require 'auto_html/contrib'

‎lib/auto_html-contrib.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Filters for AutoHtml
24
module AutoHtml
35
autoload :Gist, 'auto_html/gist'

‎lib/auto_html/gist.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml

‎lib/auto_html/google_maps.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml
@@ -36,17 +38,19 @@ def iframe_tag(path, map_query)
3638
scrolling: 'no',
3739
marginheight: 0,
3840
marginwidth: 0,
39-
src: path + '?' + params.join('&')) { '' }
41+
src: path + '?' + params.join('&')
42+
) { '' }
4043
end
4144

4245
def link_tag(path, map_query)
4346
params = ['f=q', 'source=embed', map_query]
4447
tag(
4548
:a,
4649
href: path + '?' + params.join('&'),
47-
style: 'color:#000;text-align:left') do
48-
'View Larger Map'
49-
end
50+
style: 'color:#000;text-align:left'
51+
) do
52+
'View Larger Map'
53+
end
5054
end
5155

5256
def map_options

‎lib/auto_html/instagram.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml
@@ -19,7 +21,8 @@ def call(text)
1921
height: @height,
2022
width: @width,
2123
frameborder: 0,
22-
scrolling: 'no') { '' }
24+
scrolling: 'no'
25+
) { '' }
2326
end
2427
end
2528

‎lib/auto_html/twitter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'uri'
24
require 'net/http'
35
require 'json'

‎lib/auto_html/vimeo.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml

‎lib/auto_html/youtube.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml

‎lib/auto_html/youtube_thumbnail.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tag_helper'
24

35
module AutoHtml

‎spec/auto_html/gist_spec.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::Gist do
46
it 'converst gist URL to gist script tag' do
57
expect(subject.call('https://gist.github.com/171027')).to eq(
68
'<script type="text/javascript" src="https://gist.github.com/171027.js">'\
7-
'</script>')
9+
'</script>'
10+
)
811
end
912

1013
it 'converst gist URL with username to gist script tag' do
1114
expect(subject.call('https://gist.github.com/toctan/654784')).to eq(
1215
'<script type="text/javascript" src="https://gist.github.com/654784.js">'\
13-
'</script>')
16+
'</script>'
17+
)
1418
end
1519
end

‎spec/auto_html/google_maps_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::GoogleMaps do

‎spec/auto_html/instagram_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::Instagram do

‎spec/auto_html/twitter_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24
require 'fakeweb'
35

‎spec/auto_html/vimeo_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::Vimeo do

‎spec/auto_html/youtube_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::YouTube do

‎spec/auto_html/youtube_thumbnail_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24

35
RSpec.describe AutoHtml::YouTubeThumbnail do

‎spec/spec_helper.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1+
# frozen_string_literal: true
2+
3+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
24
require 'auto_html-contrib'

0 commit comments

Comments
 (0)
Please sign in to comment.