Skip to content

Commit

Permalink
Update Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Sep 26, 2014
1 parent 9167a59 commit 6d14bb6
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 67 deletions.
34 changes: 19 additions & 15 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-07-23 21:41:36 -0700 using RuboCop version 0.24.1.
# on 2014-09-25 20:13:18 -0700 using RuboCop version 0.26.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -15,14 +15,28 @@ Lint/HandleExceptions:

# Offense count: 1
# Configuration parameters: CountComments.
Style/ClassLength:
Metrics/ClassLength:
Max: 324

# Offense count: 3
Style/CyclomaticComplexity:
Metrics/CyclomaticComplexity:
Max: 14

# Offense count: 81
# Offense count: 300
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 180

# Offense count: 10
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 52

# Offense count: 3
Metrics/PerceivedComplexity:
Max: 15

# Offense count: 80
Style/Documentation:
Enabled: false

Expand All @@ -36,17 +50,7 @@ Style/FileName:
Style/GuardClause:
Enabled: false

# Offense count: 273
# Configuration parameters: AllowURI.
Style/LineLength:
Max: 180

# Offense count: 10
# Configuration parameters: CountComments.
Style/MethodLength:
Max: 52

# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in ar-octopus.gemspec
gemspec
2 changes: 1 addition & 1 deletion lib/octopus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def self.setup
end

def self.environments=(environments)
@environments = environments.map { |element| element.to_s }
@environments = environments.map(&:to_s)
end

def self.environments
Expand Down
2 changes: 1 addition & 1 deletion lib/octopus/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def initialize_replication(config)
@fully_replicated = true
end

@slaves_list = @shards.keys.map { |sym| sym.to_s }.sort
@slaves_list = @shards.keys.map(&:to_s).sort
@slaves_list.delete('master')
@slaves_load_balancer = Octopus::LoadBalancing::RoundRobin.new(@slaves_list)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/octopus.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace :octopus do
desc "Copy schema version information from master to all shards"
desc 'Copy schema version information from master to all shards'
task :copy_schema_versions => :environment do
abort("Octopus is not enabled for this environment") unless Octopus.enabled?
abort('Octopus is not enabled for this environment') unless Octopus.enabled?

connection = ActiveRecord::Base.connection

Expand Down
6 changes: 3 additions & 3 deletions sample_app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ group :test do
gem 'capybara'
gem 'cucumber-rails', :require => false
gem 'launchy'
gem "rspec-rails"
gem "aruba"
gem "database_cleaner"
gem 'rspec-rails'
gem 'aruba'
gem 'database_cleaner'
end
87 changes: 43 additions & 44 deletions sample_app/lib/tasks/cucumber.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,61 @@
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.

unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gems:* tasks

unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?

vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
begin
require 'cucumber/rake/task'

begin
require 'cucumber/rake/task'
namespace :cucumber do
Cucumber::Rake::Task.new({ :ok => 'test:prepare' }, 'Run features that should pass') do |t|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
t.fork = true # You may get faster startup if you set this to false
t.profile = 'default'
end

namespace :cucumber do
Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
t.fork = true # You may get faster startup if you set this to false
t.profile = 'default'
end

Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false
t.profile = 'wip'
end
Cucumber::Rake::Task.new({ :wip => 'test:prepare' }, 'Run features that are being worked on') do |t|
t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false
t.profile = 'wip'
end

Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false
t.profile = 'rerun'
end
Cucumber::Rake::Task.new({ :rerun => 'test:prepare' }, 'Record failing features and run only them if any exist') do |t|
t.binary = vendored_cucumber_bin
t.fork = true # You may get faster startup if you set this to false
t.profile = 'rerun'
end

desc 'Run all features'
task :all => [:ok, :wip]
desc 'Run all features'
task :all => [:ok, :wip]

task :statsetup do
require 'rails/code_statistics'
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
task :statsetup do
require 'rails/code_statistics'
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features')
end
end
end
desc 'Alias for cucumber:ok'
task :cucumber => 'cucumber:ok'
desc 'Alias for cucumber:ok'
task :cucumber => 'cucumber:ok'

task :default => :cucumber
task :default => :cucumber

task :features => :cucumber do
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
end
task :features => :cucumber do
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
end

# In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
task 'test:prepare' do
end
# In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
task 'test:prepare' do
end

task :stats => 'cucumber:statsetup'
rescue LoadError
desc 'cucumber rake task not available (cucumber not installed)'
task :cucumber do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
task :stats => 'cucumber:statsetup'
rescue LoadError
desc 'cucumber rake task not available (cucumber not installed)'
task :cucumber do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
end

end

0 comments on commit 6d14bb6

Please sign in to comment.