Add rubocop and fix some offences
But mostly just tune .rubocop.yml LOL
This commit is contained in:
parent
af4280299c
commit
0802b833aa
|
@ -1,4 +1,4 @@
|
|||
files:
|
||||
excluded:
|
||||
excluded:
|
||||
- lib/dry/core.rb
|
||||
- lib/dry/core/version.rb
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
AllCops:
|
||||
TargetRubyVersion: 2.1
|
||||
Exclude:
|
||||
- 'dry-core.gemspec'
|
||||
- 'spec/spec_helper.rb'
|
||||
|
||||
Style/SignalException:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
|
||||
Style/RedundantSelf:
|
||||
Exclude:
|
||||
- 'lib/dry/core/deprecations.rb'
|
||||
|
||||
Metrics/LineLength:
|
||||
Max: 110
|
||||
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
|
||||
Style/FileName:
|
||||
Exclude:
|
||||
- 'lib/dry-core.rb'
|
||||
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
1
Gemfile
1
Gemfile
|
@ -4,4 +4,5 @@ gemspec
|
|||
|
||||
group :tools do
|
||||
gem 'byebug', platform: :mri
|
||||
gem 'rubocop'
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|||
spec.authors = ['Nikita Shilnikov']
|
||||
spec.email = ['fg@flashgordon.ru']
|
||||
|
||||
spec.summary = %q{A toolset of small support modules used throughout the dry-rb ecosystem.}
|
||||
spec.summary = 'A toolset of small support modules used throughout the dry-rb ecosystem.'
|
||||
spec.description = spec.summary
|
||||
spec.homepage = 'https://github.com/dry-rb/dry-code'
|
||||
spec.license = 'MIT'
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
require 'dry-core'
|
|
@ -1,6 +1,8 @@
|
|||
require "dry/core/version"
|
||||
require 'dry/core/version'
|
||||
|
||||
# :nodoc:
|
||||
module Dry
|
||||
# :nodoc:
|
||||
module Core
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Dry
|
|||
attr_reader :name
|
||||
attr_reader :parent
|
||||
|
||||
def initialize(name: , parent: Object)
|
||||
def initialize(name:, parent: Object)
|
||||
@name = name
|
||||
@parent = parent
|
||||
end
|
||||
|
|
|
@ -65,7 +65,7 @@ module Dry
|
|||
def message(msg)
|
||||
<<-MSG
|
||||
#{msg}
|
||||
#{caller.detect { |l| l !~ /(lib\/dry\/core)|(gems)/ }}
|
||||
#{caller.detect { |l| l !~ %r{(lib/dry/core)|(gems)} }}
|
||||
MSG
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Dry
|
||||
module Core
|
||||
VERSION = '0.1.0'
|
||||
VERSION = '0.1.0'.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,11 +30,11 @@ RSpec.describe Dry::Core::ClassBuilder do
|
|||
end
|
||||
|
||||
it 'yields created class' do
|
||||
klass = builder.call { |yielded_class|
|
||||
klass = builder.call do |yielded_class|
|
||||
yielded_class.class_eval do
|
||||
def self.testing; end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
expect(klass).to respond_to(:testing)
|
||||
end
|
||||
|
|
|
@ -32,10 +32,10 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
|
||||
shared_examples_for 'an entity with deprecated methods' do
|
||||
it 'deprecates method that is to be removed' do
|
||||
res = subject.hello("world")
|
||||
res = subject.hello('world')
|
||||
|
||||
expect(res).to eql("hello world")
|
||||
expect(output).to match %r{\[spec\] Test(\.|#)hello is deprecated and will be removed}
|
||||
expect(res).to eql('hello world')
|
||||
expect(output).to match /\[spec\] Test(\.|#)hello is deprecated and will be removed/
|
||||
expect(output).to include('is no more')
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
res = subject.logging('foo')
|
||||
|
||||
expect(res).to eql('log: foo')
|
||||
expect(output).to match %r{\[spec\] Test(\.|#)logging is deprecated and will be removed}
|
||||
expect(output).to match /\[spec\] Test(\.|#)logging is deprecated and will be removed/
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -53,7 +53,7 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
extend Dry::Core::Deprecations
|
||||
|
||||
def self.name
|
||||
"Test"
|
||||
'Test'
|
||||
end
|
||||
|
||||
def self.log(msg)
|
||||
|
@ -63,7 +63,7 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
def self.hello(word)
|
||||
"hello #{word}"
|
||||
end
|
||||
deprecate_class_method :hello, message: "is no more"
|
||||
deprecate_class_method :hello, message: 'is no more'
|
||||
|
||||
def self.logging(msg)
|
||||
"logging: #{msg}"
|
||||
|
@ -83,7 +83,7 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
extend Dry::Core::Deprecations
|
||||
|
||||
def self.name
|
||||
"Test"
|
||||
'Test'
|
||||
end
|
||||
|
||||
def log(msg)
|
||||
|
@ -93,7 +93,7 @@ RSpec.describe Dry::Core::Deprecations do
|
|||
def hello(word)
|
||||
"hello #{word}"
|
||||
end
|
||||
deprecate :hello, message: "is no more"
|
||||
deprecate :hello, message: 'is no more'
|
||||
|
||||
def logging(msg)
|
||||
"logging: #{msg}"
|
||||
|
|
Loading…
Reference in New Issue