standard icon indicating copy to clipboard operation
standard copied to clipboard

rubyfmt compatibility

Open fables-tales opened this issue 3 years ago • 2 comments

there was only one formatting issue when we compat checked standard and rubyfmt which is how it formats something like this:

module Foo
  
  # the blankline above is what rubyfmt does, standard removes it
  def bees
  end
end

if we fix this then standard should be formattingwise compatible with rubyfmt

fables-tales avatar Nov 10 '22 21:11 fables-tales

i was hoping to start using rubyfmt in my project and ran into a few conflicts. i setup a small repro here:

https://github.com/schpet/ruby-fmt-standard/pull/1

the github actions output show some of the errors:

  example.rb:4:7: Layout/SpaceInLambdaLiteral: Do not use spaces between `->` and `(` in lambda literals.
  example.rb:11:1: Layout/EmptyLinesAroundExceptionHandlingKeywords: Extra empty line detected before the `rescue`.
  example.rb:17:17: Style/MethodCallWithoutArgsParentheses: Do not use parentheses for method calls with no arguments.

as a workaround i can use rubocop's --except Layout,Style

bundle exec standardrb --except Layout,Style

but i'm wondering if it would make sense to be able to turn these off in the standard.yml file (i.e. formatting: false or similar)

schpet avatar Feb 02 '23 17:02 schpet

@schpet thanks for posting this! The long-term goal of Standard & rubyfmt has always been eventual agreement in formatting rules. FWIW, my opinion here is the Layout/EmptyLinesAroundExceptionHandlingKeywords and Style/MethodCallWithoutArgsParentheses rules are appropriate and I'd like to keep them.

I am indifferent about Layout/SpaceInLambdaLiteral and could probably be swayed that stabby lambdas (->()) are kinda weird and it'd be more consistent to put a space there if other folks aren't too in love with that style

searls avatar Feb 16 '23 22:02 searls