Changes between Version 7 and Version 8 of MetricQuery


Ignore:
Timestamp:
Mar 21, 2013, 11:21:43 AM (12 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MetricQuery

    v7 v8  
    169169== Using metric queries from different interfaces == 
    170170 
    171 TODO: links 
     171Metric queries can be executed from the console interface. To learn about the usage, please visit this [ErlangShellInterface#Usingmetricqueries page] . 
    172172 
    173173== Metric analyser mode == 
     174The !RefactorErl supports querying bad smells in the code. This feature depends on the metric analyzer which is disabled by default. 
    174175 
    175 TODO 
     176{{{#!comment  
     177TODO: If Emacs support is stable, the description is needed to make wider enclosing the Emacs specific settings.. 
     178The metric analyser mode has to be manually enabled  by selecting Start metrics from the Server item in the RefactorErl menu in the Emacs interface of RefactorErl. Clicking Start metrics from the same menu turns the mode off. When Metrics mode is on, the status indicator displays Erlang Refact Metrics or a similar message.  
    176179 
    177 For details, see MetricAnalyserMode. 
     180When in metric analyser mode, the Emacs interface of RefactorErl displays the values of changed metrics after a transformation is invoked. The analyser opens up the Metrics Result buffer, and shows the expected and the current values of the measured metrics for all modules that have at least one metric that is out of bounds as shown in Figure 8. 
     181Values of metrics outside the user defined limits (”bad code smells”) can also be queried manually using Show bad smells in the Semantic query menu. Figure 9 shows the output of this query, which is quite similar to Figure 8; the main difference is that Figure 9 shows all bad metric values, while the other displays only those that are affected by the transformation. 
     182}}} 
     183 
     184The metric analyser mode has to be manually enabled. To learn about the commands please visit the following [ErlangShellInterface#Queryingbadsmells page] . 
     185 
     186When metrics mode is turned on, !RefactorErl initializes the internal metrics representation by creating the necessary tables, and loading them with the available module and function nodes. It also calculates the initial values of the metrics. 
     187 
     188The limits of the metrics can currently be configured by editing the file {{{metricmod.defs}}}. An example of the current format of the file is shown below: 
     189{{{#!erlang 
     190{module_metrics, [{line_of_code,{100,1000}}, 
     191{char_of_code,{100,60000}}, {number_of_fun,{0,10}}, ...]}. 
     192{function_metrics, [{line_of_code,{0,20}}, 
     193{char_of_code,{0,600}}, {function_sum,{0,infty}}, ...]}. 
     194}}} 
     195 
     196The file contains two Erlang terms, one for the module level metrics and another for the function level metrics. The metrics analyser system has built-in defaults; any options given here override the defaults. For a given metric, the lower and upper limits can be given, e.g. the limits on the lines of code in the module are overridden in this file so that they are considered correct only if they are between 100 and 1000. 
     197 
     198For example, the module a has 5 lines of code, which does not fit the arbitrary range 10..20, so module a has bad smell which can be queried.