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

  1. Provide directory to be analyzed together, seperate anaylsiss
  2. as the project grows, will stop inference
  3. 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
  1. C::FOO
  2. M::FOO, P::FOO, Q::FOO

constant anylsis requires wholes programs

class MyApp
string.new(...)
end
module M
class string
end
end
class myapp
include m
end

How to handle constants

  1. When a constsnatnt is defined
  2. when the inheritance hierarchy is changed

When including, include the scope

class MyApp
include M
include X # include ::M::X instead