Skip to content

Commit 34a7fc4

Browse files
committed
Standard: Fix Layout offenses
1 parent bf93dab commit 34a7fc4

File tree

7 files changed

+17
-34
lines changed

7 files changed

+17
-34
lines changed

.standard_todo.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,16 @@
22
# Remove from this list as you refactor files.
33
---
44
ignore:
5-
- lib/migration_tools.rb:
6-
- Layout/SpaceInsideArrayLiteralBrackets
75
- lib/migration_tools/migration_extension.rb:
8-
- Layout/EmptyLinesAroundModuleBody
96
- Lint/RedundantStringCoercion
107
- Style/HashSyntax
118
- lib/migration_tools/tasks.rb:
12-
- Layout/MultilineMethodCallBraceLayout
139
- Style/HashSyntax
14-
- Layout/SpaceInsideArrayLiteralBrackets
15-
- Layout/IndentationWidth
16-
- Layout/ElseAlignment
17-
- Layout/EndAlignment
1810
- Style/TernaryParentheses
1911
- Style/StringLiteralsInInterpolation
20-
- Layout/SpaceInsideStringInterpolation
21-
- Layout/SpaceAroundOperators
22-
- migration_tools.gemspec:
23-
- Layout/ExtraSpacing
2412
- test/helper.rb:
2513
- Lint/NonDeterministicRequireOrder
26-
- Layout/SpaceInsideBlockBraces
2714
- test/test_migration_tools.rb:
2815
- Style/HashSyntax
29-
- Layout/SpaceInsideArrayLiteralBrackets
3016
- Style/RedundantBegin
3117
- Style/EvalWithLocation
32-
- Layout/SpaceInsideBlockBraces

lib/migration_tools.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ def self.forced!
1515
@forced = true
1616
end
1717

18-
MIGRATION_GROUPS = [ "before", "during", "after", "change" ]
18+
MIGRATION_GROUPS = ["before", "during", "after", "change"]
1919
end

lib/migration_tools/migration_extension.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module MigrationTools
22
module MigrationExtension
3-
43
attr_accessor :migration_group
54

65
def group(arg = nil)

lib/migration_tools/tasks.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def migrate_up(migrations, target_version)
4646
ActiveRecord::Migrator.new(:up, migrations,
4747
ActiveRecord::Base.connection.schema_migration,
4848
ActiveRecord::Base.connection.internal_metadata,
49-
target_version
50-
)
49+
target_version)
5150
else
5251
ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration, target_version)
5352
end
@@ -71,7 +70,7 @@ def define_migrate_list
7170
else
7271
notify "You have #{pending_migrations.size} pending migrations", group
7372
pending_migrations.each do |migration|
74-
notify " %4d %s %s" % [ migration.version, migration.migration_group.to_s[0..5].center(6), migration.name ]
73+
notify " %4d %s %s" % [migration.version, migration.migration_group.to_s[0..5].center(6), migration.name]
7574
end
7675
end
7776
end
@@ -94,10 +93,10 @@ def define_migrate_group
9493
end
9594

9695
schema_format = if ActiveRecord::VERSION::MAJOR >= 7
97-
ActiveRecord.schema_format
98-
else
99-
ActiveRecord::Base.schema_format
100-
end
96+
ActiveRecord.schema_format
97+
else
98+
ActiveRecord::Base.schema_format
99+
end
101100

102101
Rake::Task["db:schema:dump"].invoke if schema_format == :ruby
103102
Rake::Task["db:structure:dump"].invoke if schema_format == :sql
@@ -110,10 +109,10 @@ def define_migrate_group
110109
def define_convenience_tasks
111110
namespace :db do
112111
namespace :migrate do
113-
[ :list, :group ].each do |ns|
112+
[:list, :group].each do |ns|
114113
namespace ns do
115114
MigrationTools::MIGRATION_GROUPS.each do |migration_group|
116-
desc "#{ns == :list ? 'Lists' : 'Executes' } the migrations for group #{migration_group}"
115+
desc "#{ns == :list ? 'Lists' : 'Executes'} the migrations for group #{migration_group}"
117116
task migration_group => :environment do
118117
self.group = migration_group.to_s
119118
Rake::Task["db:migrate:#{ns}"].invoke
@@ -144,7 +143,7 @@ def notify(string, group = "")
144143
if group.empty?
145144
puts string
146145
else
147-
puts string + " for group \""+group+"\""
146+
puts "#{string} for group \"#{group}\""
148147
end
149148
end
150149
end

migration_tools.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new "migration_tools", "1.9.0" do |s|
22
s.description = "Rake tasks for Rails that add groups to migrations"
3-
s.summary = "Encourage migrations that do not require downtime"
3+
s.summary = "Encourage migrations that do not require downtime"
44
s.homepage = "https://github.com/zendesk/migration_tools"
55
s.email = "[email protected]"
66
s.authors = ["Morten Primdahl"]

test/helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
dir = File.expand_path("../migrations", __FILE__)
1313
ActiveRecord::Migrator.migrations_paths.replace([dir])
14-
Dir.glob(File.join(dir, "*.rb")).each {|f| require f}
14+
Dir.glob(File.join(dir, "*.rb")).each { |f| require f }
1515

1616
ActiveRecord::Migration.verbose = false

test/test_migration_tools.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919
def migrations
20-
[ Alpha, Beta, Delta, Kappa ]
20+
[Alpha, Beta, Delta, Kappa]
2121
end
2222

2323
def proxies
@@ -34,9 +34,9 @@ def migration_proxy(m)
3434
end
3535

3636
it "grouping" do
37-
assert_equal [ Alpha, Beta ], migrations.select { |m| m.migration_group == "before" }
38-
assert_equal [ Delta ], migrations.select { |m| m.migration_group == "change" }
39-
assert_equal [ Kappa ], migrations.select { |m| m.migration_group.nil? }
37+
assert_equal [Alpha, Beta], migrations.select { |m| m.migration_group == "before" }
38+
assert_equal [Delta], migrations.select { |m| m.migration_group == "change" }
39+
assert_equal [Kappa], migrations.select { |m| m.migration_group.nil? }
4040
end
4141

4242
it "runtime_checking" do
@@ -81,7 +81,7 @@ def migration_proxy(m)
8181
end
8282

8383
it "migrate_list_without_pending_without_group" do
84-
0.upto(3).each {|i| @task.migrator(i).run}
84+
0.upto(3).each { |i| @task.migrator(i).run }
8585

8686
@task.expects(:notify).with("Your database schema is up to date", "").once
8787

0 commit comments

Comments
 (0)