Commit 9df008d63655d1fb897692386ada7b3c936835bd
1 parent
4ef00339
Exists in
master
and in
1 other branch
Rubocop: fail preferred over raise
Showing
6 changed files
with
6 additions
and
17 deletions
Show diff stats
.rubocop_todo.yml
@@ -242,17 +242,6 @@ Style/Semicolon: | @@ -242,17 +242,6 @@ Style/Semicolon: | ||
242 | - 'app/decorators/issue_tracker_type_decorator.rb' | 242 | - 'app/decorators/issue_tracker_type_decorator.rb' |
243 | - 'app/models/notice_fingerprinter.rb' | 243 | - 'app/models/notice_fingerprinter.rb' |
244 | 244 | ||
245 | -# Offense count: 6 | ||
246 | -# Cop supports --auto-correct. | ||
247 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
248 | -Style/SignalException: | ||
249 | - Exclude: | ||
250 | - - 'app/controllers/notices_controller.rb' | ||
251 | - - 'app/interactors/problem_merge.rb' | ||
252 | - - 'app/models/problem.rb' | ||
253 | - - 'lib/airbrake_api/v3/notice_parser.rb' | ||
254 | - - 'lib/hoptoad.rb' | ||
255 | - | ||
256 | # Offense count: 1 | 245 | # Offense count: 1 |
257 | # Configuration parameters: Methods. | 246 | # Configuration parameters: Methods. |
258 | Style/SingleLineBlockParams: | 247 | Style/SingleLineBlockParams: |
app/controllers/notices_controller.rb
@@ -39,7 +39,7 @@ private | @@ -39,7 +39,7 @@ private | ||
39 | return @notice_params if @notice_params | 39 | return @notice_params if @notice_params |
40 | @notice_params = params[:data] || request.raw_post | 40 | @notice_params = params[:data] || request.raw_post |
41 | if @notice_params.blank? | 41 | if @notice_params.blank? |
42 | - raise ParamsError.new('Need a data params in GET or raw post data') | 42 | + fail ParamsError.new('Need a data params in GET or raw post data') |
43 | end | 43 | end |
44 | @notice_params | 44 | @notice_params |
45 | end | 45 | end |
app/interactors/problem_merge.rb
@@ -5,7 +5,7 @@ class ProblemMerge | @@ -5,7 +5,7 @@ class ProblemMerge | ||
5 | problems = problems.flatten.uniq | 5 | problems = problems.flatten.uniq |
6 | @merged_problem = problems[0] | 6 | @merged_problem = problems[0] |
7 | @child_problems = problems[1..-1] | 7 | @child_problems = problems[1..-1] |
8 | - raise ArgumentError.new("need almost 2 uniq different problems") if @child_problems.empty? | 8 | + fail ArgumentError.new("need almost 2 uniq different problems") if @child_problems.empty? |
9 | end | 9 | end |
10 | attr_reader :merged_problem, :child_problems | 10 | attr_reader :merged_problem, :child_problems |
11 | 11 |
app/models/problem.rb
@@ -219,7 +219,7 @@ class Problem | @@ -219,7 +219,7 @@ class Problem | ||
219 | when "last_notice_at" then order_by(["last_notice_at", order]) | 219 | when "last_notice_at" then order_by(["last_notice_at", order]) |
220 | when "last_deploy_at" then order_by(["last_deploy_at", order]) | 220 | when "last_deploy_at" then order_by(["last_deploy_at", order]) |
221 | when "count" then order_by(["notices_count", order]) | 221 | when "count" then order_by(["notices_count", order]) |
222 | - else raise("\"#{sort}\" is not a recognized sort") | 222 | + else fail("\"#{sort}\" is not a recognized sort") |
223 | end | 223 | end |
224 | end | 224 | end |
225 | 225 |
lib/airbrake_api/v3/notice_parser.rb
@@ -27,7 +27,7 @@ module AirbrakeApi | @@ -27,7 +27,7 @@ module AirbrakeApi | ||
27 | private | 27 | private |
28 | 28 | ||
29 | def error | 29 | def error |
30 | - raise AirbrakeApi::ParamsError unless params.key?('errors') && params['errors'].any? | 30 | + fail AirbrakeApi::ParamsError unless params.key?('errors') && params['errors'].any? |
31 | @error ||= params['errors'].first | 31 | @error ||= params['errors'].first |
32 | end | 32 | end |
33 | 33 |
lib/hoptoad.rb
@@ -9,7 +9,7 @@ module Hoptoad | @@ -9,7 +9,7 @@ module Hoptoad | ||
9 | 9 | ||
10 | class << self | 10 | class << self |
11 | def parse_xml!(xml) | 11 | def parse_xml!(xml) |
12 | - parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] || raise(ApiVersionError) | 12 | + parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] || fail(ApiVersionError) |
13 | processor = get_version_processor(parsed['version']) | 13 | processor = get_version_processor(parsed['version']) |
14 | processor.process_notice(parsed) | 14 | processor.process_notice(parsed) |
15 | end | 15 | end |
@@ -17,7 +17,7 @@ module Hoptoad | @@ -17,7 +17,7 @@ module Hoptoad | ||
17 | private def get_version_processor(version) | 17 | private def get_version_processor(version) |
18 | case version | 18 | case version |
19 | when /2\.[01234]/ then Hoptoad::V2 | 19 | when /2\.[01234]/ then Hoptoad::V2 |
20 | - else; raise ApiVersionError | 20 | + else; fail ApiVersionError |
21 | end | 21 | end |
22 | end | 22 | end |
23 | end | 23 | end |