Skip to content

Commit

Permalink
chore: Lint, add rubocop gems
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle authored Jan 13, 2022
1 parent 4984a26 commit 6cf5530
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

source 'https://rubygems.org'

# Specify your gem's dependencies in sidekiq-logstash.gemspec

gemspec

gem 'rubocop-rake'
gem 'rubocop-rspec'
18 changes: 9 additions & 9 deletions lib/sidekiq/logging/argument_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ def call(original_args, parents = [])
parents.push(key) if deep_regexps
if regexps.any? { |r| key =~ r }
value = FILTERED
elsif deep_regexps && (joined = parents.join('.')) && deep_regexps.any? { |r| joined =~ r }
elsif deep_regexps && (joined = parents.join('.')) && deep_regexps.any? { |r| joined =~ r } # rubocop:disable Lint/DuplicateBranch
value = FILTERED
elsif value.is_a?(Hash)
value = call(value, parents)
elsif value.is_a?(Array)
value = value.map { |v| v.is_a?(Hash) ? call(v, parents) : v }
elsif blocks.any?
key = begin
key.dup
rescue StandardError
key
end
key.dup
rescue StandardError
key
end
value = begin
value.dup
rescue StandardError
value
end
value.dup
rescue StandardError
value
end
blocks.each { |b| b.call(key, value) }
end
parents.pop if deep_regexps
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/logging/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def filter_args
def deep_stringify!(args)
case args
when Hash
Hash[args.map { |key, value| [deep_stringify!(key), deep_stringify!(value)] }]
args.map { |key, value| [deep_stringify!(key), deep_stringify!(value)] }.to_h
when Array
args.map! { |val| deep_stringify!(val) }
else
Expand Down
1 change: 1 addition & 0 deletions sidekiq-logstash.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec-json_expectations', '~> 2.1.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
spec.metadata['rubygems_mfa_required'] = 'true'
end

0 comments on commit 6cf5530

Please sign in to comment.