diff --git a/.rubocop.yml b/.rubocop.yml index 15bd835..b5a58ca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,3 +17,5 @@ Layout/EndAlignment: EnforcedStyleAlignWith: variable Layout/FirstArrayElementIndentation: EnforcedStyle: consistent +Gemspec/DevelopmentDependencies: + Enabled: false diff --git a/lib/nazar.rb b/lib/nazar.rb index 2543ca6..a125fd9 100644 --- a/lib/nazar.rb +++ b/lib/nazar.rb @@ -33,7 +33,7 @@ module Nazar # rubocop:disable Metrics/ModuleLength setting :enable_shorthand_method, default: true - class << self + class << self # rubocop:disable Metrics/ClassLength def formatters @formatters ||= Set.new end diff --git a/lib/nazar/formatter/generic.rb b/lib/nazar/formatter/generic.rb index 451574f..cbd3b91 100644 --- a/lib/nazar/formatter/generic.rb +++ b/lib/nazar/formatter/generic.rb @@ -27,7 +27,7 @@ def summary end def self.valid?(data) - return unless data.is_a?(Enumerable) + return false unless data.is_a?(Enumerable) item = data&.first item.respond_to?(:keys) && item.respond_to?(:values) diff --git a/lib/nazar/formatter/struct.rb b/lib/nazar/formatter/struct.rb index d5f0502..5be1eb9 100644 --- a/lib/nazar/formatter/struct.rb +++ b/lib/nazar/formatter/struct.rb @@ -3,7 +3,6 @@ module Nazar module Formatter class Struct - def initialize(item) @collection = Array(item) @attributes = item.to_h.keys @@ -24,7 +23,7 @@ def headers def cells @cells ||= @collection.map do |item| - item.each_pair do |column, value| + item.each_pair do |_, value| CellFormatter.new(value, type: nil).format end end diff --git a/spec/nazar/view_spec.rb b/spec/nazar/view_spec.rb index 0973a0c..b563916 100644 --- a/spec/nazar/view_spec.rb +++ b/spec/nazar/view_spec.rb @@ -66,7 +66,6 @@ context 'with Struct' do let(:data) { Struct.new(:id, :name).new(1, 'foo') } - context 'without loaded extension' do it do expect(subject).not_to be_supported_data diff --git a/spec/nazar_spec.rb b/spec/nazar_spec.rb index f55e8c9..f48cc71 100644 --- a/spec/nazar_spec.rb +++ b/spec/nazar_spec.rb @@ -15,7 +15,7 @@ context 'when Pry is defined' do it do - ::Pry = double + ::Pry = double # rubocop:disable Style/RedundantConstantBase expect(Nazar).to receive(:enable_for_pry!) expect(Nazar).not_to receive(:enable_for_irb!) @@ -26,7 +26,7 @@ context 'when IRB is defined' do it do - ::IRB = double + ::IRB = double # rubocop:disable Style/RedundantConstantBase expect(Nazar).not_to receive(:enable_for_pry!) expect(Nazar).to receive(:enable_for_irb!)