aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2017-07-22 13:14:46 +0900
committerGeorge Claghorn <george.claghorn@gmail.com>2017-07-22 00:14:46 -0400
commitb44b0f2c3b61beefbf5bcaadbf74f70137ded52e (patch)
tree4e4c7b34a3d598e28c5389e61ba5fc60ca4a1d69
parentf0d7ce9e767ffbf7307ed6efaa4a189ae3ea3c0a (diff)
downloadrails-b44b0f2c3b61beefbf5bcaadbf74f70137ded52e.tar.gz
rails-b44b0f2c3b61beefbf5bcaadbf74f70137ded52e.tar.bz2
rails-b44b0f2c3b61beefbf5bcaadbf74f70137ded52e.zip
Fix RuboCop offenses and warnings
-rw-r--r--.rubocop.yml88
-rw-r--r--Gemfile2
-rw-r--r--app/controllers/active_storage/variants_controller.rb2
-rw-r--r--config/routes.rb2
-rw-r--r--lib/active_storage/engine.rb2
-rw-r--r--lib/active_storage/variation.rb2
-rw-r--r--test/variant_test.rb6
7 files changed, 52 insertions, 52 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 7b4478d3bd..452e1b1e7f 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -8,108 +8,108 @@ AllCops:
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'
-# Prefer &&/|| over and/or.
-Style/AndOr:
- Enabled: true
-
-# Do not use braces for hash literals when they are the last argument of a
-# method call.
-Style/BracesAroundHashParameters:
- Enabled: true
- EnforcedStyle: context_dependent
-
# Align `when` with `case`.
-Style/CaseIndentation:
+Layout/CaseIndentation:
Enabled: true
# Align comments with method definitions.
-Style/CommentIndentation:
+Layout/CommentIndentation:
Enabled: true
# No extra empty lines.
-Style/EmptyLines:
+Layout/EmptyLines:
Enabled: false
# In a regular class definition, no empty lines around the body.
-Style/EmptyLinesAroundClassBody:
+Layout/EmptyLinesAroundClassBody:
Enabled: true
# In a regular method definition, no empty lines around the body.
-Style/EmptyLinesAroundMethodBody:
+Layout/EmptyLinesAroundMethodBody:
Enabled: true
# In a regular module definition, no empty lines around the body.
-Style/EmptyLinesAroundModuleBody:
- Enabled: true
-
-# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
-Style/HashSyntax:
+Layout/EmptyLinesAroundModuleBody:
Enabled: true
# Method definitions after `private` or `protected` isolated calls need one
# extra level of indentation.
-Style/IndentationConsistency:
+Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: rails
# Two spaces, no tabs (for indentation).
-Style/IndentationWidth:
+Layout/IndentationWidth:
Enabled: true
-Style/SpaceAfterColon:
+Layout/SpaceAfterColon:
Enabled: true
-Style/SpaceAfterComma:
+Layout/SpaceAfterComma:
Enabled: true
-Style/SpaceAroundEqualsInParameterDefault:
+Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true
-Style/SpaceAroundKeyword:
+Layout/SpaceAroundKeyword:
Enabled: true
-Style/SpaceAroundOperators:
+Layout/SpaceAroundOperators:
Enabled: true
-Style/SpaceBeforeFirstArg:
+Layout/SpaceBeforeFirstArg:
Enabled: true
-# Defining a method with parameters needs parentheses.
-Style/MethodDefParentheses:
- Enabled: true
-
# Use `foo {}` not `foo{}`.
-Style/SpaceBeforeBlockBraces:
+Layout/SpaceBeforeBlockBraces:
Enabled: true
# Use `foo { bar }` not `foo {bar}`.
-Style/SpaceInsideBlockBraces:
+Layout/SpaceInsideBlockBraces:
Enabled: true
# Use `{ a: 1 }` not `{a:1}`.
-Style/SpaceInsideHashLiteralBraces:
+Layout/SpaceInsideHashLiteralBraces:
Enabled: true
-Style/SpaceInsideParens:
+Layout/SpaceInsideParens:
Enabled: true
-# Check quotes usage according to lint rule below.
-Style/StringLiterals:
- Enabled: true
- EnforcedStyle: double_quotes
-
# Detect hard tabs, no hard tabs.
-Style/Tab:
+Layout/Tab:
Enabled: true
# Blank lines should not have any spaces.
-Style/TrailingBlankLines:
+Layout/TrailingBlankLines:
Enabled: true
# No trailing whitespace.
-Style/TrailingWhitespace:
+Layout/TrailingWhitespace:
Enabled: true
+# Prefer &&/|| over and/or.
+Style/AndOr:
+ Enabled: true
+
+# Do not use braces for hash literals when they are the last argument of a
+# method call.
+Style/BracesAroundHashParameters:
+ Enabled: true
+ EnforcedStyle: context_dependent
+
+# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
+Style/HashSyntax:
+ Enabled: true
+
+# Defining a method with parameters needs parentheses.
+Style/MethodDefParentheses:
+ Enabled: true
+
+# Check quotes usage according to lint rule below.
+Style/StringLiterals:
+ Enabled: true
+ EnforcedStyle: double_quotes
+
# Use quotes for string literals when they are enough.
Style/UnneededPercentQ:
Enabled: true
diff --git a/Gemfile b/Gemfile
index 953b85ccfe..7be644d80c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,6 +18,6 @@ gem "httparty"
gem "aws-sdk", "~> 2", require: false
gem "google-cloud-storage", "~> 1.3", require: false
-gem 'mini_magick'
+gem "mini_magick"
gem "rubocop", require: false
diff --git a/app/controllers/active_storage/variants_controller.rb b/app/controllers/active_storage/variants_controller.rb
index dde7e1458f..d5e97e63fa 100644
--- a/app/controllers/active_storage/variants_controller.rb
+++ b/app/controllers/active_storage/variants_controller.rb
@@ -20,6 +20,6 @@ class ActiveStorage::VariantsController < ActionController::Base
end
def disposition_param
- params[:disposition].presence_in(%w( inline attachment )) || 'inline'
+ params[:disposition].presence_in(%w( inline attachment )) || "inline"
end
end
diff --git a/config/routes.rb b/config/routes.rb
index d25f2c82f0..80e7f46184 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -12,5 +12,5 @@ Rails.application.routes.draw do
route_for(:rails_blob_variation, encoded_blob_key, variation_key, filename)
end
- resolve('ActiveStorage::Variant') { |variant| route_for(:rails_variant, variant) }
+ resolve("ActiveStorage::Variant") { |variant| route_for(:rails_variant, variant) }
end
diff --git a/lib/active_storage/engine.rb b/lib/active_storage/engine.rb
index b32ae34516..cf21a055be 100644
--- a/lib/active_storage/engine.rb
+++ b/lib/active_storage/engine.rb
@@ -29,7 +29,7 @@ module ActiveStorage
config.after_initialize do |app|
ActiveStorage::VerifiedKeyWithExpiration.verifier = \
ActiveStorage::Variation.verifier = \
- Rails.application.message_verifier('ActiveStorage')
+ Rails.application.message_verifier("ActiveStorage")
end
end
diff --git a/lib/active_storage/variation.rb b/lib/active_storage/variation.rb
index abff288ac1..7656d73469 100644
--- a/lib/active_storage/variation.rb
+++ b/lib/active_storage/variation.rb
@@ -15,7 +15,7 @@ class ActiveStorage::Variation
def decode(key)
new verifier.verify(key)
end
-
+
def encode(transformations)
verifier.generate(transformations)
end
diff --git a/test/variant_test.rb b/test/variant_test.rb
index 5294b87135..c7ff0d77e1 100644
--- a/test/variant_test.rb
+++ b/test/variant_test.rb
@@ -10,14 +10,14 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
test "resized variation" do
variant = @blob.variant(resize: "100x100").processed
- assert_match /racecar.jpg/, variant.url
- assert_same_image "racecar-100x100.jpg", variant
+ assert_match /racecar.jpg/, variant.url
+ assert_same_image "racecar-100x100.jpg", variant
end
test "resized and monochrome variation" do
variant = @blob.variant(resize: "100x100", monochrome: true).processed
assert_match /racecar.jpg/, variant.url
- assert_same_image "racecar-100x100-monochrome.jpg", variant
+ assert_same_image "racecar-100x100-monochrome.jpg", variant
end
end