Skip to content

Cop idea: replace #strip_heredoc with squiggly heredoc in heredoc declarations #704

Closed
@ojab

Description

Is your feature request related to a problem? Please describe.

ruby>=2.3 has squiggly heredoc (<<~) which does the same as Rails #strip_heredoc method.

Describe the solution you'd like

Would be good to have a cop that suggests/autofixes code that using <<-TEXT.strip_heredoc -> <<~TEXT.

Describe alternatives you've considered

/shrug

Additional context

x = <<~TEXT
  some text
    second line
TEXT

y = <<-TEXT.strip_heredoc
  some text
    second line
TEXT

p x == y # => true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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