Commit c85146074bd4b8b90c2dd043824a3c99cc1c5683
1 parent
312b43fe
Exists in
master
and in
1 other branch
Rubocop: use Hash.key? instead of Hash.has_key? (deprecated)
Showing
5 changed files
with
12 additions
and
24 deletions
Show diff stats
.rubocop_todo.yml
| ... | ... | @@ -121,12 +121,6 @@ Style/ClassCheck: |
| 121 | 121 | Exclude: |
| 122 | 122 | - 'app/helpers/navigation_helper.rb' |
| 123 | 123 | |
| 124 | -# Offense count: 1 | |
| 125 | -# Cop supports --auto-correct. | |
| 126 | -Style/ClosingParenthesisIndentation: | |
| 127 | - Exclude: | |
| 128 | - - 'app/models/problem.rb' | |
| 129 | - | |
| 130 | 124 | # Offense count: 23 |
| 131 | 125 | Style/ConstantName: |
| 132 | 126 | Exclude: |
| ... | ... | @@ -141,14 +135,6 @@ Style/ConstantName: |
| 141 | 135 | - 'app/models/notification_services/slack_service.rb' |
| 142 | 136 | - 'app/models/notification_services/webhook_service.rb' |
| 143 | 137 | |
| 144 | -# Offense count: 11 | |
| 145 | -# Cop supports --auto-correct. | |
| 146 | -Style/DeprecatedHashMethods: | |
| 147 | - Exclude: | |
| 148 | - - 'lib/airbrake_api/v3/notice_parser.rb' | |
| 149 | - - 'lib/hoptoad/v2.rb' | |
| 150 | - - 'spec/lib/airbrake_api/v3/notice_parser_spec.rb' | |
| 151 | - | |
| 152 | 138 | # Offense count: 70 |
| 153 | 139 | # Configuration parameters: Exclude. |
| 154 | 140 | Style/Documentation: | ... | ... |
app/models/problem.rb
| ... | ... | @@ -162,7 +162,9 @@ class Problem |
| 162 | 162 | end |
| 163 | 163 | |
| 164 | 164 | def url |
| 165 | - Rails.application.routes.url_helpers.app_problem_url(app, self, | |
| 165 | + Rails.application.routes.url_helpers.app_problem_url( | |
| 166 | + app, | |
| 167 | + self, | |
| 166 | 168 | :host => Errbit::Config.host, |
| 167 | 169 | :port => Errbit::Config.port |
| 168 | 170 | ) | ... | ... |
lib/airbrake_api/v3/notice_parser.rb
| ... | ... | @@ -27,7 +27,7 @@ module AirbrakeApi |
| 27 | 27 | private |
| 28 | 28 | |
| 29 | 29 | def error |
| 30 | - raise AirbrakeApi::ParamsError unless params.has_key?('errors') && params['errors'].any? | |
| 30 | + raise AirbrakeApi::ParamsError unless params.key?('errors') && params['errors'].any? | |
| 31 | 31 | @error ||= params['errors'].first |
| 32 | 32 | end |
| 33 | 33 | ... | ... |
lib/hoptoad/v2.rb
| ... | ... | @@ -11,21 +11,21 @@ module Hoptoad |
| 11 | 11 | def self.rekey(node) |
| 12 | 12 | case node |
| 13 | 13 | when Hash |
| 14 | - if node.has_key?('var') && node.has_key?('key') | |
| 14 | + if node.key?('var') && node.key?('key') | |
| 15 | 15 | {normalize_key(node['key']) => rekey(node['var'])} |
| 16 | - elsif node.has_key?('var') | |
| 16 | + elsif node.key?('var') | |
| 17 | 17 | rekey(node['var']) |
| 18 | - elsif node.has_key?('__content__') && node.has_key?('key') | |
| 18 | + elsif node.key?('__content__') && node.key?('key') | |
| 19 | 19 | {normalize_key(node['key']) => rekey(node['__content__'])} |
| 20 | - elsif node.has_key?('__content__') | |
| 20 | + elsif node.key?('__content__') | |
| 21 | 21 | rekey(node['__content__']) |
| 22 | - elsif node.has_key?('key') | |
| 22 | + elsif node.key?('key') | |
| 23 | 23 | {normalize_key(node['key']) => nil} |
| 24 | 24 | else |
| 25 | 25 | node.inject({}) {|rekeyed, (key, val)| rekeyed.merge(normalize_key(key) => rekey(val))} |
| 26 | 26 | end |
| 27 | 27 | when Array |
| 28 | - if node.first.has_key?('key') | |
| 28 | + if node.first.key?('key') | |
| 29 | 29 | node.inject({}) {|rekeyed, keypair| rekeyed.merge(rekey(keypair))} |
| 30 | 30 | else |
| 31 | 31 | node.map {|n| rekey(n)} | ... | ... |
spec/lib/airbrake_api/v3/notice_parser_spec.rb
| ... | ... | @@ -53,8 +53,8 @@ describe AirbrakeApi::V3::NoticeParser do |
| 53 | 53 | json = Rails.root.join('spec', 'fixtures', 'api_v3_request.json').read |
| 54 | 54 | data = JSON.parse(json) |
| 55 | 55 | |
| 56 | - data['key'] = options[:key] if options.has_key?(:key) | |
| 57 | - data['project_id'] = options[:project_id] if options.has_key?(:project_id) | |
| 56 | + data['key'] = options[:key] if options.key?(:key) | |
| 57 | + data['project_id'] = options[:project_id] if options.key?(:project_id) | |
| 58 | 58 | |
| 59 | 59 | data |
| 60 | 60 | end | ... | ... |