Sha256: a06fa7b1be7bc9dcb83fac8179bbc879c75437b607401a33a30d03862091f3be
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for trailing comma in argument lists. # # @example EnforcedStyleForMultiline: consistent_comma # # bad # method(1, 2,) # # # good # method(1, 2) # # # good # method( # 1, 2, # 3, # ) # # # good # method( # 1, # 2, # ) # # @example EnforcedStyleForMultiline: comma # # bad # method(1, 2,) # # # good # method(1, 2) # # # good # method( # 1, # 2, # ) # # @example EnforcedStyleForMultiline: no_comma (default) # # bad # method(1, 2,) # # # good # method(1, 2) # # # good # method( # 1, # 2 # ) class TrailingCommaInArguments < Cop include TrailingComma def on_send(node) return unless node.arguments? && node.parenthesized? check(node, node.arguments, 'parameter of %<article>s method call', node.last_argument.source_range.end_pos, node.source_range.end_pos) end alias on_csend on_send def autocorrect(range) PunctuationCorrector.swap_comma(range) end def self.autocorrect_incompatible_with [Layout::HeredocArgumentClosingParenthesis] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.80.1 | lib/rubocop/cop/style/trailing_comma_in_arguments.rb |
rubocop-0.80.0 | lib/rubocop/cop/style/trailing_comma_in_arguments.rb |