Related: A side gig for RuboCop, the Bookworm code crawler for code analysis, Ruby Security for type safety, Ruby Splats for type checking arguments
- Steep or Sorbet
- TypeProf
- Ruby Editor Support
- Error Report
- go to defintion
- minimal type anotations
TLDR: TypeProf is good
How to use typeprof
- Install VSCODE ruby typeprof
- put typeprof.conf.json
{
"typeprof": "experimental"
"rbs_dir": "sig/"
"diagnostic_severity": "info" # Error Level
"analysis_unit_dirs": [
]
}Analysis Unit Dirs
- Provide directory to be analyzed together, seperate anaylsiss
- as the project grows, will stop inference
- stop type inference between units
Ruby Constant is too complex
class P < Q
end
class A
class B < Z
class C < P
include M
Foo.new()
end
end
end- C::FOO
- M::FOO, P::FOO, Q::FOO
constant anylsis requires wholes programs
class MyApp
string.new(...)
endmodule M
class string
end
end
class myapp
include m
endHow to handle constants
- When a constsnatnt is defined
- when the inheritance hierarchy is changed
When including, include the scope
class MyApp
include M
include X # include ::M::X instead