28.11. FileMetrics

28.11.1. Description

FileMetrics reduction function computes a single telemetry stream representing project size information.

28.11.2. Parameter

Table 28.10. 

ParameterDescriptionDefault
fileTypeThe type of file to be included in computation. You can use a wildcard '*' to include all file types. Or you can supply a value that corresponds to the actual file type in your 'FileMetric' sensor data, such as 'Java', 'C', 'Perl'.*
sizeMetricsNameThe size metrics name. This is a value that corresponds to the actual metrics name in your 'FileMetric' sensor data, such as 'totalLines', 'classCount', 'functionCount', 'commentLines', 'numFiles'.totalLines
filePatternAnt-like file pattern specifying the files to be included in computation.**

28.11.3. Example 1

Example 28.14. Filemetric

streams JavaFileMetricStream(filePattern) = {
   "Java SLOC",
   FileMetric("Java", "sourceLines", filePattern)
};

y-axis yAxis(label) = {label};

chart JavaFileMetricChart(filePattern) = {
  "Java Size in SLOC", 
  (JavaFileMetricStream(filePattern), yAxis("SLOC"))
};

draw JavaFileMetricChart("**");

This chart shows the number of source lines in all Java files in the project.

28.11.4. Example 2

Example 28.15. Filemetric

streams JavaFileMetricStream(filePattern, metricName) = {
   "Java SLOC",
   FileMetric("Java", metricName, filePattern)
};

y-axis yAxis(label) = {label};

chart JavaFileMetricChart(filePattern) = {
  "Java Size in Classes, Methods, SLOC", 
  (JavaFileMetricStream(filePattern, "classCount"), yAxis("Classes")),
  (JavaFileMetricStream(filePattern, "functionCount"), yAxis("Methods")),
  (JavaFileMetricStream(filePattern, "sourceLines"), yAxis("SLOC"))
};

draw JavaFileMetricChart("**");

This chart contains three telemetry streams. One for the number of source lines in all Java files, one for the number of all Java methods, and the final one for the number of Java classes in the project.