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
Beyond the RuboCop Defaults
koic
3
2.7k
Minify Ruby Code
koic
2
2.1k
Permanent Agility
koic
37
7.5k
RuboCop: LSP and Prism
koic
3
4.1k
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
The Resurrection of the Fast Parallel Test Runner
koic
1
6.2k
Other Decks in Programming
See All in Programming
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Quine, Polyglot, 良いコード
qnighy
4
640
最新TCAキャッチアップ
0si43
0
140
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
みんなでプロポーザルを書いてみた
yuriko1211
0
260
CSC509 Lecture 12
javiergs
PRO
0
160
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
イベント駆動で成長して委員会
happymana
1
320
C++でシェーダを書く
fadis
6
4.1k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Featured
See All Featured
How GitHub (no longer) Works
holman
310
140k
The Invisible Side of Design
smashingmag
298
50k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Writing Fast Ruby
sferik
627
61k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Making Projects Easy
brettharned
115
5.9k
It's Worth the Effort
3n
183
27k
Statistics for Hackers
jakevdp
796
220k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
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Ͱ ରॲ͢ΔΑ͏ʹ͍ͯ͠Δ ͱͱજΜͰ͍ͨͱͷରቂ ͪΖΜͦͷ13Ͱͷมߋ͕దͰ͋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XPSME 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