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

yard2steep 進捗報告

yard2steep 進捗報告

Meguro.rb#17 で yard2steep のリリース後の改善について話しました!
cf. https://megurorb.connpass.com/event/94480

2b4f9f20b554d4c77c46fe6a9930d6fe?s=128

Nao Minami

July 31, 2018
Tweet

More Decks by Nao Minami

Other Decks in Programming

Transcript

  1. ©2018 Wantedly, Inc. yard2steep ਐḿใࠂ 31.Jul.2018 - Nao Minami (@south37)

  2. ©2018 Wantedly, Inc. ࣗݾ঺հ

  3. ©2018 Wantedly, Inc. Nao Minami / @south37 Infrastructure engineer @

    Wantedly, Inc.
  4. ©2018 Wantedly, Inc.  ZBSETUFFQ͓͞Β͍  ZBSETUFFQਐḿใࠂ  ·ͱΊ ࠓ೔࿩͢಺༰

  5. ©2018 Wantedly, Inc. ZBSETUFFQ͓͞Β͍

  6. ©2018 Wantedly, Inc. ZBSETUFFQͱ͸

  7. ©2018 Wantedly, Inc.

  8. ©2018 Wantedly, Inc. ZBSETUFFQͱ͸ w 3VCZϓϩάϥϜதͷ:"3%Ξϊʔςʔγϣϯ ͔Βɺ4UFFQͷܕఆٛϑΝΠϧΛࣗಈੜ੒ w 4UFFQͱ૊Έ߹ΘͤΔࣄͰɺ:"3%Ͱ੩తܕݕ ࠪΛ࣮ݱʂ

  9. ©2018 Wantedly, Inc. 3VCZίʔυΛ༻ҙ͢Δ # lib/parser.rb class AST # @return

    [String] def to_s "AST" end # @param [Hash] opt def traverse!(opt) end end class Parser # @param [String] text # @param [Hash] opt # @return [AST] def parse(text, opt) ast = AST.new ast.traverse!(opt) ast end end
  10. ©2018 Wantedly, Inc. ZBSETUFFQίϚϯυΛ࣮ߦ $ yard2steep lib ZBSETUFFQͰܕఆٛϑΝΠϧΛੜ੒ # sig/parser.rbi

    class AST def to_s: -> String def traverse!: (Hash<any, any>) -> any end class Parser def parse: (String, Hash<any, any>) -> AST end
  11. ©2018 Wantedly, Inc. TUFFQͰܕνΣοΫ $ steep check lib TUFFQͰܕνΣοΫʂ:"3%ʹΑΔ੩తܕ෇͚Λ ࣮ݱʂ

  12. ©2018 Wantedly, Inc. ੩తܕ෇͖3VCZʂ

  13. ©2018 Wantedly, Inc. ZBSETUFFQਐḿใࠂ

  14. ©2018 Wantedly, Inc. ZBSETUFFQਐḿใࠂ ϦϦʔεޙͷػೳ௥Ճɾվળ

  15. ©2018 Wantedly, Inc. ZBSETUFFQϦϦʔεޙͷվળ w 3VCZQBSTFSͷվળ w ࣗલ࣮૷͔ΒɺSJQQFSϕʔεͷQBSTFS΁ͱҠߦͨ͠ w ղऍͰ͖ΔSVCZDPEFͷ෯͕޿͕ͬͨ

    w Ϧςϥϧఆ਺ͷܕ෇͚ w ϦςϥϧΛBTTJHOͯ͠࡞Δఆ਺ʹ͸ܕ৘ใΛ෇༩͢ΔΑ͏ʹͳͬͨ w BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU w HFUUFSNFUIPEʹ͍ͭͯ΋ɺܕఆٛΛੜ੒͢ΔΑ͏ʹͳͬͨ
  16. ©2018 Wantedly, Inc. ZBSETUFFQϦϦʔεޙͷվળ w 3VCZQBSTFSͷվળ w ࣗલ࣮૷͔ΒɺSJQQFSϕʔεͷQBSTFS΁ͱҠߦͨ͠ w ղऍͰ͖ΔSVCZDPEFͷ෯͕޿͕ͬͨ

    w Ϧςϥϧఆ਺ͷܕ෇͚ w ϦςϥϧΛBTTJHOͯ͠࡞Δఆ਺ʹ͸ܕ৘ใΛ෇༩͢ΔΑ͏ʹͳͬͨ w BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU w HFUUFSNFUIPEʹ͍ͭͯ΋ɺܕఆٛΛੜ੒͢ΔΑ͏ʹͳͬͨ
  17. ©2018 Wantedly, Inc.

  18. ©2018 Wantedly, Inc. 3VCZQBSTFSͷվળ w 3JQQFSTFYQΛར༻ w 3JQQFSTFYQ͸SVCZDPEFΛQBSTFͨ͠USFFߏ଄Λฦ͢ w USFFΛUSBWFSTFͯ͠ཉ͍͠৘ใΛऔΓग़ͤ͹0,

    w ίϝϯτͷऔಘʹ͸3JQQFSMFYΛར༻ w 3JQQFSTFYQ͸3VCZͷಈ࡞ʹӨڹ͠ͳ͍৘ใʢDGίϝϯτʣΛऔΓআ͍ͯ͠·͏ɻ ίϝϯτऔಘʹ͸ผͷखஈ͕ඞཁɻ w 3JQQFSMFY͸SVCZDPEFͷUPLFOΛฦ͢ɻAPO@DPNNFOUA͕ίϝϯτͳͷͰɺͦΕ Λऔಘɻ
  19. ©2018 Wantedly, Inc. ղऍͰ͖Δ3VCZͷ෯͕޿͕ͬͨʂ

  20. ©2018 Wantedly, Inc. ZBSETUFFQϦϦʔεޙͷվળ w 3VCZQBSTFSͷվળ w ࣗલ࣮૷͔ΒɺSJQQFSϕʔεͷQBSTFS΁ͱҠߦͨ͠ w ղऍͰ͖ΔSVCZDPEFͷ෯͕޿͕ͬͨ

    w Ϧςϥϧఆ਺ͷܕ෇͚ w ϦςϥϧΛBTTJHOͯ͠࡞Δఆ਺ʹ͸ܕ৘ใΛ෇༩͢ΔΑ͏ʹͳͬͨ w BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU w HFUUFSNFUIPEʹ͍ͭͯ΋ɺܕఆٛΛੜ੒͢ΔΑ͏ʹͳͬͨ
  21. ©2018 Wantedly, Inc.

  22. ©2018 Wantedly, Inc. Ϧςϥϧఆ਺ͷܕ෇͚ # lib/sample.rb class MyClass CONSTANT =

    "This is constant" CONSTANT2 = /this is re/ CONSTANT3 = :symbol_value CONSTANT4 = 1..2 CONSTANT5 = 34 CONSTANT6 = 2.34 CONSTANT7 = [1, 2] CONSTANT8 = { a: 3 } CONSTANT9 = true CONSTANT10 = false CONSTANT11 = nil end # sig/sample.rbi MyClass::CONSTANT: String MyClass::CONSTANT2: Regexp MyClass::CONSTANT3: Symbol MyClass::CONSTANT4: Range<any> MyClass::CONSTANT5: Integer MyClass::CONSTANT6: Float MyClass::CONSTANT7: Array<any> MyClass::CONSTANT8: Hash<any, any> MyClass::CONSTANT9: bool MyClass::CONSTANT10: bool MyClass::CONSTANT11: nil
  23. ©2018 Wantedly, Inc. Ϧςϥϧఆ਺ͷܕ෇͚͕ ग़དྷΔΑ͏ʹͳͬͨʂ

  24. ©2018 Wantedly, Inc. ZBSETUFFQϦϦʔεޙͷվળ w 3VCZQBSTFSͷվળ w ࣗલ࣮૷͔ΒɺSJQQFSϕʔεͷQBSTFS΁ͱҠߦͨ͠ w ղऍͰ͖ΔSVCZDPEFͷ෯͕޿͕ͬͨ

    w Ϧςϥϧఆ਺ͷܕ෇͚ w ϦςϥϧΛBTTJHOͯ͠࡞Δఆ਺ʹ͸ܕ৘ใΛ෇༩͢ΔΑ͏ʹͳͬͨ w BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU w HFUUFSNFUIPEʹ͍ͭͯ΋ɺܕఆٛΛੜ੒͢ΔΑ͏ʹͳͬͨ
  25. ©2018 Wantedly, Inc.

  26. ©2018 Wantedly, Inc. BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU # lib/sample.rb class SomeClass #

    @dynamic index, index=, count, count= attr_reader :index attr_writer :index attr_accessor :count end # sig/sample.rbi class SomeClass @index: any @count: any def index: -> any def index=: (any) -> any def count: -> any def count=: (any) -> any end
  27. ©2018 Wantedly, Inc. BUUS@XSJUFS BUUS@BDDFTTPSͰ࡞ΒΕΔ ϝιουͷܕ෇͚͕ग़དྷΔ༷ʹͳͬͨʂ

  28. ©2018 Wantedly, Inc. ·ͱΊ

  29. ©2018 Wantedly, Inc. ·ͱΊ w ZBSETUFFQ͕গͣͭ͠վળʂ w 3VCZQBSTFSͷվળ w Ϧςϥϧఆ਺ͷܕ෇͚

    w BUUS@XSJUFS BUUS@BDDFTTPSͷTVQQPSU w ͜Ε͔Β΋ɺ3VCZͰ)BQQZ)BDLJOH͠Α͏ʂ