Skip to content

Commit 1756388

Browse files
author
Awesome Code
committed
Auto corrected by following Lint Ruby Layout/HeredocIndentation
1 parent 97515ce commit 1756388

7 files changed

+96
-96
lines changed

lib/rails/convert_rails_logger.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
Synvert::Rewriter.new 'rails', 'convert_rails_logger' do
44
description <<~EOS
5-
It converts RAILS_DEFAULT_LOGGER to Rails.logger.
5+
It converts RAILS_DEFAULT_LOGGER to Rails.logger.
66
7-
```ruby
8-
RAILS_DEFAULT_LOGGER
9-
```
7+
```ruby
8+
RAILS_DEFAULT_LOGGER
9+
```
1010
11-
=>
11+
=>
1212
13-
```ruby
14-
Rails.logger
15-
```
13+
```ruby
14+
Rails.logger
15+
```
1616
EOS
1717

1818
if_gem 'rails', { gte: '2.3.0' }

spec/rails/add_application_job_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
let(:fake_file_path) { 'app/jobs/application_job.rb' }
1010
let(:test_content) { nil }
1111
let(:test_rewritten_content) { <<~EOS }
12-
class ApplicationJob < ActiveJob::Base
13-
end
12+
class ApplicationJob < ActiveJob::Base
13+
end
1414
EOS
1515

1616
include_examples 'convertable'
@@ -19,13 +19,13 @@ class ApplicationJob < ActiveJob::Base
1919
context 'rename ActiveJob::Base' do
2020
let(:fake_file_path) { 'app/jobs/post_job.rb' }
2121
let(:test_content) { <<~EOS }
22-
class PostJob < ActiveJob::Base
23-
end
22+
class PostJob < ActiveJob::Base
23+
end
2424
EOS
2525

2626
let(:test_rewritten_content) { <<~EOS }
27-
class PostJob < ApplicationJob
28-
end
27+
class PostJob < ApplicationJob
28+
end
2929
EOS
3030

3131
include_examples 'convertable'

spec/rails/add_application_record_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
let(:fake_file_path) { 'app/models/application_record.rb' }
1010
let(:test_content) { nil }
1111
let(:test_rewritten_content) { <<~EOS }
12-
class ApplicationRecord < ActiveRecord::Base
13-
self.abstract_class = true
14-
end
12+
class ApplicationRecord < ActiveRecord::Base
13+
self.abstract_class = true
14+
end
1515
EOS
1616

1717
include_examples 'convertable'
@@ -20,13 +20,13 @@ class ApplicationRecord < ActiveRecord::Base
2020
context 'rename ActiveRecord::Base' do
2121
let(:fake_file_path) { 'app/models/post.rb' }
2222
let(:test_content) { <<~EOS }
23-
class Post < ActiveRecord::Base
24-
end
23+
class Post < ActiveRecord::Base
24+
end
2525
EOS
2626

2727
let(:test_rewritten_content) { <<~EOS }
28-
class Post < ApplicationRecord
29-
end
28+
class Post < ApplicationRecord
29+
end
3030
EOS
3131

3232
include_examples 'convertable'

spec/rails/convert_active_record_dirty_5_0_to_5_1_spec.rb

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,70 @@
66
let(:rewriter_name) { 'rails/convert_active_record_dirty_5_0_to_5_1' }
77
let(:fake_file_path) { 'app/models/post.rb' }
88
let(:schema_content) { <<~EOS }
9-
ActiveRecord::Schema.define(version: 20140211112752) do
10-
create_table "posts", force: true do |t|
11-
t.string "title"
12-
t.string "summary"
13-
t.boolean "status"
14-
t.timestamps
15-
end
9+
ActiveRecord::Schema.define(version: 20140211112752) do
10+
create_table "posts", force: true do |t|
11+
t.string "title"
12+
t.string "summary"
13+
t.boolean "status"
14+
t.timestamps
1615
end
16+
end
1717
EOS
1818

1919
let(:test_content) { <<~EOS }
20-
class Post < ActiveRecord::Base
21-
before_create :call_before_create
22-
before_update :call_before_update, unless: :title_changed?
23-
before_save :call_before_save, if: -> { status_changed? || summary_changed? }
24-
after_create :call_after_create
25-
after_update :call_after_update, unless: :title_changed?
26-
after_save :call_after_save, if: -> { status_changed? || summary_changed? }
20+
class Post < ActiveRecord::Base
21+
before_create :call_before_create
22+
before_update :call_before_update, unless: :title_changed?
23+
before_save :call_before_save, if: -> { status_changed? || summary_changed? }
24+
after_create :call_after_create
25+
after_update :call_after_update, unless: :title_changed?
26+
after_save :call_after_save, if: -> { status_changed? || summary_changed? }
2727
28-
before_save do
29-
if title_changed?
30-
end
28+
before_save do
29+
if title_changed?
3130
end
31+
end
3232
33-
def call_before_create
34-
if title_changed?
35-
changes
36-
end
33+
def call_before_create
34+
if title_changed?
35+
changes
3736
end
37+
end
3838
39-
def call_after_create
40-
if title_changed?
41-
changes
42-
end
39+
def call_after_create
40+
if title_changed?
41+
changes
4342
end
4443
end
44+
end
4545
EOS
4646

4747
let(:test_rewritten_content) { <<~EOS }
48-
class Post < ActiveRecord::Base
49-
before_create :call_before_create
50-
before_update :call_before_update, unless: :will_save_change_to_title?
51-
before_save :call_before_save, if: -> { will_save_change_to_status? || will_save_change_to_summary? }
52-
after_create :call_after_create
53-
after_update :call_after_update, unless: :saved_change_to_title?
54-
after_save :call_after_save, if: -> { saved_change_to_status? || saved_change_to_summary? }
48+
class Post < ActiveRecord::Base
49+
before_create :call_before_create
50+
before_update :call_before_update, unless: :will_save_change_to_title?
51+
before_save :call_before_save, if: -> { will_save_change_to_status? || will_save_change_to_summary? }
52+
after_create :call_after_create
53+
after_update :call_after_update, unless: :saved_change_to_title?
54+
after_save :call_after_save, if: -> { saved_change_to_status? || saved_change_to_summary? }
5555
56-
before_save do
57-
if will_save_change_to_title?
58-
end
56+
before_save do
57+
if will_save_change_to_title?
5958
end
59+
end
6060
61-
def call_before_create
62-
if will_save_change_to_title?
63-
changes_to_save
64-
end
61+
def call_before_create
62+
if will_save_change_to_title?
63+
changes_to_save
6564
end
65+
end
6666
67-
def call_after_create
68-
if saved_change_to_title?
69-
saved_changes
70-
end
67+
def call_after_create
68+
if saved_change_to_title?
69+
saved_changes
7170
end
7271
end
72+
end
7373
EOS
7474

7575
before do

spec/rails/convert_render_text_to_render_plain_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@
66
let(:rewriter_name) { 'rails/convert_render_text_to_render_plain' }
77
let(:fake_file_path) { 'app/controllers/posts_controller.rb' }
88
let(:test_content) { <<~EOS }
9-
class PostsController < ApplicationController
10-
def foo
11-
render text: 'OK'
12-
end
9+
class PostsController < ApplicationController
10+
def foo
11+
render text: 'OK'
12+
end
1313
14-
def bar
15-
render text: 'Not OK', status: 403
16-
end
14+
def bar
15+
render text: 'Not OK', status: 403
1716
end
17+
end
1818
EOS
1919

2020
let(:test_rewritten_content) { <<~EOS }
21-
class PostsController < ApplicationController
22-
def foo
23-
render plain: 'OK'
24-
end
21+
class PostsController < ApplicationController
22+
def foo
23+
render plain: 'OK'
24+
end
2525
26-
def bar
27-
render plain: 'Not OK', status: 403
28-
end
26+
def bar
27+
render plain: 'Not OK', status: 403
2928
end
29+
end
3030
EOS
3131

3232
include_examples 'convertable'

spec/rails/upgrade_3_0_to_3_1_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@
6363
'
6464
}
6565
let(:wrap_parameters_rewritten_content) { <<~EOS }
66-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
67-
ActiveSupport.on_load(:action_controller) do
68-
wrap_parameters format: [:json]
69-
end
66+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
67+
ActiveSupport.on_load(:action_controller) do
68+
wrap_parameters format: [:json]
69+
end
7070
71-
# Disable root element in JSON by default.
72-
ActiveSupport.on_load(:active_record) do
73-
self.include_root_in_json = false
74-
end
71+
# Disable root element in JSON by default.
72+
ActiveSupport.on_load(:active_record) do
73+
self.include_root_in_json = false
74+
end
7575
EOS
7676

7777
let(:session_store_content) {

spec/ruby/new_2_2_hash_syntax_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
RSpec.describe 'Uses ruby 2.2 new hash synax' do
66
let(:rewriter_name) { 'ruby/new_2_2_hash_syntax' }
77
let(:test_content) { <<~'EOS' }
8-
{ :foo => 'bar', 'foo' => 'bar' }
9-
{ :key1 => 'value1', :key2 => 'value2' }
10-
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
11-
{ :"foo-#{key}" => 'foo_value', :"bar-key" => 42, :"a\tb" => false, :"c'd" => nil }
12-
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
8+
{ :foo => 'bar', 'foo' => 'bar' }
9+
{ :key1 => 'value1', :key2 => 'value2' }
10+
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
11+
{ :"foo-#{key}" => 'foo_value', :"bar-key" => 42, :"a\tb" => false, :"c'd" => nil }
12+
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
1313
EOS
1414

1515
let(:test_rewritten_content) { <<~'EOS' }
16-
{ foo: 'bar', 'foo' => 'bar' }
17-
{ key1: 'value1', key2: 'value2' }
18-
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
19-
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
20-
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
16+
{ foo: 'bar', 'foo' => 'bar' }
17+
{ key1: 'value1', key2: 'value2' }
18+
{ foo_key: 'foo_value', bar_key: 42, "baz-key" => true }
19+
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
20+
{ "foo-#{key}": 'foo_value', 'bar-key': 42, "a\tb": false, "c'd": nil }
2121
EOS
2222

2323
before do

0 commit comments

Comments
 (0)