Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Enter the OSS world [RuboCop] II. lost boundary
Search
Koichi ITO
December 09, 2017
Programming
1
2.4k
Enter the OSS world [RuboCop] II. lost boundary
Rails Developers Meetup 2017
https://railsdm.github.io/2017/
Koichi ITO
December 09, 2017
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Carving the Way to Ruby Engineering
koic
3
440
Beyond the RuboCop Defaults
koic
3
3k
Minify Ruby Code
koic
2
2.2k
Permanent Agility
koic
37
7.7k
RuboCop: LSP and Prism
koic
3
4.2k
Organizational Pattern Hatching
koic
0
1.5k
A Practitioner's Journey from Ruby 1.8 to Present
koic
1
2k
A Story Featuring Right Hand Archetype
koic
0
1.1k
Without Practice, No Emergence
koic
4
2.4k
Other Decks in Programming
See All in Programming
Haze - Real time background blurring
chrisbanes
1
510
Beyond ORM
77web
2
210
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
140
ドメインイベント増えすぎ問題
h0r15h0
1
190
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
たのしいparse.y
ydah
3
120
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
CSC305 Lecture 25
javiergs
PRO
0
130
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
4 Signs Your Business is Dying
shpigford
181
21k
Facilitating Awesome Meetings
lara
50
6.1k
Code Reviewing Like a Champion
maltzj
520
39k
Why Our Code Smells
bkeepers
PRO
335
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Mobile First: as difficult as doing things right
swwweet
222
9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Transcript
&OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME
<3VCP$PQ> **MPTUCPVOEBSZ &OUFSUIF044XPSME <3VCP$PQ> **MPTUCPVOEBSZ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ 5&$)1-":4)*#6:" ,PJDIJ*50FTN 4BU 3BJMT%FWFMPQFST.FFUVQ
None
None
8FMDPNFGFFECBDL (FNpMF HJU@TPVSDF HJUIVC \cSFQPcIUUQTHJUIVCDPN\SFQP^HJU^ ! HFNSBJMT HJUIVCSBJMTSBJMT HFNBDUJWFSFDPSEPSBDMF@FOIBODFEBEBQUFS HJUIVCbSTJNPSBDMF
FOIBODFE Preparing for upgrade to Rails 5.2 uses master branch instead of beta.
None
None
0DUPCFS 3VCP$PQSFMFBTFE
None
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
&QJTPEFT 1BSU* ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
Enter the OSS world RuboCop I. presage comment
1SFNPOJUJPO
"3BJMTBQQMJDBUJPO EFWFMPQNFOU
3FWJFXDPNNFOU
ࣗͨͪͷࢦఠͨ͜͠ͱ ଞͷػձͰࢦఠ͞Ε͏Δ
None
044 ใԽٕज़Λ௨ͯ͡ʜ 3JEFPO044
IUUQTUXJUUFSDPNPOLTUBUVT
&QJTPEFT 1BSU* ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
Enter the OSS world RuboCop II. lost boundary
044ʹͦΕͳΓʹ͋Γɺ ΞϓϦέʔγϣϯ͔Βܨ͕͍ͬͯ ΔҎ্ɺଞਓࣄͷίʔυͰͳ͍ 3JEFPO044
ؔΘΓํͷελΠϧྫ w۩ମతʹࠔ͍ͬͯΔ w͓͠Ζͦ͏ wແཧ͠ͳ͍ όʔϯΞτ͠ͳ͍Α͏τϦΞʔδ͢Δ
$MJDLlCVHzMBCFM
3BJMT).PS)0%FQFOEFOU
8IBUJTUIJT$PQ
CCBUTPWSVCPDPQ <'JY>'JYA3BJMT)BT.BOZ0S)BT0OF%FQFOEFOUA JODPSSFDUMZqBHTAXJUI@PQUJPOTACMPDLT
8SJUFSFQSPEVDUJPOTQFDT DPOUFYUXJUI@PQUJPOTEFQFOEFOUEFTUSPZEP JUEPFTOPUSFHJTUFSBOP⒎FOTFEP FYQFDU@OP@P⒎FOTFT 36#:TUSJQ@JOEFOU DMBTT1FSTPO XJUI@PQUJPOTEFQFOEFOUEFTUSPZEP IBT@POFGPP FOE
FOE 36#: FOE FOE # Goal: False positive don't occur below ! class Person with_options dependent: :destroy do has_one :foo end end
XJUI@PQUJPOTPG"45 SVCZQBSTFFXJUI@PQUJPOTEFQFOEFOUEFTUSPZEPcBTTPDc BTTPDIBT@POFGPPFOE` ! CMPDL TFOEOJMXJUI@PQUJPOT IBTI
QBJS TZNEFQFOEFOU TZNEFTUSPZ BSHT QSPDBSHBTTPD TFOE MWBSBTTPD IBT@POF TZNGPP
XJUI@PQUJPOTPG"45 QPXFSFECZIUUQTHJUIVCDPNLPJDSVCZ@BTU@WJTVBMJ[FS
*NQMFNFOUBUJPO 3FE (SFFO 3FGBDUPS 5FTUDPEFJTNPSFPCWJPVTBOEFBTJFSUP VOEFSTUBOEUIBOUIFPQFSBUJPOPG"45
0QFOB13
$POWFSTBUJPO AJT@IBT@NBOZ@PS@IBT@POF@XJUIPVU@PQUJPOT AJT BOFYJTUJOHNFUIPEOBNF
"CPVU/BNJOH1SFEJDBUF/BNF
EFG@OPEF@NBUDIFS EFG@OPEF@NBUDIFSJT@YYY 1"55&3/ TFOEOJM \IBT@NBOZIBT@POF^@ 1"55&3/ def_node_matcher dynamic
defines a method which applies a pattern to an AST node. /PUF/BNJOH1SFEJDBUF/BNFDPQEPFTOPUBXBSFPG EZOBNJDBMMZEFpOFENFUIPEPSMPXFS -JLFEFpOF@NFUIPE EFpOF@TJOHMFHPO@NFUIPE
$POWFSTBUJPO
"OUJGBU13
ผͱͯ͠Γग़ͤΔ Α͏Ͱ͋Εผͷ13Ͱ ରॲ͢ΔΑ͏ʹ͍ͯ͠Δ ͱͱજΜͰ͍ͨͱ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 ͱ044ͷίʔυܨ͕ΓͰ͋Δ &OUFSUIF044XPSME w Πϯλʔωοτͱ͍͏ڥքͷͳ͍ ੈքͰΓͱΓ͢Δ͓͠Ζ͞ w ࠷ॳͷҰา͕͚͠Ε044(BUF
ͳͲͷࢀՃ͔Β࢝ΊΔͷҰͭ ·ͱΊ
࣍ճ༧ࠂ
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
ࠒ͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕͏ܗʹͳ͍͔ͬͯ͘ͷ 1BSU***
&OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> ***
l Ұͷ͏ͪίʔυॻ͖ɺ 3VCZ,BJHJͳͲͷΓؒ Ͱ։ൃऀͨͪͱͦͷΛ͢Δ ʔ3VCZ,BJHJ1BSUZΑΓ
FOE