turboladen / tailor

A RubyGem that allows for checking standard styling of Ruby files.
146 stars 18 forks source link

Odd behavior with a heredoc followed by braces-with-spaces #124

Closed miketheman closed 8 years ago

miketheman commented 11 years ago

Given the following foo.rb:

def some_cmd
  if true
    <<-SOME_CMD.gsub(/ {10}/, '')
      #{something.join}
    SOME_CMD
    state = "pass"
  else
    <<-SOME_CMD.gsub(/ {10}/, '')
      #{something.map {}.join}
    SOME_CMD
    state = "fail"
  end
end

I get:

# Problems:
#  1.
#    * position:  8:23
#    * property:  spaces_after_lbrace
#    * message:   Line has 0 space(s) after a {, but should have 1.

So: A heredoc opener followed by a method that includes braces in a gsub AND followed by a string interpolation containing spaces triggers this.

Pretty odd, for sure.

turboladen commented 11 years ago

Man, you're finding all kinds of good ones! I swear I'll be getting to these at some point...

On Jan 21, 2013, at 18:16, Mike Fiedler notifications@github.com wrote:

Given the following foo.rb:

def some_cmd if true <<-SOME_CMD.gsub(/ {10}/, '') #{something.join} SOME_CMD state = "pass" else <<-SOME_CMD.gsub(/ {10}/, '') #{something.map {}.join} SOME_CMD state = "fail" endend

I get:

Problems:# 1.# * position: 8:23# * property:

spaces_after_lbrace# * message: Line has 0 space(s) after a {, but should have 1.

So: A heredoc opener followed by a method that includes braces in a gsub AND followed by a string interpolation containing spaces triggers this.

Pretty odd, for sure.

— Reply to this email directly or view it on GitHubhttps://github.com/turboladen/tailor/issues/124.

miketheman commented 11 years ago

BTW - reconfirmed this is still an issue with 1.2.1

miketheman commented 8 years ago

Closing old issue, can't repro very well.