Rubocop syntax updates #2711

This commit is contained in:
Priit Tark 2015-06-26 17:06:34 +03:00
parent e46c1130db
commit 59c73fca9e
9 changed files with 33 additions and 11 deletions

View file

@ -60,6 +60,11 @@ Style/NilComparison:
Exclude: Exclude:
- 'spec/**/*' - 'spec/**/*'
# let's save space in spec
Style/AlignHash:
Exclude:
- 'spec/**/*'
# No need to force reduce to use |a, e| as parameters. # No need to force reduce to use |a, e| as parameters.
# Configuration parameters: Methods. # Configuration parameters: Methods.
Style/SingleLineBlockParams: Style/SingleLineBlockParams:
@ -90,3 +95,15 @@ Style/NumericLiterals:
# Too often suggest wrong syntax in subarray, this should be fix in rubocop first # Too often suggest wrong syntax in subarray, this should be fix in rubocop first
Style/WordArray: Style/WordArray:
Enabled: false Enabled: false
# Ok to use parallel assigment such as: var1, var2 = [], []
Style/ParallelAssignment:
Enabled: false
# not working perfectly or not important enough to care
Style/EmptyLinesAroundBlockBody:
Enabled: false
# The ABC size is a calculated magnitude, so this number can be a Fixnum or a Float.
Metrics/AbcSize:
Max: 25

View file

@ -21,7 +21,7 @@ module Registry
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = ENV['time_zone'] # NB! It should be defined, config.time_zone = ENV['time_zone'] || 'Tallinn' # NB! It should be defined,
# otherwise ActiveRecord usese other class internally. # otherwise ActiveRecord usese other class internally.
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.

View file

@ -11,6 +11,7 @@ class ActionView::Helpers::FormBuilder
content = content_or_options content = content_or_options
end end
# rubocop:disable Style/MultilineOperationIndentation
if object.class.respond_to?(:validators_on) && if object.class.respond_to?(:validators_on) &&
object.class.validators_on(method).map(&:class).include?(ActiveRecord::Validations::PresenceValidator) object.class.validators_on(method).map(&:class).include?(ActiveRecord::Validations::PresenceValidator)
@ -20,6 +21,7 @@ class ActionView::Helpers::FormBuilder
options[:class] = ((options[:class] || "") + ' required').split(' ').uniq.join(' ') options[:class] = ((options[:class] || "") + ' required').split(' ').uniq.join(' ')
end end
end end
# rubocop:enable Style/MultilineOperationIndentation
orig_label(method, content, options || {}, &block) orig_label(method, content, options || {}, &block)
end end

View file

@ -1,7 +1,6 @@
# encoding : utf-8 # encoding : utf-8
MoneyRails.configure do |config| MoneyRails.configure do |config|
# To set the default currency # To set the default currency
# #
config.default_currency = :eur config.default_currency = :eur

View file

@ -1,9 +1,9 @@
class DeviseCustomFailure < Devise::FailureApp class DeviseCustomFailure < Devise::FailureApp
def redirect_url def redirect_url
return registrant_login_url if request.original_fullpath.to_s.match(/^\/registrant/) return registrant_login_url if request.original_fullpath.to_s.match(%r{^\/registrant})
return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/) return registrar_login_url if request.original_fullpath.to_s.match(%r{^\/registrar})
return '/admin' if request.original_fullpath.to_s.match(%r{^\/admin\/que}) return '/admin' if request.original_fullpath.to_s.match(%r{^\/admin\/que})
return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/) return admin_login_url if request.original_fullpath.to_s.match(%r{^\/admin})
root_url root_url
end end

View file

@ -1,4 +1,5 @@
# rubocop: disable Style/SymbolProc # rubocop: disable Style/SymbolProc
# rubocop: disable Performance/Detect
namespace :import do namespace :import do
# README # README
# #
@ -713,4 +714,5 @@ namespace :import do
puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds" puts "-----> Imported EIS domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
end end
end end
# rubocop: enable Performance/Detect
# rubocop: enable Style/SymbolProc # rubocop: enable Style/SymbolProc

View file

@ -54,7 +54,7 @@ describe DomainMailer do
end end
it 'should render verification url' do it 'should render verification url' do
@mail.body.encoded.should =~ /registrant\/domain_update_confirms/ @mail.body.encoded.should =~ %r{registrant\/domain_update_confirms}
end end
end end
@ -109,7 +109,7 @@ describe DomainMailer do
end end
it 'should render verification url' do it 'should render verification url' do
@mail.body.encoded.should =~ /registrant\/domain_delete_con/ # somehowe delete_confirms not matching @mail.body.encoded.should =~ %r{registrant\/domain_delete_con} # somehowe delete_confirms not matching
end end
end end
end end

View file

@ -33,6 +33,7 @@ end
module Autodoc module Autodoc
class Document class Document
# rubocop:disable Metrics/AbcSize
def route_info_doc def route_info_doc
return unless example.metadata[:route_info_doc] return unless example.metadata[:route_info_doc]
route = request.env["rack.routing_args"][:route_info] route = request.env["rack.routing_args"][:route_info]
@ -56,6 +57,7 @@ module Autodoc
pretty_table(rows).join("\n") pretty_table(rows).join("\n")
end end
# rubocop:enable Metrics/AbcSize
def pretty_table(rows) def pretty_table(rows)
# longest_in_col = 0 # longest_in_col = 0