CraigWilliams/BeautifyRuby

Multi-line regex formatted badly

Opened this issue · 1 comments

Before:

[snip]....
        allow do
          origins %r{\A
            https?://                 # allow http, or https
            (?:[a-zA-Z0-9]            # optional subdomain
               [a-zA-Z0-9-]+          #
               [a-zA-Z0-9]\.)*        #
            (#{hosts.join '|'})       # allowed hosts
            (?::(#{ports.join '|'}))?
          \z}x

          resource '*',
            headers: :any,
            methods: [:get, :post, :delete, :put, :options, :head, :patch],
            max_age: 0
        end
      end
    end
  end
end

After BeautifyRuby:

[snip]...
        allow do
          origins %r{\A
                     https?://                 # allow http, or https
                     (?:[a-zA-Z0-9]            # optional subdomain
                      [a-zA-Z0-9-]+          #
                      [a-zA-Z0-9]\.)*        #
                     (#{hosts.join '|'})       # allowed hosts
                      (?::(#{ports.join '|'}))?
                           \z}x

                           resource '*',
                           headers: :any,
                           methods: [:get, :post, :delete, :put, :options, :head, :patch],
                           max_age: 0
                           end
                           end
                           end
                           end
                           end

I'm seeing this issue too, I'd love a fix, but a workaround is to comment out the regexs before checkin, then run beautifyruby, then uncomment them.