Module wrangler_api

This module describes the refactoring commands that can be run in an Erlang shell.

Copyright © 2006-2011 Huiqing Li, Simon Thompson

Version: 0.1

Authors: Huiqing Li, Simon Thompson [web site: http://www.cs.kent.ac.uk/projects/wrangler].

Description

This module describes the refactoring commands that can be run in an Erlang shell.

All refactorings commands should be run in the context of a Wrangler application. Use wrangler_api:start() to start a Wrangler application, and wrangler_api:stop() the application.

The Wrangler API is not completed yet, more API functions will be added.

Function Index

move_fun/5Move a function to another module.
rename_fun/5Rename a function.
rename_mod/3Rename a module.
similar_code/7Similar code detection.
start/0Start a Wrangler application.
stop/0Stop a Wrangler application.
undo/0Undo the previous refactoring.

Function Details

move_fun/5

move_fun(FromModOrFileName::modulename() | filename(), FunName::atom(), Arity::integer(), ToModOrFileName::modulename() | filename(), SearchPaths::[dir()]) -> {ok, FilesChanged::[filename()]} | {error, Reason}

Move a function to another module.

This refactoring moves the function specified, together with functions that are only used by the function to be moved, to the target module. This refactorings affects all those modules in which the function to be moved is used, and returns either ok with the list of files affected by this refactoring, or an error message.

rename_fun/5

rename_fun(ModOrFileName::modulename() | filename(), FunName::atom(), Arity::integer(), NewFunName::atom(), SearchPaths::[dir()]) -> {ok, FilesChanged::[filename()]} | {error, Reason}

Rename a function.

This refactoring affects all those modules in which the function renamed is used, and returns either ok with the list of files affected by this refactoring, or an error message.

rename_mod/3

rename_mod(ModorFileName::modulename() | filename(), NewModName::modulename(), SearchPaths::[dir()]) -> {ok, FilesChanged::[filename()]} | {error, Reason}

Rename a module.

This refactoring affects all those modules in which the module name is used, and returns either ok with the list of files affected by this refactoring, or an error message.

similar_code/7

similar_code(DirFileList::[filename() | dir()], MinLen::integer(), MinToks::integer(), MinFreq::integer(), MaxVars::integer(), SimiScore::float(), SearchPaths::[dir()]) -> {ok, string()} | {error, Reason}

Similar code detection.

A similar code detector which takes an Erlang project (or just a collection of Erlang files) and a set of parameters as input, performs clone detection, and reports the clone classes found. Five parameters, which are of a conjunction relation, can be specified so that the user can have control of the granularity of the clone classes reported. These parameters are:
MinLen: the minimum number of expressions included in a code clone which is a sequence of expressions;
MinToks: the minimum number of tokens included in a code clone (minimum value: 20);
MinFreq: the minimum number of duplications of a cloned code fragment (minimum value: 2);
MaxVars: the maximum number of new parameters of the least-general common abstraction function;
SimiScore: the similarity score threshold which is between 0.1 and 1.0.

start/0

start() -> {ok, Pid} | {error, Reason}

Start a Wrangler application.

stop/0

stop() -> ok

Stop a Wrangler application.

undo/0

undo() -> {ok, FilesChanged::[filename()]} | {error, Reason}

Undo the previous refactoring. This only works within a Wrangler application.


Generated by EDoc, Jan 18 2011, 11:56:20.