Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'rake'
require 'raven'
require 'rubygems/package_task'

gemspec = eval(IO.read('sentry-raven.gemspec'))
gemspec = Gem::Specification.load(Dir['*.gemspec'].first)

Gem::PackageTask.new(gemspec).define

Expand Down
2 changes: 0 additions & 2 deletions bin/raven
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ require "raven"
require "raven/cli"
require "optparse"

options = {}

parser = OptionParser.new do |opt|
opt.banner = "Usage: raven COMMAND [OPTIONS]"
opt.separator ""
Expand Down
8 changes: 4 additions & 4 deletions lib/raven/backtrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def ==(other)
end

def inspect
"<Line:#{to_s}>"
"<Line:#{self}>"
end

private
Expand All @@ -77,16 +77,16 @@ def self.parse(ruby_backtrace, opts = {})

filters = opts[:filters] || []
filtered_lines = ruby_lines.to_a.map do |line|
filters.reduce(line) do |line, proc|
proc.call(line)
filters.reduce(line) do |nested_line, proc|
proc.call(nested_line)
end
end.compact

lines = filtered_lines.map do |unparsed_line|
Line.parse(unparsed_line)
end

instance = new(lines)
new(lines)
end

def initialize(lines)
Expand Down
4 changes: 2 additions & 2 deletions lib/raven/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def capture(options = {}, &block)

def capture_exception(exception, options = {})
send_or_skip(exception) do
if evt = Event.from_exception(exception, options)
if (evt = Event.from_exception(exception, options))
yield evt if block_given?
if configuration.async?
configuration.async.call(evt)
Expand All @@ -114,7 +114,7 @@ def capture_exception(exception, options = {})

def capture_message(message, options = {})
send_or_skip(message) do
if evt = Event.from_message(message, options)
if (evt = Event.from_message(message, options))
yield evt if block_given?
if configuration.async?
configuration.async.call(evt)
Expand Down
2 changes: 1 addition & 1 deletion lib/raven/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def self.test(dsn = nil)

logger = ::Logger.new(STDOUT)
logger.level = ::Logger::ERROR
logger.formatter = proc do |severity, datetime, progname, msg|
logger.formatter = proc do |_severity, _datetime, _progname, msg|
"-> #{msg}\n"
end

Expand Down
4 changes: 2 additions & 2 deletions lib/raven/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def send(event)

content_type, encoded_data = encode(event)
begin
transport.send(generate_auth_header(encoded_data), encoded_data,
transport.send(generate_auth_header, encoded_data,
:content_type => content_type)
rescue => e
Raven.logger.error "Unable to record event with remote Sentry server (#{e.class} - #{e.message})"
Expand Down Expand Up @@ -78,7 +78,7 @@ def transport
end
end

def generate_auth_header(data)
def generate_auth_header
now = Time.now.to_i.to_s
fields = {
'sentry_version' => PROTOCOL_VERSION,
Expand Down
6 changes: 3 additions & 3 deletions lib/raven/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def initialize(options = {}, &block)
def get_hostname
# Try to resolve the hostname to an FQDN, but fall back to whatever the load name is
hostname = Socket.gethostname
hostname = Socket.gethostbyname(hostname).first rescue hostname
Socket.gethostbyname(hostname).first rescue hostname
end

def get_modules
Expand Down Expand Up @@ -140,7 +140,7 @@ def self.from_exception(exc, options = {}, &block)
context_lines = configuration[:context_lines]

new(options) do |evt|
evt.message = "#{exc.class.to_s}: #{exc.message}"
evt.message = "#{exc.class}: #{exc.message}"
evt.level = options[:level] || :error

evt.interface(:exception) do |int|
Expand Down Expand Up @@ -186,7 +186,7 @@ def self.from_message(message, options = {})
end

# Because linecache can go to hell
def self._source_lines(path, from, to)
def self._source_lines(_path, _from, _to)
end

def get_file_context(filename, lineno, context)
Expand Down
4 changes: 2 additions & 2 deletions lib/raven/integrations/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

module Raven
class Sidekiq
def call(worker, msg, queue)
def call(_worker, msg, _queue)
started_at = Time.now
yield
rescue => ex
rescue Exception => ex
Raven.capture_exception(ex, :extra => { :sidekiq => msg },
:time_spent => Time.now-started_at)
raise
Expand Down
2 changes: 1 addition & 1 deletion lib/raven/integrations/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace :raven do
desc "Send a test event to the remote Sentry server"
task :test, [:dsn] do |t, args|
task :test, [:dsn] do |_t, args|
Rake::Task["environment"].invoke if defined? Rails

Raven::CLI.test(args.dsn)
Expand Down
4 changes: 2 additions & 2 deletions lib/raven/processor/utf8conversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class Processor::UTF8Conversion < Processor

def process(value)
if value.is_a? Array
value.map { |v_| process v_ }
value.map { |v| process v }
elsif value.is_a? Hash
value.merge(value) { |k, v_| process v_ }
value.merge(value) { |_, v| process v }
else
clean_invalid_utf8_bytes(value)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/raven/transports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def initialize(configuration)
@configuration = configuration
end

def send(auth_header, data, options = {})
raise Error.new('Abstract method not implemented')
def send#(auth_header, data, options = {})
raise NotImplementedError.new('Abstract method not implemented')
end

protected
Expand Down
2 changes: 1 addition & 1 deletion lib/raven/transports/udp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Raven
module Transports
class UDP < Transport

def send(auth_header, data, options = {})
def send(auth_header, data, _options = {})
conn.send "#{auth_header}\n\n#{data}", 0
end

Expand Down
2 changes: 1 addition & 1 deletion spec/raven/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
end

it 'should be configurable to send events async' do
subject.async = lambda { |event| :ok }
subject.async = lambda { |_e| :ok }
expect(subject.async.respond_to?(:call)).to eq(true)
expect(subject.async.call('event')).to eq(:ok)
end
Expand Down
4 changes: 1 addition & 3 deletions spec/raven/integrations/rack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

expect(Raven::Rack).to receive(:capture_exception).with(exception, env)

app = lambda do |e|
raise exception
end
app = lambda { |_e| raise exception }

stack = Raven::Rack.new(app)
expect { stack.call(env) }.to raise_error
Expand Down
2 changes: 0 additions & 2 deletions spec/raven/integrations/rake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
describe 'Rake tasks' do

it 'should capture exceptions in Rake tasks' do
exception = build_exception

expect(`cd spec/support && bundle exec rake raise_exception 2>&1`).to match(/Sending event/)
end

Expand Down
6 changes: 3 additions & 3 deletions spec/raven/raven_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
expect(Raven).not_to receive(:send).with(event)

prior_async = Raven.configuration.async
Raven.configuration.async = lambda { |e| :ok }
Raven.configuration.async = lambda { :ok }
expect(Raven.configuration.async).to receive(:call).with(event)
Raven.capture_message(message, options)
Raven.configuration.async = prior_async
Expand Down Expand Up @@ -63,7 +63,7 @@
expect(Raven).not_to receive(:send).with(event)

prior_async = Raven.configuration.async
Raven.configuration.async = lambda { |e| :ok }
Raven.configuration.async = lambda { :ok }
expect(Raven.configuration.async).to receive(:call).with(event)
Raven.capture_exception(exception, options)
Raven.configuration.async = prior_async
Expand All @@ -77,7 +77,7 @@
expect(Raven).not_to receive(:send).with(event)

prior_should_send = Raven.configuration.should_send
Raven.configuration.should_send = Proc.new { |e| false }
Raven.configuration.should_send = Proc.new { false }
expect(Raven.configuration.should_send).to receive(:call).with(exception)
Raven.capture_exception(exception, options)
Raven.configuration.should_send = prior_should_send
Expand Down