Skip to content

Botches the code completely for keyword arguments with a comment #13933

@p-datadog

Description

@p-datadog

Given this file where a defaulted keyword argument is followed by a non-defaulted keyword argument with a comment:

class Foo
  def foo(a: 1,
    # comment about b
    b:)
  end
end

Running rubocop -A totally botches the syntax (besides making the comment no longer associated with the code that the comment is intended for):

# frozen_string_literal: true

class Foo
  def foo(b:, a: 1,
          # comment about b)
  end
end

Expected result: leave the code alone when there are comments involved

 rubocop -V
1.50.2 (using Parser 3.3.5.0, rubocop-ast 1.32.3, running on ruby 3.3.4) [x86_64-linux]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy