| | 12 | === Duplicated code analysis === |
| | 13 | ==== Functions ==== |
| | 14 | * clone_identifierl/0: uses the default values of properties |
| | 15 | * clone_identifierl/1: takes a proplist as described above |
| | 16 | |
| | 17 | The default output format in this interface is the {{{nodes}}}, because for scripting {{{nodes}}} is the proper output format. |
| | 18 | However, any of the [CloneIdentifiErl#Algorithmsandprovidedservices available output formats] can be requested. |
| | 19 | |
| | 20 | * nodes: Returns the internal identifiers of the found clone groups. It is a good choice if you wish to further process the result by scripting using the ris interface. |
| | 21 | Command: {{{ris:clone_identifierl([{algorithm,sw_metrics}, {files,[ucl_alg_dm]}, {format,nodes}]).}}} |
| | 22 | {{{ |
| | 23 | [[[{entity,{'$gn',form,2}}],[{entity,{'$gn',form,3}}]]] |
| | 24 | }}} |
| | 25 | |
| | 26 | |
| | 27 | ==== Result query functions ==== |
| | 28 | * show_dupcode/1 |
| | 29 | * show_dupcode/2 |
| | 30 | * show_dupcode_group/2 |
| | 31 | * show_dupcode_group/3 |
| | 32 | |
| | 33 | To find more information about these functions and their parameters please visit ErlangShellInterface. |
| | 34 | |
| | 35 | |
| | 36 | The result of the duplicated code detection can be used for scripting. |
| | 37 | |
| | 38 | ==== Example ==== |
| | 39 | |
| | 40 | We want to get every function that calls a duplicated code function. |
| | 41 | {{{#!erlang |
| | 42 | Clones = ris:clone_identifierl([{algorithm,sw_metrics}]). |
| | 43 | Calls = ris:q([lists:flatten(Clones),".called_by"]). |
| | 44 | ris:print(Calls). |
| | 45 | }}} |