Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
changed rucop settings
Browse files Browse the repository at this point in the history
  • Loading branch information
slowjack2k committed Apr 14, 2014
1 parent 3be5b08 commit 1b247fe
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 120 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
AllCops:
Exclude:
- spec/support/*.rb

inherit_from: rubocop-todo.yml
6 changes: 3 additions & 3 deletions lib/yaoc/converter_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(to, from, converter, object_converter, is_collection, lazy_loadin
object_converter_s = Array(object_converter)
is_collection_s = Array(is_collection)

self.to_s.each_with_index do |to, index|
to_s.each_with_index do |to, index|
from_s[index] ||= to
lazy_loading_s[index] ||= false
end
Expand All @@ -28,7 +28,7 @@ def initialize(to, from, converter, object_converter, is_collection, lazy_loadin
def each
return to_enum(__callee__) unless block_given?

self.to_s.each_with_index do |to, index|
to_s.each_with_index do |to, index|
yield to, from_s[index] , converter_s[index], lazy_loading_s[index]
end
end
Expand Down Expand Up @@ -106,7 +106,7 @@ def apply_commands!
end

def converter(fetch_able, target_source = nil)
raise 'BuildCommandsNotExecuted' unless self.all_commands_applied?
fail 'BuildCommandsNotExecuted' unless self.all_commands_applied?
converter_class.new(fetch_able, fetcher, target_source || ->(attrs) { attrs })
end

Expand Down
8 changes: 4 additions & 4 deletions lib/yaoc/helper/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ def storage
end

def []=(key, value)
self.storage[key] = value
storage[key] = value
end

def [](key)
self.storage[key]
storage[key]
end

def clear!
self.storage.clear
storage.clear
end

def fetch(*args, &block)
self.storage.fetch(*args, &block)
storage.fetch(*args, &block)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/yaoc/helper/struct_hash_constructor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(params = {})
super()

params.each do |attr, value|
self.public_send("#{attr}=", value)
public_send("#{attr}=", value)
end if params
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/yaoc/helper/to_proc_delegator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def initialize(_initialisation_proc)
end

def __getobj__
unless self._initialisation_proc_loaded
unless _initialisation_proc_loaded
self._initialisation_proc_loaded = true
__setobj__(self._initialisation_proc.call)
__setobj__(_initialisation_proc.call)
end

super
Expand All @@ -34,7 +34,7 @@ def nil?
end

def _initialisation_proc_loaded?
self._initialisation_proc_loaded
_initialisation_proc_loaded
end

def _needs_conversion?
Expand Down
8 changes: 4 additions & 4 deletions lib/yaoc/many_to_one_mapper_chain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def load_first(input_object, object_to_fill = nil)
end

def load_next(input_object)
self.next_result = converter_iterator.next.load(input_object, self.next_result)
self.next_result = converter_iterator.next.load(input_object, next_result)
rescue StopIteration
raise 'ToManyInputObjects'
end
Expand All @@ -35,7 +35,7 @@ def dump_first(input_object, object_to_fill = nil)
end

def dump_next(input_object)
self.next_result = converter_iterator.next.dump(input_object, self.next_result)
self.next_result = converter_iterator.next.dump(input_object, next_result)
end

def dump_all(input_objects, object_to_fill = nil)
Expand All @@ -53,12 +53,12 @@ def converter=(new_converter)
end

def converter_iterator
@converter_iterator ||= self.converter.each
@converter_iterator ||= converter.each
end

def each_object_with_converter(input_objects)
it_input_objects = input_objects.each
it_converters = self.converter.each
it_converters = converter.each

loop do
begin
Expand Down
8 changes: 4 additions & 4 deletions lib/yaoc/mapping_to_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ def call(pre_created_object = nil)
alias_method :to_object, :call

def source_method
self.target_source.respond_to?(:call) ? :call : :new
target_source.respond_to?(:call) ? :call : :new
end

def create_target_from_class(args)
array_based_constructor = args.is_a? Array

if array_based_constructor
self.target_source.send(source_method, *args)
target_source.send(source_method, *args)
else
self.target_source.send(source_method, args)
target_source.send(source_method, args)
end
end

def fill_target_object(attribute_hash, pre_created_object)
raise 'UnexpectedStrategy' unless attribute_hash.respond_to? :each_pair
fail 'UnexpectedStrategy' unless attribute_hash.respond_to? :each_pair

attribute_hash.each_pair do |key, value|
pre_created_object.send("#{key}=", value)
Expand Down
104 changes: 7 additions & 97 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-04-14 14:31:02 +0200 using RuboCop version 0.18.1.
# on 2014-04-14 15:02:25 +0200 using RuboCop version 0.18.1.
# The point is for the user to remove these configuration records
# one by one as the offences are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -10,66 +10,25 @@
Alias:
Enabled: false

# Offence count: 4
# Offence count: 6
AmbiguousOperator:
Enabled: false

# Offence count: 120
# Cop supports --auto-correct.
Blocks:
Enabled: true

# Offence count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
BracesAroundHashParameters:
Enabled: true

# Offence count: 23
# Offence count: 28
Documentation:
Enabled: false

# Offence count: 31
# Cop supports --auto-correct.
EmptyLines:
Enabled: true

# Offence count: 1
EmptyLinesAroundAccessModifier:
Enabled: true

# Offence count: 34
# Cop supports --auto-correct.
EmptyLinesAroundBody:
Enabled: true

# Offence count: 1
FavorSprintf:
Enabled: false

# Offence count: 37
# Cop supports --auto-correct.
FinalNewline:
Enabled: true

# Offence count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
HashSyntax:
Enabled: true

# Offence count: 12
Lambda:
Enabled: false

# Offence count: 104
# Offence count: 105
LineLength:
Max: 500

# Offence count: 19
# Cop supports --auto-correct.
MethodCallParentheses:
Enabled: true
Max: 184

# Offence count: 4
# Configuration parameters: CountComments.
Expand Down Expand Up @@ -98,21 +57,10 @@ ParameterLists:
ParenthesesAsGroupedExpression:
Enabled: false

# Offence count: 13
# Cop supports --auto-correct.
RedundantSelf:
Enabled: false

# Offence count: 17
ShadowingOuterLocalVariable:
Enabled: false

# Offence count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
SignalException:
Enabled: false

# Offence count: 1
# Cop supports --auto-correct.
SpaceAfterColon:
Expand All @@ -128,50 +76,12 @@ SpaceAfterComma:
SpaceAfterNot:
Enabled: false

# Offence count: 62
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
SpaceAroundBlockBraces:
Enabled: true

# Offence count: 18
# Cop supports --auto-correct.
SpaceAroundEqualsInParameterDefault:
Enabled: true

# Offence count: 7
# Cop supports --auto-correct.
SpaceAroundOperators:
Enabled: true

# Offence count: 43
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
SpaceInsideHashLiteralBraces:
Enabled: true

# Offence count: 10
# Cop supports --auto-correct.
SpaceInsideParens:
Enabled: true

# Offence count: 242
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
StringLiterals:
Enabled: true

# Offence count: 3
# Cop supports --auto-correct.
TrailingBlankLines:
Enabled: true

# Offence count: 9
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
TrailingComma:
Enabled: true
Enabled: false

# Offence count: 4
# Offence count: 6
# Configuration parameters: ExactNameMatch, AllowPredicates, Whitelist.
TrivialAccessors:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/yaoc/mapping_base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def fetcher
mapper_as_proc = mapper.to_proc

mapper.stub(:call) do
raise 'MyException'
fail 'MyException'
end

expect(mapper).to receive(:to_convert=).ordered.with(:some_thing)
Expand Down

0 comments on commit 1b247fe

Please sign in to comment.