Skip to content

Commit

Permalink
Refs #1021 - Fixes the rubocop violation 'Style/StringLiterals'
Browse files Browse the repository at this point in the history
  • Loading branch information
Panayotis Matsinopoulos authored and Panayotis Matsinopoulos committed Sep 23, 2016
1 parent e79aadd commit d12b847
Show file tree
Hide file tree
Showing 92 changed files with 1,096 additions and 1,103 deletions.
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1146,13 +1146,6 @@ Style/SpaceInsideStringInterpolation:
Style/SpecialGlobalVars:
Enabled: false

# Offense count: 1205
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Enabled: false

# Offense count: 14
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Expand Down
20 changes: 10 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
gem "cucumber-pro", "0.0.13", :group => :test
source "https://rubygems.org"
gem 'cucumber-pro', '0.0.13', :group => :test
source 'https://rubygems.org'
gemspec
load File.expand_path('../Gemfile.local', __FILE__) if File.file? File.expand_path('../Gemfile.local', __FILE__)

unless ENV['CUCUMBER_USE_RELEASED_CORE']
core_path = File.expand_path("../../cucumber-ruby-core", __FILE__)
wire_path = File.expand_path("../../cucumber-ruby-wire", __FILE__)
if File.exist?(core_path) && !ENV["cucumber_use_git_core"]
gem "cucumber-core", :path => core_path
core_path = File.expand_path('../../cucumber-ruby-core', __FILE__)
wire_path = File.expand_path('../../cucumber-ruby-wire', __FILE__)
if File.exist?(core_path) && !ENV['cucumber_use_git_core']
gem 'cucumber-core', :path => core_path
else
gem "cucumber-core", :git => "https://github.com/cucumber/cucumber-ruby-core.git"
gem 'cucumber-core', :git => 'https://github.com/cucumber/cucumber-ruby-core.git'
end

if File.exist?(wire_path) && !ENV["CUCUMBER_USE_GIT_CORE"]
gem "cucumber-wire", :path => wire_path
if File.exist?(wire_path) && !ENV['CUCUMBER_USE_GIT_CORE']
gem 'cucumber-wire', :path => wire_path
else
gem "cucumber-wire", :git => "https://github.com/cucumber/cucumber-ruby-wire.git"
gem 'cucumber-wire', :git => 'https://github.com/cucumber/cucumber-ruby-wire.git'
end
end

Expand Down
14 changes: 7 additions & 7 deletions cucumber.gemspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'cucumber'
s.version = File.read(File.expand_path("../lib/cucumber/version", __FILE__))
s.authors = ["Aslak Hellesøy", "Matt Wynne", "Steve Tooke"]
s.version = File.read(File.expand_path('../lib/cucumber/version', __FILE__))
s.authors = ["Aslak Hellesøy", 'Matt Wynne', 'Steve Tooke']
s.description = 'Behaviour Driven Development with elegance and joy'
s.summary = "cucumber-#{s.version}"
s.email = 'cukes@googlegroups.com'
s.license = 'MIT'
s.homepage = "https://cucumber.io/"
s.homepage = 'https://cucumber.io/'
s.platform = Gem::Platform::RUBY
s.required_ruby_version = ">= 1.9.3"
s.required_ruby_version = '>= 1.9.3'
s.add_dependency 'cucumber-core', '~> 2.0'
s.add_dependency 'builder', '>= 2.1.2'
s.add_dependency 'diff-lcs', '>= 1.1.3'
Expand Down Expand Up @@ -39,10 +39,10 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rack-test', '>= 0.6.1'
s.add_development_dependency 'sinatra', '>= 1.3.2'

s.rubygems_version = ">= 1.6.1"
s.rubygems_version = '>= 1.6.1'
s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.rdoc_options = ["--charset=UTF-8"]
s.require_path = "lib"
s.rdoc_options = ['--charset=UTF-8']
s.require_path = 'lib'
end
2 changes: 1 addition & 1 deletion examples/i18n/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ task :cucumber do
if examples_working?(lang)
Dir.chdir(f) do
puts "DIR: #{f}"
rake("cucumber")
rake('cucumber')
end
else
STDERR.puts %{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

When(/按(.*)键/) do |op|
if op == '加号'
@result = @calc.send "add"
@result = @calc.send 'add'
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
a.should == b
end
rescue LoadError
STDERR.puts "***** You should install matchy *****"
STDERR.puts '***** You should install matchy *****'
Then(/^I can assert that (\w+) == (\w+)$/) do |var_a, var_b|
a = instance_variable_get("@#{var_a}")
b = instance_variable_get("@#{var_b}")
Expand Down
6 changes: 3 additions & 3 deletions examples/watir/features/support/screenshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ module Screenshots
if Cucumber::OS_X
def embed_screenshot(id)
`screencapture -t png #{id}.png`
embed("#{id}.png", "image/png")
embed("#{id}.png", 'image/png')
end
elsif Cucumber::WINDOWS
# http://wtr.rubyforge.org/rdoc/classes/Watir/ScreenCapture.html
require 'watir/screen_capture'
include Watir::ScreenCapture
def embed_screenshot(id)
screen_capture("#{id}.jpg", true)
embed("#{id}.jpg", "image/jpeg")
embed("#{id}.jpg", 'image/jpeg')
end
else
# Other platforms...
def embed_screenshot(id)
STDERR.puts "Sorry - no screenshots on your platform yet."
STDERR.puts 'Sorry - no screenshots on your platform yet.'
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions features/lib/step_definitions/aruba_steps.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true
Given('a Gemfile with:') do |content|
path = File.expand_path(current_dir + "/Gemfile")
path = File.expand_path(current_dir + '/Gemfile')
write_file path, content
set_env "BUNDLE_GEMFILE", path
set_env 'BUNDLE_GEMFILE', path
end

Then(/^it should (pass|fail)$/) do |result|
Expand Down
2 changes: 1 addition & 1 deletion features/lib/step_definitions/cli_steps.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
Then(/^I should see the CLI help$/) do
expect(all_output).to include("Usage:")
expect(all_output).to include('Usage:')
end
2 changes: 1 addition & 1 deletion features/lib/step_definitions/cucumber_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
end

Then(/^the stderr should contain a warning message$/) do
expect(all_stderr).to include("[warning]")
expect(all_stderr).to include('[warning]')
end

module CucumberHelper
Expand Down
2 changes: 1 addition & 1 deletion features/lib/step_definitions/language_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

Then(/^cucumber lists all the supported languages$/) do
sample_languages = ["Arabic", "български", "Pirate", "English", "日本語"]
sample_languages = ['Arabic', "български", 'Pirate', 'English', "日本語"]
sample_languages.each do |language|
expect(all_output.force_encoding('utf-8')).to include(language)
end
Expand Down
2 changes: 1 addition & 1 deletion features/lib/step_definitions/wire_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

@server = FakeWireServer.new(port.to_i, protocol)
start_wire_server if running.strip == "running"
start_wire_server if running.strip == 'running'
end

Given(/^the wire server takes (.*) seconds to respond to the invoke message$/) do |timeout|
Expand Down
6 changes: 3 additions & 3 deletions gem_tasks/contributors.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ task :contributors do
end

task :codeswarm do
sh "code_swarm --reload" rescue nil # Fails because of encoding - which we'll fix
sh "iconv -f latin1 -t utf-8 .git/.code_swarm/log.xml > tmp.xml && mv tmp.xml .git/.code_swarm/log.xml"
sh 'code_swarm --reload' rescue nil # Fails because of encoding - which we'll fix
sh 'iconv -f latin1 -t utf-8 .git/.code_swarm/log.xml > tmp.xml && mv tmp.xml .git/.code_swarm/log.xml'
sh "sed -e 's/Aslak\ Hellesøy@.BEKK.no/aslak.hellesoy@gmail.com/g' .git/.code_swarm/log.xml > tmp.xml && mv tmp.xml .git/.code_swarm/log.xml"
sh "sed -e 's/josephwilk@joesniff.co.uk/joe@josephwilk.net/g' .git/.code_swarm/log.xml > tmp.xml && mv tmp.xml .git/.code_swarm/log.xml"
sh "code_swarm"
sh 'code_swarm'
end
4 changes: 2 additions & 2 deletions gem_tasks/environment.rake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true
task :ruby_env do
RUBY_APP = if RUBY_PLATFORM =~ /java/
"jruby"
'jruby'
else
"ruby"
'ruby'
end unless defined? RUBY_APP
end
2 changes: 1 addition & 1 deletion gem_tasks/examples.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task :examples do
puts "Running #{example_dir}"
Dir.chdir(example_dir) do
raise "No Rakefile in #{Dir.pwd}" unless File.file?('Rakefile')
sh "rake cucumber"
sh 'rake cucumber'
end
end
end
2 changes: 1 addition & 1 deletion gem_tasks/fix_cr_lf.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ task :fix_cr_lf do
next if File.directory?(f) || f =~ /dos/
s = IO.read(f)
s.gsub!(/\r?\n/, "\n")
File.open(f, "w") { |io| io.write(s) }
File.open(f, 'w') { |io| io.write(s) }
end
end
4 changes: 2 additions & 2 deletions gem_tasks/flog.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
desc "Run flog over significant files"
desc 'Run flog over significant files'
task :flog do
sh "find lib/cucumber -name \\*.rb | grep -v parser\/feature\\.rb | xargs flog"
sh 'find lib/cucumber -name \\*.rb | grep -v parser/feature\\.rb | xargs flog'
end
2 changes: 1 addition & 1 deletion gem_tasks/rspec.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rspec/core/rake_task'

desc "Run RSpec"
desc 'Run RSpec'
RSpec::Core::RakeTask.new do |t|
t.verbose = true
end
20 changes: 10 additions & 10 deletions lib/autotest/cucumber_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run
end

def all_features_good
features_to_run == ""
features_to_run == ''
end

def get_to_green
Expand Down Expand Up @@ -78,20 +78,20 @@ def run_features
self.results = []
line = []
begin
open("| #{cmd}", "r") do |f|
open("| #{cmd}", 'r') do |f|
until f.eof? do
c = f.getc or break
if RUBY_VERSION >= "1.9" then
if RUBY_VERSION >= '1.9' then
print c
else
putc c
end
line << c
if c == ?\n then
self.results << if RUBY_VERSION >= "1.9" then
self.results << if RUBY_VERSION >= '1.9' then
line.join
else
line.pack "c*"
line.pack 'c*'
end
line.clear
end
Expand All @@ -111,18 +111,18 @@ def make_cucumber_cmd(features_to_run, dirty_features_filename)

profile_loader = Cucumber::Cli::ProfileLoader.new

profile ||= "autotest-all" if profile_loader.has_profile?("autotest-all") && features_to_run == :all
profile ||= "autotest" if profile_loader.has_profile?("autotest")
profile ||= 'autotest-all' if profile_loader.has_profile?('autotest-all') && features_to_run == :all
profile ||= 'autotest' if profile_loader.has_profile?('autotest')
profile ||= nil

args = if profile
["--profile", profile]
['--profile', profile]
else
%w{--format} << (features_to_run == :all ? "progress" : "pretty")
%w{--format} << (features_to_run == :all ? 'progress' : 'pretty')
end
# No --color option as some IDEs (Netbeans) don't output them very well (1 failed step)
args += %w{--format rerun --out} << dirty_features_filename
args << (features_to_run == :all ? "" : features_to_run)
args << (features_to_run == :all ? '' : features_to_run)

# Unless I do this, all the steps turn up undefined during the rerun...
unless features_to_run == :all
Expand Down
4 changes: 2 additions & 2 deletions lib/autotest/discover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Autotest.add_discovery do
if File.directory?('features')
if ENV['AUTOFEATURE'] =~ /true/i
"cucumber"
'cucumber'
elsif ENV['AUTOFEATURE'] =~ /false/i
# noop
else
puts "(Not running features. To run features in autotest, set AUTOFEATURE=true.)"
puts '(Not running features. To run features in autotest, set AUTOFEATURE=true.)'
end
end
end
2 changes: 1 addition & 1 deletion lib/cucumber/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def execute!(existing_runtime = nil)
@err.puts("Couldn't open #{e.path}")
exit_unable_to_finish
rescue FeatureFolderNotFoundException => e
@err.puts(e.message + ". You can use `cucumber --init` to get started.")
@err.puts(e.message + '. You can use `cucumber --init` to get started.')
exit_unable_to_finish
rescue ProfilesNotDefinedError, YmlLoadError, ProfileNotFound => e
@err.puts(e.message)
Expand Down
Loading

0 comments on commit d12b847

Please sign in to comment.