Igniter.Refactors.Rename (igniter v0.8.0)
View SourceRefactors for renaming things in a project
Summary
Functions
@spec rename_function( Igniter.t(), old :: {module(), atom()}, new :: {module(), atom()}, opts :: Keyword.t() ) :: Igniter.t()
Renames a function globally across a project.
Options
:arity-:any| integer | [integer]. The arity or arities of the function to rename. Defaults to:any.:deprecate-:soft | :hard. Leave the original function in place, but with a deprecation. Soft deprecations appear in documentation but do not cause warnings. Hard deprecations warn when they are called.
Renames a module globally across a project.
Renames the module everywhere it appears: defmodule, alias, use,
import, require, and all call sites. Also handles submodules, the
corresponding test module, string literals mentioning the module name, and
moves the file(s) to match the new module's proper location.
Alias handling
alias Foo.Bar— the alias declaration and allBar.*call sites are renamed.alias Foo.{Bar, Other}— the declaration and call sites are renamed. Spitfire does not macro-expand the brace form, so resolution falls back to an explicit AST scan.alias Foo.Bar, as: B— only the declaration is updated (alias Foo.Baz, as: B).B.*call sites are left untouched because theas:clause still resolves correctly.
Limitations
- Dynamic references (e.g.
apply/3,Module.concat/2with variables) are not rewritten. - String-literal replacement is a plain substring replace over the raw file content, so it also rewrites occurrences in comments and unrelated strings. Grep after.