mirror of
https://github.com/samsonjs/grape_logging.git
synced 2026-04-02 10:15:47 +00:00
AutoFix RuboCop Layout/SpaceBeforeBlockBraces
This commit is contained in:
parent
1b9aedf01e
commit
f5a1cdb6f9
5 changed files with 6 additions and 18 deletions
|
|
@ -29,18 +29,6 @@ Gemspec/RequiredRubyVersion:
|
|||
Exclude:
|
||||
- 'grape_logging.gemspec'
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
||||
# SupportedStyles: space, no_space
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceBeforeBlockBraces:
|
||||
Exclude:
|
||||
- 'lib/grape_logging/formatters/rails.rb'
|
||||
- 'lib/grape_logging/loggers/filter_parameters.rb'
|
||||
- 'lib/grape_logging/loggers/response.rb'
|
||||
- 'spec/lib/grape_logging/middleware/request_logger_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/SpaceBeforeComma:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ module GrapeLogging
|
|||
[
|
||||
"#{exception.message} (#{exception.class})",
|
||||
backtrace_array.join("\n")
|
||||
].reject{|line| line == ""}.join("\n")
|
||||
].reject {|line| line == ""}.join("\n")
|
||||
end
|
||||
|
||||
def format_hash(hash)
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ module GrapeLogging
|
|||
|
||||
def clean_parameters(parameters)
|
||||
original_encoding_map = build_encoding_map(parameters)
|
||||
params = transform_key_encoding(parameters, Hash.new{ |h, _| [Encoding::ASCII_8BIT, h] })
|
||||
cleaned_params = parameter_filter.filter(params).reject{ |key, _value| @exceptions.include?(key) }
|
||||
params = transform_key_encoding(parameters, Hash.new { |h, _| [Encoding::ASCII_8BIT, h] })
|
||||
cleaned_params = parameter_filter.filter(params).reject { |key, _value| @exceptions.include?(key) }
|
||||
transform_key_encoding(cleaned_params, original_encoding_map)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module GrapeLogging
|
|||
if response.respond_to?(:body)
|
||||
# Rack responses
|
||||
begin
|
||||
response.body.map{ |body| JSON.parse(body.to_s) }
|
||||
response.body.map { |body| JSON.parse(body.to_s) }
|
||||
rescue # No reason to have "=> e" here when we don't use it..
|
||||
response.body
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'rack'
|
|||
|
||||
describe GrapeLogging::Middleware::RequestLogger do
|
||||
let(:subject) { request.send(request_method, path) }
|
||||
let(:app) { proc{ [status, {} , ['response body']] } }
|
||||
let(:app) { proc { [status, {} , ['response body']] } }
|
||||
let(:stack) { described_class.new app, options }
|
||||
let(:request) { Rack::MockRequest.new(stack) }
|
||||
let(:options) { {include: [], logger: logger} }
|
||||
|
|
@ -49,7 +49,7 @@ describe GrapeLogging::Middleware::RequestLogger do
|
|||
end
|
||||
|
||||
context 'with a nil response' do
|
||||
let(:app) { proc{ [500, {} , nil] } }
|
||||
let(:app) { proc { [500, {} , nil] } }
|
||||
it 'should log "fail" instead of a status' do
|
||||
expect(Rack::MockResponse).to receive(:new) { nil }
|
||||
expect(logger).to receive('info') do |arguments|
|
||||
|
|
|
|||
Loading…
Reference in a new issue