-
Notifications
You must be signed in to change notification settings - Fork 547
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
OSS Gate Workshop: Tokyo: 2018-10-27: shoy75: rubocop: Work log #982
Comments
ライセンスを確認した |
サポーターの @june29 です、せいいっぱいがんばります ✨ 💪 |
Githubを見つけた |
READMEを読んでみる |
とりあえずインストールする |
Rubyスタイルガイドに沿ったルールがデフォルトっぽい |
gitterのリンクとかもREADMEにあっておもしろい |
インストールする |
|
Quickstartしてみる |
capistranoをダウンロードしてrubocopを動かしてみた
|
tips
|
Official manualがある |
コントリビューションのガイドライン見てみる |
バージョン確認方法ものってた
|
金じゃない話をしにきた |
READMEを読み終わった! |
Issueを見てみる! |
なんとなくいけそうだけど、、 |
再現してみる # test.rb
puts <<~EOF
aaaa
EOF $ rubocop -a test.rb
Inspecting 1 file
C
Offenses:
test.rb:1:6: C: [Corrected] Layout/SpaceAroundOperators: Surrounding space missing for operator <<.
puts <<~EOF
^^
1 file inspected, 1 offense detected, 1 offense corrected puts << ~EOF
aaaa
EOF |
#982 (comment) |
|
rubocopをローカルでbundle installしてbinding.irbとかで修正箇所を特定するのが良さそう |
|
puts <<FIRST
aaaa
FIRST
puts <<-SECOND
bbbb
SECOND
puts <<~THIRD
cccc
THIRD
|
エラーメッセージを生成しているところで
|
|
止めるとこ違ったけど、 |
|
sho@oss_gate_robocop/ $ bundle exec rubocop
Inspecting 2 files
From: /Users/sho/work/oss_gate_robocop/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/layout/indent_heredoc.rb @ line 90 :
85: active_support: 'strip_heredoc',
86: powerpack: 'strip_indent'
87: }.freeze
88:
89: def on_heredoc(node)
=> 90: binding.irb
91: body = heredoc_body(node)
92: return if body.strip.empty?
93:
94: body_indent_level = indent_level(body)
95:
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):001:0> node
=> s(:str, " aaaa\n")
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):002:0> heredoc_body(node)
=> " aaaa\n"
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):003:0> node.source
=> "<<FIRST"
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):004:0> quit
From: /Users/sho/work/oss_gate_robocop/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/layout/indent_heredoc.rb @ line 90 :
85: active_support: 'strip_heredoc',
86: powerpack: 'strip_indent'
87: }.freeze
88:
89: def on_heredoc(node)
=> 90: binding.irb
91: body = heredoc_body(node)
92: return if body.strip.empty?
93:
94: body_indent_level = indent_level(body)
95:
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):001:0> node
=> s(:str, " bbbb\n")
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):003:0> node.loc
=> #<Parser::Source::Map::Heredoc:0x00007fb9d6dc7188 @heredoc_body=#<Parser::Source::Range /Users/sho/work/oss_gate_robocop/test.rb 41...48>, @heredoc_end=#<Parser::Source::Range /Users/sho/work/oss_gate_robocop/test.rb 48...54>, @expression=#<Parser::Source::Range /Users/sho/work/oss_gate_robocop/test.rb 31...40>, @node=s(:str, " bbbb\n")>
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):004:0> node.source
=> "<<-SECOND"
irb(#<RuboCop::Cop::Layout::IndentHeredoc:0x00007fb9d6ced960>):005:0> quit
CC
Offenses:
test.rb:7:6: C: Layout/SpaceAroundOperators: Surrounding space missing for operator <<.
puts <<~THIRD
^^
test.rb:8:3: C: Layout/IndentationConsistency: Inconsistent indentation detected.
cccc
^^^^
Gemfile:1:8: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
source "https://rubygems.org"
^^^^^^^^^^^^^^^^^^^^^^
Gemfile:3:5: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
gem "rubocop"
^^^^^^^^^
2 files inspected, 4 offenses detected
sho@oss_gate_robocop/ $
|
おつかれさまでした! 後日引き続きワークショップがある場合後日のワークショップで再開する際に、issueタイトルの日付を更新してreopenしてください! ワークショップ終了後に続きがしたい場合issueはクローズしますが、その後も作業を続けていただいて大丈夫です! 是非このissueを活用なさってください。 今後のイベントの案内現在以下のイベントの開催を予定しています。
参加をお待ちしてます! |
This is a work log of a "OSS Gate workshop".
"OSS Gate workshop" is an activity to increase OSS developers.
Here's been discussed in Japanese. Thanks.
作業ログ作成時の説明
以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。
タイトル例↓:
OSS Gateワークショップ関連情報
The text was updated successfully, but these errors were encountered: