r7kamura / rspec-json_matcher

RSpec matcher for testing JSON string
MIT License
171 stars 10 forks source link

Style/TrailingCommaInArguments-20220512232440 #22

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Rubocop challenge!

Style/TrailingCommaInArguments

Safe autocorrect: Yes :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.

Description

Overview

This cop checks for trailing comma in argument lists. The supported styles are:

  • consistent_comma: Requires a comma after the last argument, for all parenthesized method calls with arguments.
  • comma: Requires a comma after the last argument, but only for parenthesized method calls where each argument is on its own line.
  • no_comma: Requires that there is no comma after the last argument.

Examples

EnforcedStyleForMultiline: consistent_comma

# bad
method(1, 2,)

# good
method(1, 2)

# good
method(
  1, 2,
  3,
)

# good
method(
  1, 2, 3,
)

# good
method(
  1,
  2,
)

EnforcedStyleForMultiline: comma

# bad
method(1, 2,)

# good
method(1, 2)

# bad
method(
  1, 2,
  3,
)

# good
method(
  1, 2,
  3
)

# bad
method(
  1, 2, 3,
)

# good
method(
  1, 2, 3
)

# good
method(
  1,
  2,
)

EnforcedStyleForMultiline: no_comma (default)

# bad
method(1, 2,)

# good
method(1, 2)

# good
method(
  1,
  2
)

Auto generated by rubocop_challenger