Read-only mining codemod that inventories AngularJS .directive('name', ...) registrations for Angular migration assessment. No files are written to the target repo; findings are emitted as metrics only.
What it does
Finds every .directive('name', factory) call (including the dependency-injection array form, ['$dep', function($dep) {...}]) and inspects the directive-definition object (DDO) returned by the factory to classify:
Feature
Cardinality
Detected from
link function
has_link
DDO has a link property
compile function
has_compile
DDO has a compile property
Transclusion
has_transclude
DDO has a transclude property with a truthy value (not false)
Isolate scope
has_isolate_scope
DDO's scope property is an object literal (e.g. scope: {})
Restrict mode
restrict
DDO's restrict string ('E', 'A', 'EA', ...); empty if unspecified
Risk classification
Each directive is assigned exactly one risk level, from highest to lowest precedence:
Only directives registered with a literal string name are inventoried; dynamic names (e.g. .directive(variable, ...)) are skipped since they can't be classified statically.
The factory function must be an inline function/arrow function, optionally wrapped in a DI array. Factories referenced only by identifier (e.g. .directive('foo', fooFactory) where fooFactory is declared elsewhere) fall back to a best-effort scan for directive-like keys within the reachable subtree, and may under-report if not visible.