Ragex.Editor.Conflict
(Ragex v0.11.0)
View Source
Conflict detection for refactoring operations.
Detects potential conflicts before applying refactoring changes:
- Name conflicts (duplicate names)
- Scope conflicts (visibility issues)
- Dependency conflicts (broken references)
- Concurrent modifications (file changed since analysis)
- Visibility conflicts (private function made public with broken callers)
Summary
Functions
Checks for concurrent file modifications.
Checks for conflicts when extracting a module.
Checks for conflicts when moving a function between modules.
Checks for naming conflicts when renaming a function.
Checks for visibility conflicts when changing function visibility.
Types
@type conflict() :: %{ type: conflict_type(), severity: :error | :warning | :info, message: String.t(), file: String.t() | nil, line: pos_integer() | nil, suggestion: String.t() | nil }
@type conflict_result() :: %{ has_conflicts: boolean(), conflicts: [conflict()], stats: %{ errors: non_neg_integer(), warnings: non_neg_integer(), infos: non_neg_integer() } }
@type conflict_type() ::
:name_conflict
| :scope_conflict
| :dependency_conflict
| :concurrent_modification
| :visibility_conflict
Functions
@spec check_concurrent_modification(String.t(), integer() | nil) :: {:ok, conflict_result()}
Checks for concurrent file modifications.
Parameters
file_path: Path to fileexpected_mtime: Expected modification time (from when analysis was done)
Returns
{:ok, conflict_result}with any detected conflicts
@spec check_extract_module_conflicts(atom(), atom(), [{atom(), non_neg_integer()}]) :: {:ok, conflict_result()}
Checks for conflicts when extracting a module.
Parameters
source_module: Module to extract fromnew_module: Name for new modulefunctions: List of {name, arity} tuples to extract
Returns
{:ok, conflict_result}with any detected conflicts
@spec check_move_conflicts(atom(), atom(), atom(), non_neg_integer()) :: {:ok, conflict_result()}
Checks for conflicts when moving a function between modules.
Parameters
source_module: Source moduletarget_module: Target modulefunction_name: Function to movearity: Function arity
Returns
{:ok, conflict_result}with any detected conflicts
@spec check_rename_conflicts(atom(), atom(), non_neg_integer()) :: {:ok, conflict_result()}
Checks for naming conflicts when renaming a function.
Parameters
module_name: Module containing the functionnew_name: Proposed new namearity: Function arity
Returns
{:ok, conflict_result}with any detected conflicts
@spec check_visibility_conflicts( atom(), atom(), non_neg_integer(), :public | :private ) :: {:ok, conflict_result()}
Checks for visibility conflicts when changing function visibility.
Parameters
module_name: Module containing functionfunction_name: Function namearity: Function aritynew_visibility: :public or :private
Returns
{:ok, conflict_result}with any detected conflicts