Sha256: acdcd8fc6131ae05c9b5bef79f96ada90f00e71e2ab61b9a965d02edf6211de3
Contents?: true
Size: 988 Bytes
Versions: 26
Compression:
Stored size: 988 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Avoid empty metadata hash. # # @example EnforcedStyle: symbol (default) # # bad # describe 'Something', {} # # # good # describe 'Something' class EmptyMetadata < Base extend AutoCorrector include Metadata include RangeHelp MSG = 'Avoid empty metadata hash.' def on_metadata(_symbols, hash) return unless hash&.pairs&.empty? add_offense(hash) do |corrector| remove_empty_metadata(corrector, hash) end end private def remove_empty_metadata(corrector, node) corrector.remove( range_with_surrounding_comma( range_with_surrounding_space( node.source_range, side: :left ), :left ) ) end end end end end
Version data entries
26 entries across 26 versions & 5 rubygems