Commit 311c015d2b009ea5aa8f55c15ecc1038fa466541

Authored by Laust Rud Jacobsen
1 parent 7dc461ee
Exists in master and in 1 other branch production

Rubocop: hashes with strings for keys should get pretty alignment too

.rubocop.yml
... ... @@ -37,6 +37,7 @@ Style/IndentHash:
37 37 EnforcedStyle: consistent
38 38  
39 39 Style/AlignHash:
  40 + EnforcedHashRocketStyle: table
40 41 EnforcedColonStyle: table
41 42  
42 43 Style/SpaceAroundOperators:
... ...
app/mailers/mailer.rb
... ... @@ -5,12 +5,12 @@ require Rails.root.join('config/routes.rb')
5 5 class Mailer < ActionMailer::Base
6 6 helper ApplicationHelper
7 7  
8   - default :from => Errbit::Config.email_from,
9   - 'X-Errbit-Host' => Errbit::Config.host,
10   - 'X-Mailer' => 'Errbit',
  8 + default :from => Errbit::Config.email_from,
  9 + 'X-Errbit-Host' => Errbit::Config.host,
  10 + 'X-Mailer' => 'Errbit',
11 11 'X-Auto-Response-Suppress' => 'OOF, AutoReply',
12   - 'Precedence' => 'bulk',
13   - 'Auto-Submitted' => 'auto-generated'
  12 + 'Precedence' => 'bulk',
  13 + 'Auto-Submitted' => 'auto-generated'
14 14  
15 15 def err_notification(error_report)
16 16 @notice = NoticeDecorator.new error_report.notice
... ... @@ -19,9 +19,9 @@ class Mailer &lt; ActionMailer::Base
19 19 count = error_report.problem.notices_count
20 20 count = count > 1 ? "(#{count}) " : ""
21 21  
22   - errbit_headers 'App' => @app.name,
  22 + errbit_headers 'App' => @app.name,
23 23 'Environment' => @notice.environment_name,
24   - 'Error-Id' => @notice.err_id
  24 + 'Error-Id' => @notice.err_id
25 25  
26 26 mail to: @app.notification_recipients,
27 27 subject: "#{count}[#{@app.name}][#{@notice.environment_name}] #{@notice.message.truncate(50)}"
... ... @@ -31,10 +31,10 @@ class Mailer &lt; ActionMailer::Base
31 31 @deploy = deploy
32 32 @app = AppDecorator.new deploy.app
33 33  
34   - errbit_headers 'App' => @app.name,
35   - 'Environment' => @deploy.environment,
  34 + errbit_headers 'App' => @app.name,
  35 + 'Environment' => @deploy.environment,
36 36 'Deploy-Revision' => @deploy.revision,
37   - 'Deploy-User' => @deploy.username
  37 + 'Deploy-User' => @deploy.username
38 38  
39 39 mail to: @app.notification_recipients,
40 40 subject: "[#{@app.name}] Deployed to #{@deploy.environment} by #{@deploy.username}"
... ... @@ -49,9 +49,9 @@ class Mailer &lt; ActionMailer::Base
49 49  
50 50 recipients = @comment.notification_recipients
51 51  
52   - errbit_headers 'App' => @app.name,
53   - 'Environment' => @notice.environment_name,
54   - 'Problem-Id' => @problem.id,
  52 + errbit_headers 'App' => @app.name,
  53 + 'Environment' => @notice.environment_name,
  54 + 'Problem-Id' => @problem.id,
55 55 'Comment-Author' => @user.name
56 56  
57 57 mail to: recipients,
... ...
app/models/problem.rb
... ... @@ -85,21 +85,21 @@ class Problem
85 85  
86 86 Problem.where('_id' => id).find_one_and_update({
87 87 '$set' => {
88   - 'environment' => notice.environment_name,
89   - 'error_class' => notice.error_class,
90   - 'last_notice_at' => notice.created_at.utc,
91   - 'message' => notice.message,
92   - 'resolved' => false,
93   - 'resolved_at' => nil,
94   - 'where' => notice.where,
95   - "messages.#{message_digest}.value" => notice.message,
96   - "hosts.#{host_digest}.value" => notice.host,
  88 + 'environment' => notice.environment_name,
  89 + 'error_class' => notice.error_class,
  90 + 'last_notice_at' => notice.created_at.utc,
  91 + 'message' => notice.message,
  92 + 'resolved' => false,
  93 + 'resolved_at' => nil,
  94 + 'where' => notice.where,
  95 + "messages.#{message_digest}.value" => notice.message,
  96 + "hosts.#{host_digest}.value" => notice.host,
97 97 "user_agents.#{user_agent_digest}.value" => notice.user_agent_string
98 98 },
99 99 '$inc' => {
100   - 'notices_count' => 1,
101   - "messages.#{message_digest}.count" => 1,
102   - "hosts.#{host_digest}.count" => 1,
  100 + 'notices_count' => 1,
  101 + "messages.#{message_digest}.count" => 1,
  102 + "hosts.#{host_digest}.count" => 1,
103 103 "user_agents.#{user_agent_digest}.count" => 1
104 104 }
105 105 }, return_document: :after)
... ... @@ -110,12 +110,12 @@ class Problem
110 110  
111 111 atomically do |doc|
112 112 doc.set(
113   - 'environment' => last_notice.environment_name,
114   - 'error_class' => last_notice.error_class,
  113 + 'environment' => last_notice.environment_name,
  114 + 'error_class' => last_notice.error_class,
115 115 'last_notice_at' => last_notice.created_at,
116   - 'message' => last_notice.message,
117   - 'where' => last_notice.where,
118   - 'notices_count' => notices_count.to_i > 1 ? notices_count - 1 : 0
  116 + 'message' => last_notice.message,
  117 + 'where' => last_notice.where,
  118 + 'notices_count' => notices_count.to_i > 1 ? notices_count - 1 : 0
119 119 )
120 120  
121 121 CACHED_NOTICE_ATTRIBUTES.each do |k, v|
... ...
config/deploy.example.rb
... ... @@ -46,7 +46,7 @@ namespace :errbit do
46 46  
47 47 {
48 48 'config/newrelic.example.yml' => 'config/newrelic.yml',
49   - 'config/unicorn.default.rb' => 'config/unicorn.rb'
  49 + 'config/unicorn.default.rb' => 'config/unicorn.rb'
50 50 }.each do |src, target|
51 51 unless test("[ -f #{shared_path}/#{target} ]")
52 52 upload! src, "#{shared_path}/#{target}"
... ...
db/migrate/201510290041_extract_issue_tracker.rb
1 1 class ExtractIssueTracker < Mongoid::Migration
2 2 TRACKER_MAPPING = {
3   - 'ErrbitTracPlugin::IssueTracker' => 'trac',
  3 + 'ErrbitTracPlugin::IssueTracker' => 'trac',
4 4 'IssueTrackers::BitbucketIssuesTracker' => 'bitbucket',
5   - 'IssueTrackers::FogbugzTracker' => 'fogbugz',
6   - 'IssueTrackers::GithubIssuesTracker' => 'github',
7   - 'IssueTrackers::GitlabTracker' => 'gitlab',
8   - 'IssueTrackers::JiraTracker' => 'jira',
9   - 'IssueTrackers::LighthouseTracker' => 'lighthouse',
10   - 'IssueTrackers::PivotalLabsTracker' => 'pivotal',
11   - 'IssueTrackers::RedmineTracker' => 'redmine',
12   - 'IssueTrackers::UnfuddleTracker' => 'unfuddle'
  5 + 'IssueTrackers::FogbugzTracker' => 'fogbugz',
  6 + 'IssueTrackers::GithubIssuesTracker' => 'github',
  7 + 'IssueTrackers::GitlabTracker' => 'gitlab',
  8 + 'IssueTrackers::JiraTracker' => 'jira',
  9 + 'IssueTrackers::LighthouseTracker' => 'lighthouse',
  10 + 'IssueTrackers::PivotalLabsTracker' => 'pivotal',
  11 + 'IssueTrackers::RedmineTracker' => 'redmine',
  12 + 'IssueTrackers::UnfuddleTracker' => 'unfuddle'
13 13 }
14 14  
15 15 def self.up
... ... @@ -29,9 +29,9 @@ class ExtractIssueTracker &lt; Mongoid::Migration
29 29  
30 30 tracker = {
31 31 'type_tracker' => TRACKER_MAPPING[type],
32   - 'options' => options,
33   - 'updated_at' => updated_at,
34   - 'created_at' => created_at
  32 + 'options' => options,
  33 + 'updated_at' => updated_at,
  34 + 'created_at' => created_at
35 35 }
36 36  
37 37 App.where(_id: app.id).update("$set" => { issue_tracker: tracker })
... ...
lib/airbrake_api/v3/notice_parser.rb
... ... @@ -45,9 +45,9 @@ module AirbrakeApi
45 45 def server_environment
46 46 {
47 47 'environment-name' => context['environment'],
48   - 'hostname' => hostname,
49   - 'project-root' => context['rootDirectory'],
50   - 'app-version' => context['version']
  48 + 'hostname' => hostname,
  49 + 'project-root' => context['rootDirectory'],
  50 + 'app-version' => context['version']
51 51 }
52 52 end
53 53  
... ... @@ -57,12 +57,12 @@ module AirbrakeApi
57 57 )
58 58  
59 59 {
60   - 'cgi-data' => environment,
61   - 'session' => params['session'],
62   - 'params' => params['params'],
63   - 'url' => url,
  60 + 'cgi-data' => environment,
  61 + 'session' => params['session'],
  62 + 'params' => params['params'],
  63 + 'url' => url,
64 64 'component' => context['component'],
65   - 'action' => context['action']
  65 + 'action' => context['action']
66 66 }
67 67 end
68 68  
... ...
lib/tasks/errbit/demo.rake
... ... @@ -34,9 +34,9 @@ namespace :errbit do
34 34 backtrace = []
35 35 99.times {|t|
36 36 backtrace << {
37   - 'number' => t.hash % 1000,
38   - 'file' => "/path/to/file.rb",
39   - 'method' => RANDOM_METHODS.sample.to_s
  37 + 'number' => t.hash % 1000,
  38 + 'file' => "/path/to/file.rb",
  39 + 'method' => RANDOM_METHODS.sample.to_s
40 40 }}
41 41 backtrace
42 42 end
... ... @@ -51,8 +51,8 @@ namespace :errbit do
51 51 backtrace: random_backtrace,
52 52 request: {
53 53 'component' => 'main',
54   - 'action' => 'error',
55   - 'url' => "http://example.com/post/#{[111, 222, 333].sample}"
  54 + 'action' => 'error',
  55 + 'url' => "http://example.com/post/#{[111, 222, 333].sample}"
56 56 },
57 57 server_environment: { 'environment-name' => Rails.env.to_s },
58 58 notifier: { name: "seeds.rb" },
... ...
spec/acceptance/acceptance_helper.rb
... ... @@ -7,9 +7,9 @@ OmniAuth.config.test_mode = true
7 7  
8 8 def mock_auth(user = "test_user", token = "abcdef")
9 9 OmniAuth.config.mock_auth[:github] = Hashie::Mash.new(
10   - 'provider' => 'github',
11   - 'uid' => '1763',
12   - 'extra' => {
  10 + 'provider' => 'github',
  11 + 'uid' => '1763',
  12 + 'extra' => {
13 13 'raw_info' => {
14 14 'login' => user
15 15 }
... ...
spec/controllers/api/v3/notices_controller_spec.rb
... ... @@ -16,7 +16,7 @@ describe Api::V3::NoticesController, type: :controller do
16 16 post :create, legit_body, legit_params
17 17 notice = Notice.last
18 18 expect(JSON.parse(response.body)).to eq(
19   - 'id' => notice.id.to_s,
  19 + 'id' => notice.id.to_s,
20 20 'url' => app_problem_url(app, notice.problem)
21 21 )
22 22 end
... ...
spec/lib/airbrake_api/v3/notice_parser_spec.rb
... ... @@ -21,16 +21,16 @@ describe AirbrakeApi::V3::NoticeParser do
21 21 expect(report.message).to eq('Error: TestError')
22 22 expect(report.backtrace.lines.size).to eq(9)
23 23 expect(notice.user_attributes).to include(
24   - 'Id' => 1,
25   - 'Name' => 'John Doe',
26   - 'Email' => 'john.doe@example.org',
  24 + 'Id' => 1,
  25 + 'Name' => 'John Doe',
  26 + 'Email' => 'john.doe@example.org',
27 27 'Username' => 'john'
28 28 )
29 29 expect(notice.session).to include('isAdmin' => true)
30 30 expect(notice.params).to include('returnTo' => 'dashboard')
31 31 expect(notice.env_vars).to include(
32 32 'navigator_vendor' => 'Google Inc.',
33   - 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36'
  33 + 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36'
34 34 )
35 35 end
36 36  
... ...
spec/models/error_report_spec.rb
... ... @@ -128,12 +128,12 @@ describe ErrorReport do
128 128 # <var key="id"/>
129 129 # </var>
130 130 expected = {
131   - 'secure' => 'false',
132   - 'httponly' => 'true',
133   - 'path' => '/',
134   - 'expire_after' => nil,
135   - 'domain' => nil,
136   - 'id' => nil
  131 + 'secure' => 'false',
  132 + 'httponly' => 'true',
  133 + 'path' => '/',
  134 + 'expire_after' => nil,
  135 + 'domain' => nil,
  136 + 'id' => nil
137 137 }
138 138 expect(subject.env_vars).to have_key('rack_session_options')
139 139 expect(subject.env_vars['rack_session_options']).to eql(expected)
... ...
spec/models/notice_observer_spec.rb
... ... @@ -7,20 +7,20 @@ describe &quot;Callback on Notice&quot;, type: &#39;model&#39; do
7 7 backtrace: [
8 8 {
9 9 "number" => "425",
10   - "file" => "[GEM_ROOT]/callbacks.rb",
  10 + "file" => "[GEM_ROOT]/callbacks.rb",
11 11 "method" => "__callbacks"
12 12 }
13 13 ],
14 14 request: { "component" => "application" },
15 15 server_environment: {
16   - "project-root" => "/path/to/sample/project",
  16 + "project-root" => "/path/to/sample/project",
17 17 "environment-name" => "development"
18 18 },
19 19 api_key: api_key,
20 20 notifier: {
21   - "name" => "Hoptoad Notifier",
  21 + "name" => "Hoptoad Notifier",
22 22 "version" => "2.3.2",
23   - "url" => "http://hoptoadapp.com"
  23 + "url" => "http://hoptoadapp.com"
24 24 },
25 25 framework: "Rails: 3.2.11"
26 26 }
... ...
spec/views/problems/show.html.haml_spec.rb
... ... @@ -33,7 +33,7 @@ describe &quot;problems/show.html.haml&quot;, type: &#39;view&#39; do
33 33 }
34 34 let(:trackers) {
35 35 {
36   - 'github' => github_tracker,
  36 + 'github' => github_tracker,
37 37 'pivotal' => pivotal_tracker
38 38 }
39 39 }
... ...