BeautifyRuby icon indicating copy to clipboard operation
BeautifyRuby copied to clipboard

Multi-line regex formatted badly

Open l8nite opened this issue 11 years ago • 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

l8nite avatar Nov 13 '14 08:11 l8nite

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.

joebasirico avatar Jun 09 '15 05:06 joebasirico