Rubocop ~> 1.0
This commit is contained in:
parent
a484d901a4
commit
02204b638e
|
@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||
spec.require_paths = ["lib"]
|
||||
spec.required_ruby_version = ">= 2.6.0"
|
||||
spec.metadata["rubygems_mfa_required"] = "true"
|
||||
spec.required_ruby_version = ">= 3.0"
|
||||
|
||||
spec.add_dependency "dry-transformer", "~> 0.1"
|
||||
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
||||
|
@ -26,5 +27,5 @@ Gem::Specification.new do |spec|
|
|||
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
||||
spec.add_development_dependency "rake", "~> 13"
|
||||
spec.add_development_dependency "rspec", "~> 3.9"
|
||||
spec.add_development_dependency "rubocop", "0.91"
|
||||
spec.add_development_dependency "rubocop", "~> 1.0"
|
||||
end
|
||||
|
|
|
@ -39,12 +39,9 @@ module Hanami
|
|||
# @since 0.3.5
|
||||
#
|
||||
# @see http://ruby-doc.org/core/Object.html#method-i-inspect
|
||||
#
|
||||
# rubocop:disable Style/FormatStringToken
|
||||
def inspect
|
||||
"#<#{self.class}:#{'0x0000%x' % (__id__ << 1)}#{__inspect}>"
|
||||
end
|
||||
# rubocop:enable Style/FormatStringToken
|
||||
|
||||
# @!macro [attach] instance_of?(class)
|
||||
#
|
||||
|
|
|
@ -11,7 +11,7 @@ module Hanami
|
|||
#
|
||||
# @since 0.8.0
|
||||
# @api private
|
||||
STRING_MATCHER = /\A[[:space:]]*\z/.freeze
|
||||
STRING_MATCHER = /\A[[:space:]]*\z/
|
||||
|
||||
# Checks if object is blank
|
||||
#
|
||||
|
|
|
@ -91,7 +91,7 @@ module Hanami
|
|||
#
|
||||
# @since 1.3.0
|
||||
# @api private
|
||||
TOKENIZE_REGEXP = /\((.*)\)/.freeze
|
||||
TOKENIZE_REGEXP = /\((.*)\)/
|
||||
|
||||
# Separator for .tokenize
|
||||
#
|
||||
|
|
|
@ -75,13 +75,13 @@ module Hanami
|
|||
def class_attribute(*attributes)
|
||||
attributes.each do |attr|
|
||||
singleton_class.class_eval %(
|
||||
def #{attr}
|
||||
class_attributes[:#{attr}]
|
||||
end
|
||||
|
||||
def #{attr}=(value)
|
||||
class_attributes[:#{attr}] = value
|
||||
end
|
||||
def #{attr} # def foo
|
||||
class_attributes[:#{attr}] # class_attributes[:foo]
|
||||
end # end
|
||||
#
|
||||
def #{attr}=(value) # def foo=(value)
|
||||
class_attributes[:#{attr}] = value # class_attributes[:foo] = value
|
||||
end # end
|
||||
), __FILE__, __LINE__ - 8
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ module Hanami
|
|||
# @api private
|
||||
#
|
||||
# @see Hanami::Utils::Kernel.Integer
|
||||
NUMERIC_MATCHER = %r{\A([\d/.+iE]+|NaN|Infinity)\z}.freeze
|
||||
NUMERIC_MATCHER = %r{\A([\d/.+iE]+|NaN|Infinity)\z}
|
||||
|
||||
# @since 0.8.0
|
||||
# @api private
|
||||
|
@ -1015,7 +1015,7 @@ module Hanami
|
|||
case arg
|
||||
when "" then raise TypeError.new "can't convert #{inspect_type_error(arg)}into Symbol"
|
||||
when ->(a) { a.respond_to?(:to_sym) } then arg.to_sym
|
||||
else
|
||||
else # rubocop:disable Lint/DuplicateBranch
|
||||
raise TypeError.new "can't convert #{inspect_type_error(arg)}into Symbol"
|
||||
end
|
||||
rescue NoMethodError
|
||||
|
@ -1043,7 +1043,7 @@ module Hanami
|
|||
# @since 0.4.3
|
||||
# @api private
|
||||
def self.inspect_type_error(arg)
|
||||
"#{(arg.respond_to?(:inspect) ? arg.inspect : arg.to_s)} "
|
||||
"#{arg.respond_to?(:inspect) ? arg.inspect : arg.to_s} "
|
||||
rescue NoMethodError
|
||||
# missing the #respond_to? method, fall back to returning the class' name
|
||||
begin
|
||||
|
|
|
@ -61,7 +61,7 @@ module Hanami
|
|||
#
|
||||
# @since 0.3.4
|
||||
# @api private
|
||||
CLASSIFY_WORD_SEPARATOR = /#{CLASSIFY_SEPARATOR}|#{NAMESPACE_SEPARATOR}|#{UNDERSCORE_SEPARATOR}|#{DASHERIZE_SEPARATOR}/.freeze # rubocop:disable Layout/LineLength
|
||||
CLASSIFY_WORD_SEPARATOR = /#{CLASSIFY_SEPARATOR}|#{NAMESPACE_SEPARATOR}|#{UNDERSCORE_SEPARATOR}|#{DASHERIZE_SEPARATOR}/ # rubocop:disable Layout/LineLength
|
||||
|
||||
@__transformations__ = Concurrent::Map.new
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe "Hanami::Utils.require!" do
|
|||
#
|
||||
# * on *NIX systems, instead of having /, we get \
|
||||
# * on Windows systems, instead of having \, we get /
|
||||
separator = File::SEPARATOR == "/" ? '\\' : "/"
|
||||
separator = File::SEPARATOR == "/" ? '\\' : "/" # rubocop:disable Style/StringLiterals
|
||||
directory = %w[spec support fixtures file_list].join(separator)
|
||||
Hanami::Utils.require!(directory)
|
||||
|
||||
|
|
|
@ -722,7 +722,7 @@ RSpec.describe Hanami::Interactor::Result do
|
|||
end
|
||||
|
||||
it "reports the object_id" do
|
||||
object_id = format("%x", (result.__id__ << 1)) # rubocop:disable Style/FormatStringToken
|
||||
object_id = format("%x", (result.__id__ << 1))
|
||||
expect(result.inspect).to match object_id
|
||||
end
|
||||
|
||||
|
|
|
@ -345,6 +345,7 @@ RSpec.describe Hanami::Logger do
|
|||
it "infers apptag from namespace" do
|
||||
module App2
|
||||
class TestLogger < Hanami::Logger; end
|
||||
|
||||
class Bar
|
||||
def hoge
|
||||
TestLogger.new.application_name
|
||||
|
@ -618,7 +619,7 @@ RSpec.describe Hanami::Logger do
|
|||
|
||||
describe "with filters" do
|
||||
it "filters values for keys in the filters array" do
|
||||
expected = %s({"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "credit_card"=>{"number"=>"[FILTERED]", "name"=>"[FILTERED]"}, "user"=>{"login"=>"[FILTERED]", "name"=>"John"}})
|
||||
expected = :"{\"password\"=>\"[FILTERED]\", \"password_confirmation\"=>\"[FILTERED]\", \"credit_card\"=>{\"number\"=>\"[FILTERED]\", \"name\"=>\"[FILTERED]\"}, \"user\"=>{\"login\"=>\"[FILTERED]\", \"name\"=>\"John\"}}"
|
||||
|
||||
output = with_captured_stdout do
|
||||
class TestLogger < Hanami::Logger; end
|
||||
|
@ -635,7 +636,7 @@ RSpec.describe Hanami::Logger do
|
|||
|
||||
describe "without filters" do
|
||||
it "outputs unfiltered params" do
|
||||
expected = %s({"password"=>"password", "password_confirmation"=>"password", "credit_card"=>{"number"=>"4545 4545 4545 4545", "name"=>"John Citizen"}, "user"=>{"login"=>"John", "name"=>"John"}})
|
||||
expected = :"{\"password\"=>\"password\", \"password_confirmation\"=>\"password\", \"credit_card\"=>{\"number\"=>\"4545 4545 4545 4545\", \"name\"=>\"John Citizen\"}, \"user\"=>{\"login\"=>\"John\", \"name\"=>\"John\"}}"
|
||||
|
||||
output = with_captured_stdout do
|
||||
class TestLogger < Hanami::Logger; end
|
||||
|
|
|
@ -5,6 +5,7 @@ require "bigdecimal"
|
|||
require "securerandom"
|
||||
require "hanami/utils/kernel"
|
||||
|
||||
# rubocop:disable Style/OpenStructUse
|
||||
RSpec.describe Hanami::Utils::Kernel do
|
||||
describe ".Array" do
|
||||
describe "successful operations" do
|
||||
|
@ -2477,7 +2478,7 @@ RSpec.describe Hanami::Utils::Kernel do
|
|||
end
|
||||
|
||||
describe "when a numeric in symbol is given" do
|
||||
let(:input) { :'123' }
|
||||
let(:input) { :"123" }
|
||||
|
||||
it "returns a true" do
|
||||
expect(@result).to eq true
|
||||
|
@ -2518,3 +2519,4 @@ RSpec.describe Hanami::Utils::Kernel do
|
|||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/OpenStructUse
|
||||
|
|
|
@ -117,9 +117,9 @@ RSpec.describe Hanami::Utils::String do
|
|||
expect(Hanami::Utils::String.capitalize("one-two-three")).to eq("One two three")
|
||||
|
||||
expect(Hanami::Utils::String.capitalize(:HanamiUtils)).to eq("Hanami utils")
|
||||
expect(Hanami::Utils::String.capitalize(:'hanami utils')).to eq("Hanami utils")
|
||||
expect(Hanami::Utils::String.capitalize(:"hanami utils")).to eq("Hanami utils")
|
||||
expect(Hanami::Utils::String.capitalize(:hanami_utils)).to eq("Hanami utils")
|
||||
expect(Hanami::Utils::String.capitalize(:'hanami-utils')).to eq("Hanami utils")
|
||||
expect(Hanami::Utils::String.capitalize(:"hanami-utils")).to eq("Hanami utils")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -150,9 +150,9 @@ RSpec.describe Hanami::Utils::String do
|
|||
it "returns a classified string from symbol" do
|
||||
expect(Hanami::Utils::String.classify(:hanami)).to eq("Hanami")
|
||||
expect(Hanami::Utils::String.classify(:hanami_router)).to eq("HanamiRouter")
|
||||
expect(Hanami::Utils::String.classify(:'hanami-router')).to eq("HanamiRouter")
|
||||
expect(Hanami::Utils::String.classify(:'hanami/router')).to eq("Hanami::Router")
|
||||
expect(Hanami::Utils::String.classify(:'hanami::router')).to eq("Hanami::Router")
|
||||
expect(Hanami::Utils::String.classify(:"hanami-router")).to eq("HanamiRouter")
|
||||
expect(Hanami::Utils::String.classify(:"hanami/router")).to eq("Hanami::Router")
|
||||
expect(Hanami::Utils::String.classify(:"hanami::router")).to eq("Hanami::Router")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -209,7 +209,7 @@ RSpec.describe Hanami::Utils::String do
|
|||
end
|
||||
|
||||
it "handles symbols" do
|
||||
string = Hanami::Utils::String.underscore(:'Hanami::Utils')
|
||||
string = Hanami::Utils::String.underscore(:"Hanami::Utils")
|
||||
expect(string).to eq("hanami/utils")
|
||||
end
|
||||
end
|
||||
|
@ -262,7 +262,7 @@ RSpec.describe Hanami::Utils::String do
|
|||
end
|
||||
|
||||
it "handles symbols" do
|
||||
string = Hanami::Utils::String.dasherize(:'Hanami Utils')
|
||||
string = Hanami::Utils::String.dasherize(:"Hanami Utils")
|
||||
expect(string).to eq("hanami-utils")
|
||||
end
|
||||
end
|
||||
|
@ -335,7 +335,7 @@ RSpec.describe Hanami::Utils::String do
|
|||
end
|
||||
|
||||
it "returns accepts a symbol initial string no match" do
|
||||
result = Hanami::Utils::String.rsub(:'authors/books/index', %r{/}, "#")
|
||||
result = Hanami::Utils::String.rsub(:"authors/books/index", %r{/}, "#")
|
||||
expect(result).to eq("authors/books#index")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue