Skip to content

Commit

Permalink
Update rubocop dependency to >= 0.25
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Aug 18, 2014
1 parent ee2cbe2 commit 57490fa
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 85 deletions.
104 changes: 33 additions & 71 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,98 +1,60 @@
AllCops:
Include:
- 'Gemfile'
- 'Rakefile'
- 'naught.gemspec'

# Avoid long parameter lists
ParameterLists:
Max: 4
CountKeywordArgs: true

ClassLength:
Max: 150 # TODO: Lower to 100
Metrics/BlockNesting:
Max: 2

LineLength:
Max: 90 # TODO: Lower to 80
Metrics/LineLength:
AllowURI: true
Max: 90 # TODO: Lower to 80

MethodLength:
Metrics/MethodLength:
CountComments: false
Max: 21 # TODO: Lower to 15
Max: 21 # TODO: Lower to 15

# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 2
Metrics/ParameterLists:
Max: 4
CountKeywordArgs: true

# Align with the style guide.
CollectionMethods:
Style/AccessModifierIndentation:
EnforcedStyle: outdent

Style/ClassVars:
Enabled: false

Style/CollectionMethods:
PreferredMethods:
map: 'collect'
reduce: 'inject'
find: 'detect'
find_all: 'select'

# Disable documentation checking until a class needs to be documented once
Documentation:
Style/Documentation:
Enabled: false

# Enforce Ruby 1.8-compatible hash syntax
HashSyntax:
EnforcedStyle: hash_rockets
Style/DotPosition:
EnforcedStyle: trailing

# No spaces inside hash literals
SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

# Allow dots at the end of lines
DotPosition:
Style/DoubleNegation:
Enabled: false

# Don't require magic comment at the top of every file
Encoding:
Style/EachWithObject:
Enabled: false

# Enforce outdenting of access modifiers (i.e. public, private, protected)
AccessModifierIndentation:
EnforcedStyle: outdent

EmptyLinesAroundAccessModifier:
Enabled: true

# Align ends correctly
EndAlignment:
AlignWith: variable

# Indentation of when/else
CaseIndentation:
IndentWhenRelativeTo: end
IndentOneStep: false

Lambda:
Style/Encoding:
Enabled: false

RaiseArgs:
EnforcedStyle: compact
Style/HashSyntax:
EnforcedStyle: hash_rockets

TrailingComma:
Style/Lambda:
Enabled: false

MethodName:
Style/MethodName:
Enabled: false

ClassVars:
Enabled: false
Style/RaiseArgs:
EnforcedStyle: compact

CaseEquality:
Enabled: false
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

PercentLiteralDelimiters:
PreferredDelimiters:
'%': ()
'%i': ()
'%q': ()
'%Q': ()
'%r': '{}'
'%s': ()
'%w': '[]'
'%W': '[]'
'%x': ()
Style/TrailingComma:
EnforcedStyleForMultiline: 'comma'
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ bundler_args: --without development
language: ruby
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ group :test do
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
gem 'rest-client', '~> 1.6.0', :platforms => [:jruby, :ruby_18]
gem 'rspec', '>= 2.14'
gem 'rubocop', '>= 0.23', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'rubocop', '>= 0.25', :platforms => [:ruby_19, :ruby_20, :ruby_21]
end
12 changes: 6 additions & 6 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ guard 'bundler' do
watch(/^.+\.gemspec/)
end

guard :rspec, cli: '-fs --color --order rand' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
guard :rspec, :cli => '-fs --color --order rand' do
watch(/^spec\/.+_spec\.rb$/)
watch(/^lib\/(.+)\.rb$/) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end

guard 'ctags-bundler', emacs: true, src_path: ["lib", "spec/support"] do
watch(/^(lib|spec\/support)\/.*\.rb$/)
guard 'ctags-bundler', :emacs => true, :src_path => ['lib', 'spec/support'] do
watch(%r{^(lib|spec/support)/.*\.rb$})
watch('Gemfile.lock')
end
4 changes: 2 additions & 2 deletions lib/naught/basic_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ class BasicObject < ::BasicObject
end
else
class BasicObject #:nodoc:
keep = %w[
keep = %w(
! != == __id__ __send__ equal? instance_eval instance_exec
method_missing singleton_method_added singleton_method_removed
singleton_method_undefined
]
)
instance_methods.each do |method_name|
undef_method(method_name) unless keep.include?(method_name)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/naught/null_class_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'naught/conversions'

module Naught
class NullClassBuilder
class NullClassBuilder # rubocop:disable ClassLength
# make sure this module exists
module Commands
end
Expand Down
2 changes: 1 addition & 1 deletion lib/naught/null_class_builder/commands/mimic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Mimic < Naught::NullClassBuilder::Command
def initialize(builder, class_to_mimic_or_options, options = {})
super(builder)

if Hash === class_to_mimic_or_options
if class_to_mimic_or_options.is_a?(Hash)
options = class_to_mimic_or_options.merge(options)
instance = options.fetch(:example)
@singleton_class = (class << instance; self; end)
Expand Down
2 changes: 1 addition & 1 deletion lib/naught/null_class_builder/commands/singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.get(*)
instance
end

%w[dup clone].each do |method_name|
%w(dup clone).each do |method_name|
define_method method_name do
self
end
Expand Down
2 changes: 1 addition & 1 deletion spec/naught_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def to_s
expect(TestNull.ancestors[0..2].collect(&:name)).to eq([
'TestNull',
'TestNull::Customizations',
'TestNull::GeneratedMethods'
'TestNull::GeneratedMethods',
])
end
end

0 comments on commit 57490fa

Please sign in to comment.