Enter the OSS world [RuboCop] II. lost boundary

023b04c98f39cc041293d780352432ff?s=47 Koichi ITO
December 09, 2017

Enter the OSS world [RuboCop] II. lost boundary

Rails Developers Meetup 2017
https://railsdm.github.io/2017/

023b04c98f39cc041293d780352432ff?s=128

Koichi ITO

December 09, 2017
Tweet

Transcript

  1. &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
  2. None
  3. None
  4. 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.
  5. None
  6. None
  7. 0DUPCFS  3VCP$PQSFMFBTFE

  8. None
  9. ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ &QJTPEFT 1BSU* 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩

  10. &QJTPEFT 1BSU* ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩

  11. Enter the OSS world RuboCop I. presage comment

  12. 1SFNPOJUJPO

  13. "3BJMTBQQMJDBUJPO EFWFMPQNFOU

  14. 3FWJFXDPNNFOU

  15. ࣗ෼ͨͪͷࢦఠͨ͜͠ͱ͸ ଞͷػձͰ΋ࢦఠ͞Ε͏Δ

  16. None
  17. 044 ৘ใԽٕज़Λ௨ͯ͡ʜ 3JEFPO044

  18. IUUQTUXJUUFSDPNPOLTUBUVT

  19. &QJTPEFT 1BSU* ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ 1BSU** 1BSU*** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩

  20. ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩ 1BSU***

  21. Enter the OSS world RuboCop II. lost boundary

  22. 044ʹ΋໰୊͸ͦΕͳΓʹ͋Γɺ ΞϓϦέʔγϣϯ͔Βܨ͕͍ͬͯ ΔҎ্ɺଞਓࣄͷίʔυͰ͸ͳ͍ 3JEFPO044

  23. ؔΘΓํͷελΠϧྫ w۩ମతʹࠔ͍ͬͯΔ໰୊ w͓΋͠Ζͦ͏ wແཧ͠ͳ͍ όʔϯΞ΢τ͠ͳ͍Α͏τϦΞʔδ͢Δ

  24. $MJDLlCVHzMBCFM

  25. 3BJMT).PS)0%FQFOEFOU

  26. 8IBUJTUIJT$PQ

  27. CCBUTPWSVCPDPQ <'JY>'JYA3BJMT)BT.BOZ0S)BT0OF%FQFOEFOUA JODPSSFDUMZqBHTAXJUI@PQUJPOTACMPDLT

  28. 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
  29. XJUI@PQUJPOTPG"45 SVCZQBSTFFXJUI@PQUJPOTEFQFOEFOUEFTUSPZEPcBTTPDc BTTPDIBT@POFGPPFOE` ! CMPDL  TFOEOJMXJUI@PQUJPOT  IBTI 

    QBJS  TZNEFQFOEFOU   TZNEFTUSPZ   BSHT  QSPDBSHBTTPD   TFOE  MWBSBTTPD IBT@POF  TZNGPP
  30. XJUI@PQUJPOTPG"45 QPXFSFECZIUUQTHJUIVCDPNLPJDSVCZ@BTU@WJTVBMJ[FS

  31. *NQMFNFOUBUJPO 3FE (SFFO 3FGBDUPS 5FTUDPEFJTNPSFPCWJPVTBOEFBTJFSUP VOEFSTUBOEUIBOUIFPQFSBUJPOPG"45

  32. 0QFOB13

  33. $POWFSTBUJPO AJT@IBT@NBOZ@PS@IBT@POF@XJUIPVU@PQUJPOT AJT BOFYJTUJOHNFUIPEOBNF

  34. "CPVU/BNJOH1SFEJDBUF/BNF

  35. 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 EZOBNJDBMMZEFpOFENFUIPEPS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JDBUF/BNFADPQ

  50. 0QFOB13

  51. 5IFTFDPOEEFTJHO /BNJOH 1SFEJDBUF/BNF /BNJOH 1SFEJDBUF/BNF "EE .FUIPE%FpOF.BDSPT PQUJPOUPDPOpHVSBUJPO *OUFSOBM *NQSPWFNFOU

    &YJTUJOH DPQDMBTT
  52. %FpOFEFGBVMUQVCMJTIFE"1* DPOpHEFGBVMUZNM /BNJOH1SFEJDBUF/BNF .FUIPEEFpOJUJPONBDSPTGPSEZOBNJDBMMZHFOFSBUFENFUIPET .FUIPE%FpOJUJPO.BDSPT EFpOF@NFUIPE EFpOF@TJOHMFUPO@NFUIPE RuboCopར༻ऀ͕࢖͏σϑΥϧτͷެ։ϝ ιουΛconfig/default.ymlʹఆٛ͢Δ

  53. %FpOFJOUFSOBM"1* SVCPDPQZNM /BNJOH1SFEJDBUF/BNF .FUIPEEFpOJUJPONBDSPTGPSEZOBNJDBMMZHFOFSBUFENFUIPE .FUIPE%FpOJUJPO.BDSPT EFpOF@NFUIPE EFpOF@TJOHMFUPO@NFUIPE EFG@OPEF@NBUDIFS EFG@OPEF@TFBSDI RuboCopࣗମͷ։ൃͰ࢖͏಺෦తͳϝιου

    ΛՃ͑ͯ.rubocop.ymlʹఆٛ͢Δ
  54. w ར༻ऀʹରͯ͠΋ಈతͳϝιο υఆٛ΁ͷνΣοΫΛҰ؏͠ ͯͰ͖ΔΑ͏ʹͳͬͨ w ಈతͳϢʔβʔϝιουఆٛ ͕૿͑ΔΑ͏Ͱ͋Ε͹ઃఆΛ ௥Ճ͢Ε͹Α͍ *NQSPWFEEFTJHO

  55. None
  56. w 044DPNNVOJUZJT $PODMVTJPO

  57. 044 1SPQSJFUBSZ 4PDJBM 6OTPDJBM FH"OBQQMJDBUJPO EFWFMPQNFOU BGUFS(JU)VC FH"OBQQMJDBUJPO EFWFMPQNFOU CFGPSF(JU)VC

    *UJTPQFOUPUIF QVCMJDVOEFS044 MJDFOTFCVUUIFSFJT OPEJBMPHVF 044Y6OTPDJBM1VCMJDSFQP 044DPNNVOJUZ
  58. 044 1SPQSJFUBSZ 4PDJBM 6OTPDJBM FH"OBQQMJDBUJPO EFWFMPQNFOU BGUFS(JU)VC FH"OBQQMJDBUJPO EFWFMPQNFOU CFGPSF(JU)VC

    *UJTPQFOUPUIF QVCMJDVOEFS044 MJDFOTFCVUUIFSFJT OPEJBMPHVF 044Y4PDJBM044DPNNVOJUZ 044DPNNVOJUZ
  59. SVCZPOSBJMTPSH "O044DPNNVOJUZ

  60. None
  61. $MJDLIFSF

  62. None
  63. None
  64. w ϓϩδΣΫτͰѻ͍ͬͯΔίʔυ ͱ044ͷίʔυ͸஍ܨ͕ΓͰ͋Δ &OUFSUIF044XPSME  w Πϯλʔωοτͱ͍͏ڥքͷͳ͍ ੈքͰ΍ΓͱΓ͢Δ͓΋͠Ζ͞ w ࠷ॳͷҰา͕೉͚͠Ε͹044(BUF

    ͳͲ΁ͷࢀՃ͔Β࢝ΊΔͷ΋Ұͭ ·ͱΊ
  65. ࣍ճ༧ࠂ

  66. ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩ 1BSU***

  67. ೔ࠒ࢖͍ͬͯΔ044ͰͷൃݟΛ VQTUSFBNʹؐݩ͢Δ࿩ &QJTPEFT 1BSU* 1BSU** ιʔγϟϧίʔσΟϯάΛ௨ͯ͡Ͳ͏ Ϣʔβʔ͕࢖͏ܗʹͳ͍͔ͬͯ͘ͷ࿩ 1BSU***

  68. &OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> *** &OUFSUIF044XPSME <3VCP$PQ> ***

  69. l Ұ೥ͷ͏ͪ೔ίʔυॻ͖ɺ 3VCZ,BJHJͳͲͷ࢒Γ೔ؒ Ͱ։ൃऀͨͪͱͦͷ࿩Λ͢Δ ʔ3VCZ,BJHJ1BSUZΑΓ

  70. FOE