-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto-correctすると要素が消える #45
Comments
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this issue
Nov 5, 2018
Fixes rubocop/rubocop-jp#45. (This link is Japanese issue) This PR fixes an incorrect autocorrect for `Style/BracesAroundHashParameters` when the opening brace is before the first hash element. ```console % rubocop -V 0.60.0 (using Parser 2.5.1.2, running on ruby 2.5.1 x86_64-darwin17) % cat example.rb # frozen_string_literal: true foo = Foo.new( { foo: 'foo', bar: 'bar', baz: 'this is the last element'} ) ``` The following difference is the execution result of `rubocop -a` command. ## Before The last element is lost. ```diff diff --git a/example.rb b/example.rb index ecf9711..c9a02b8 100644 --- a/example.rb +++ b/example.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true foo = Foo.new( - { foo: 'foo', - bar: 'bar', - baz: 'this is the last element'} + foo: 'foo', + bar: 'bar' ) ``` ## After Remove only the braces. ```diff diff --git a/example.rb b/example.rb index ecf9711..57790da 100644 --- a/example.rb +++ b/example.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true foo = Foo.new( - { foo: 'foo', - bar: 'bar', - baz: 'this is the last element'} + foo: 'foo', + bar: 'bar', + baz: 'this is the last element' ) ```
フィードバックありがとうございます。auto-correct で Hash 要素が消える問題に対する PR を以下に開きました。 |
bbatsov
pushed a commit
to rubocop/rubocop
that referenced
this issue
Nov 5, 2018
Fixes rubocop/rubocop-jp#45. (This link is Japanese issue) This PR fixes an incorrect autocorrect for `Style/BracesAroundHashParameters` when the opening brace is before the first hash element. ```console % rubocop -V 0.60.0 (using Parser 2.5.1.2, running on ruby 2.5.1 x86_64-darwin17) % cat example.rb # frozen_string_literal: true foo = Foo.new( { foo: 'foo', bar: 'bar', baz: 'this is the last element'} ) ``` The following difference is the execution result of `rubocop -a` command. ## Before The last element is lost. ```diff diff --git a/example.rb b/example.rb index ecf9711..c9a02b8 100644 --- a/example.rb +++ b/example.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true foo = Foo.new( - { foo: 'foo', - bar: 'bar', - baz: 'this is the last element'} + foo: 'foo', + bar: 'bar' ) ``` ## After Remove only the braces. ```diff diff --git a/example.rb b/example.rb index ecf9711..57790da 100644 --- a/example.rb +++ b/example.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true foo = Foo.new( - { foo: 'foo', - bar: 'bar', - baz: 'this is the last element'} + foo: 'foo', + bar: 'bar', + baz: 'this is the last element' ) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-v 0.60.0 で、auto-correct時に要素が消える現象が起きましたので、報告致します。
auto-correct前のソースコード
rubocop -a
の出力auto-correct後のソースコード
Hoge.new
時にキーワード引数ではなくHashで渡しているのがイレギュラーではあると思いますが...The text was updated successfully, but these errors were encountered: