ruby/typeprof

[Feature Request] --exclude-untyped option for better typing experience

nullnull opened this issue · 2 comments

Background

When trying to add types to complex ruby projects (e.g, Ruby on Rails), it will be hard to analyze correctly entire projects and we will need to add types manually.
But even if we specify types based on typeprof outpus, running typeprof again will override our manually typed files.

What do you want

I think we need --exclude-untyped options.
For example, I want to analyze Ruby on Rails projects like following steps.
FYI Pocke san's blog

  • download gem_rbs (e.g, git submodule add https://github.com/ruby/gem_rbs.git gem_rbs)
  • Run rbs_rails rake task (bin/rake rbs_rails:all )
  • Run typeprof with --exlude-untyped to analyze types (typeprof --exclude-untyped gem_rbs/gems/**/*.rbs sig/rbs_rails**/*.rbs app/models/*.rb -o sig/typeprof/models.rbs)
  • Run typeprof to output prototype or run rbs prototype (typeprof gem_rbs/gems/**/*.rbs sig/rbs_rails**/*.rbs sig/typeprof/models.rbs -o sig/manual/models.rbs)
  • Edit sig/manual/models.rbs manually
  • Run steep with gem_rbs/gems/**/*.rbs , sig/rbs_rails**/*.rbs, sig/typeprof/*.rbs, sig/manual/*.rbs
mame commented

It makes sense! The option stops outputting a method declaration that has "untyped" in its arguments or return type, right? Or, TypeProf should show them in comments?

Anyway, that's a great idea! I'll try to implement in this week, thank you!

Thanks for your comment!

Well, showing "untyped" as comments seems better idea. It will make easier to check TypeProf behavior. So there may be something better option name.