Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rustでコードレビューを爆速自動化するアプリ作った

 Rustでコードレビューを爆速自動化するアプリ作った

2018/3/6 社内開発合宿で発表した内容です。
https://github.com/armorik83/ts-easy-reviewer

OKUNOKENTARO

March 06, 2018
Tweet

More Decks by OKUNOKENTARO

Other Decks in Technology

Transcript

  1. Ϟνϕʔγϣϯ w ݱҊ݅͸νʔϜϝϯόʔ͕ଟ͍ w ίʔ υ ϨϏϡʔ͸͢΂ͯ!PLVOPLFOUBSP͕୲౰ ʢࣗ෼ͷ13Λআ͘ʣ  w

    13ͷϨϏϡʔʹʙ෼͔͔Δ w ே13ཷ·ͬͯΔͱޕલ͕ऴΘΔ w ϨϏϡϫʔ΋ർΕ͖ͯͯࠣࡉͳϛεΛݟಀ͢ w Ͱ͖Δͱ͜Ζ͔Βߴ଎Խ ɾ ࣗಈԽ͍ͨ͠
  2. ཁ݅ w ϧʔϧϑΝΠϧ w ࣄલʹϧʔϧΛఆ͓ٛͯ͘͠ w ϧʔϧهड़͸%4-
 "class_implements 'Foo' and

    includes 'Bar' then error" w ϧʔϧϑΝΠϧҎԼͷσΟ ϨΫ τ ϦͰίϚϯυΛ࣮ߦ w ଈ࠲ʹ֘౰͢Δ΋ͷΛϩάʹදࣔͯ͠མͱ͢
  3. ͳͥ׳Εͳ͍͔ w ΏΔεΫ Ϧ ϓτݴޠʹਁͬͯ͠·͍ͬͯΔ͔Β w ίϯύΠϧَ͕ͷΑ ͏ʹݫ͍͠ w 5ZQF4DSJQUʹ׳Ε͍ͯͯ΋৺͕ંΕͦ͏ʹͳΔ͘

    Β͍
 ίϯύΠϧ͕௨Βͳ͍ w ॲཧΛߦ௥Ճͯ͠ɺ ͦͷίϯύΠϧΛ௨͢ͷʹ෼͔͔ͬͨ
  4. ͩΜͩΜ׳Εͯ͘ Δ w ͻͨ͢Β3VTUެࣜͷυΩϡϝϯ τΛಡΉ w ޾͍೔ຊޠ ʢͨͩ͠ݕࡧͯ͠ग़ͯ͘ Δ৘ใ͸େ൒͕ӳޠʣ 

    w ίϯύΠϧΤϥʔ ɾ ϝ οηʔδ͕਌੾ w ೔໨͘ Β͍͔Β3VTUͱ෼͔Γ߹͑ͨؾ࣋ͪʹͳͬͯ͘ Δ
  5. ίϯύΠ ϥ͕ಥવσϨΔ error[E0507]: cannot move out of borrowed content -->

    src/reviewer.rs:44:30 | 44 | println!("{:?}", config.rules.unwrap()); | ^^^^^^ cannot move out of borrowed content w ΤϥʔՕॴͷ໌ࣔ͸਌੾ w ͨͩͲ͏௚ͤ͹͍͍ͷ͔શવΘ͔Βͳ͍ w ͻͨ͢Βࢼߦࡨޡ
  6. ίϯύΠ ϥ͕ಥવσϨΔ error[E0507]: cannot move out of borrowed content -->

    src/reviewer.rs:44:19 | 44 | match config.rules { | ^^^^^^ cannot move out of borrowed content 45 | Some(rules) => { | ----- hint: to prevent move, use `ref rules` or `ref mut rules` w ͋ͷख͜ͷखΛ࢖ͬͯ΋ౖΒΕΔ w ͨΊ͠ʹNBUDIʹॻ͖׵͑ͯΈͨΒٸʹIJOUͱ͔ݴ͍ग़ͨ͠ w 3VTUͱ෼͔Γ߹͑ͨॠؒ
  7. ࣮૷ͨ͠΋ͷ w ໿ߦͷ3VTUίʔ υ w σΟ ϨΫ τ Ϧͷ5SBWFSTFS w

    ࠶ؼͰશϑΝΠϧΛ૸ࠪ w ϧʔϧ%4-ͷ1BSTFS w ಠࣗߏจΛղऍͯ͠ਖ਼نදݱνΣοΫ͢ΔͨΊͷߏ଄ମΛੜ੒ w ϧʔϧΛ࢖ͬͨ$IFDLFS w 3VMFߏ଄ମΛ࢖ͬͯϑΝΠϧΛਖ਼نදݱͰͻͨ͢ΒνΣοΫ w ݁Ռදࣔ༻ͷ3FQPSUFS w ࣦഊͨ͠ՕॴΛදࣔͯ͠ϓϩηεΛऴྃͤ͞ΔͨΊͷग़ྗ
  8. ར఺ w ͱʹ͔͘ॲཧ͕ߴ଎ w ׂͱϞμϯͳίʔ υͷݟͨ໨ w ଞͷݴޠͷܕ ɾ ؔ਺ύϥμΠϜ

    ɾ ઃܭͷϊ΢ϋ΢͸ͦͷ··࢖͑Δ w ෳ਺ݴޠܦݧऀͳΒָ͠ΊΔɺ ୈҰݴޠͱͯ͠͸खڧ͍͔΋ w ίϯϐϡʔλʔαΠΤϯεʹগ͠਌͠Έ΍͘͢ͳΔ w $16ͷؾ͕࣋ͪΘ͔Δ