Shopify / constant_resolver

Resolve a partially qualified Ruby constant reference to the fully qualified name and the path of the file defining it.
MIT License
26 stars 10 forks source link

Remove error raising on no files in map #17

Closed gmcgibbon closed 4 years ago

gmcgibbon commented 4 years ago

If there are no files in the file map, why are raising an error? I could be misunderstanding, but I don't see the point of doing this.

exterm commented 4 years ago

Constant resolver returns nil for things it can't resolve. This usually means the constant is not defined in any of the given load paths - or the inflections are configured incorrectly.

This makes misconfiguration hard to detect, as on a real ruby project, you may have references to code that is not autoloaded, which legitimately returns nil.

The "no files" check is meant to detect the most basic misconfiguration where the given load paths don't contain ruby files.

exterm commented 4 years ago

No files in the map means constant resolver will not be able to resolve any constants.