Class: RubyMaat::Analysis::Summary
- Inherits:
-
BaseAnalysis
- Object
- BaseAnalysis
- RubyMaat::Analysis::Summary
- Defined in:
- lib/ruby_maat/analysis/summary.rb
Overview
Summary analysis - provides high-level overview of repository statistics
Instance Method Summary collapse
Instance Method Details
#analyze(dataset, _options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ruby_maat/analysis/summary.rb', line 7 def analyze(dataset, = {}) df = dataset.to_df if df.empty? results = [ {statistic: "number-of-commits", value: 0}, {statistic: "number-of-entities", value: 0}, {statistic: "number-of-entities-changed", value: 0}, {statistic: "number-of-authors", value: 0} ] else # Collect data manually to avoid DataFrame API issues revisions = [] entities = [] = [] total_changes = 0 df.each_row do |row| revisions << row["revision"] entities << row["entity"] << row["author"] total_changes += 1 end results = [ {statistic: "number-of-commits", value: revisions.uniq.size}, {statistic: "number-of-entities", value: entities.uniq.size}, {statistic: "number-of-entities-changed", value: total_changes}, {statistic: "number-of-authors", value: .uniq.size} ] end to_csv_data(results, i[statistic value]) end |