* Not marked public
* Not called from somewhere in the call graph of a function that's marked public, or your main function.
This isn't just simply public though, to be clear. It's "externally callable," that is, it can see transitively if something is just locally public or not.
You also can't dynamically generate functions at runtime, or do things like method_missing, so this ends up being much more complete than a similar analysis in a language with those sorts of features.
The issue with a lot of dynamic languages is things like monkey patching and reflection, which means that functions can be called at runtime but otherwise there is no way of checking beforehand.
Some people swear by this dynamic flexibility and the benefits it brings, but there are some serious downsides in terms of refactoring.
Dynamic language tooling is really like banging goddamn rocks together, and people take pride in that...
Your NiceHelper function gets one type as argument and returns the same type? Is it `void NiceHelper(...)`?
Severely restricting the number of `void X(...)` functions on your code helps a lot. Also `a someF(a)` is a type that is useful once in a while, but if it's useful all the time something may be broken.
I'm not really aware of a type system that enforces code actually be called. I know lots of linters do check for unused code, but generally only at the local level (ex - you imported/included X but never called it)
I agree 100% that it saves time during refactoring, but it's not going to catch that your NicheHelper class that was only called in one place is not called anymore. Nor is it going to find and highlight css that can be ditched as well.