fastruby-metric_fu 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.metrics +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +69 -0
- data/.simplecov +74 -0
- data/.travis.yml +18 -0
- data/.yardopts +4 -0
- data/AUTHORS +12 -0
- data/CONTRIBUTING.md +47 -0
- data/CONTRIBUTORS +76 -0
- data/DEV.md +76 -0
- data/Gemfile +58 -0
- data/Guardfile +30 -0
- data/HISTORY.md +705 -0
- data/MIT-LICENSE +22 -0
- data/README.md +299 -0
- data/Rakefile +27 -0
- data/TODO.md +118 -0
- data/appveyor.yml +29 -0
- data/bin/metric_fu +9 -0
- data/bin/mf-cane +10 -0
- data/bin/mf-churn +10 -0
- data/bin/mf-flay +10 -0
- data/bin/mf-reek +10 -0
- data/bin/mf-roodi +10 -0
- data/bin/mf-saikuro +10 -0
- data/certs/bf4.pem +22 -0
- data/checksum/.gitkeep +0 -0
- data/checksum/metric_fu-4.10.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.11.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.11.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.11.2.gem.sha512 +1 -0
- data/checksum/metric_fu-4.11.3.gem.sha512 +1 -0
- data/checksum/metric_fu-4.11.4.gem.sha512 +1 -0
- data/checksum/metric_fu-4.12.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.2.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.2.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.3.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.3.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.2.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.3.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.4.gem.sha512 +1 -0
- data/checksum/metric_fu-4.5.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.5.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.5.2.gem.sha512 +1 -0
- data/checksum/metric_fu-4.6.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.7.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.7.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.7.2.gem.sha512 +1 -0
- data/checksum/metric_fu-4.7.3.gem.sha512 +1 -0
- data/checksum/metric_fu-4.7.4.gem.sha512 +1 -0
- data/checksum/metric_fu-4.8.0.gem.sha512 +1 -0
- data/checksum/metric_fu-4.9.0.gem.sha512 +1 -0
- data/config/roodi_config.yml +22 -0
- data/config/rubocop.yml +269 -0
- data/gem_tasks/build.rake +197 -0
- data/gem_tasks/rubocop.rake +10 -0
- data/gem_tasks/usage_test.rake +19 -0
- data/gem_tasks/yard.rake +24 -0
- data/lib/metric_fu.rb +151 -0
- data/lib/metric_fu/calculate.rb +10 -0
- data/lib/metric_fu/cli/client.rb +26 -0
- data/lib/metric_fu/cli/helper.rb +80 -0
- data/lib/metric_fu/cli/parser.rb +138 -0
- data/lib/metric_fu/configuration.rb +150 -0
- data/lib/metric_fu/constantize.rb +57 -0
- data/lib/metric_fu/data_structures/line_numbers.rb +112 -0
- data/lib/metric_fu/data_structures/location.rb +110 -0
- data/lib/metric_fu/data_structures/sexp_node.rb +107 -0
- data/lib/metric_fu/environment.rb +129 -0
- data/lib/metric_fu/errors/analysis_error.rb +4 -0
- data/lib/metric_fu/formatter.rb +40 -0
- data/lib/metric_fu/formatter/html.rb +96 -0
- data/lib/metric_fu/formatter/syntax.rb +45 -0
- data/lib/metric_fu/formatter/yaml.rb +18 -0
- data/lib/metric_fu/gem_run.rb +70 -0
- data/lib/metric_fu/gem_version.rb +92 -0
- data/lib/metric_fu/generator.rb +135 -0
- data/lib/metric_fu/io.rb +132 -0
- data/lib/metric_fu/loader.rb +105 -0
- data/lib/metric_fu/logger.rb +62 -0
- data/lib/metric_fu/logging/mf_debugger.rb +23 -0
- data/lib/metric_fu/metric.rb +143 -0
- data/lib/metric_fu/metrics/cane/generator.rb +95 -0
- data/lib/metric_fu/metrics/cane/grapher.rb +37 -0
- data/lib/metric_fu/metrics/cane/metric.rb +34 -0
- data/lib/metric_fu/metrics/cane/report.html.erb +87 -0
- data/lib/metric_fu/metrics/cane/violations.rb +46 -0
- data/lib/metric_fu/metrics/churn/generator.rb +37 -0
- data/lib/metric_fu/metrics/churn/hotspot.rb +43 -0
- data/lib/metric_fu/metrics/churn/metric.rb +29 -0
- data/lib/metric_fu/metrics/churn/report.html.erb +58 -0
- data/lib/metric_fu/metrics/flay/generator.rb +51 -0
- data/lib/metric_fu/metrics/flay/grapher.rb +37 -0
- data/lib/metric_fu/metrics/flay/hotspot.rb +52 -0
- data/lib/metric_fu/metrics/flay/metric.rb +28 -0
- data/lib/metric_fu/metrics/flay/report.html.erb +29 -0
- data/lib/metric_fu/metrics/flog/generator.rb +113 -0
- data/lib/metric_fu/metrics/flog/grapher.rb +77 -0
- data/lib/metric_fu/metrics/flog/hotspot.rb +46 -0
- data/lib/metric_fu/metrics/flog/metric.rb +29 -0
- data/lib/metric_fu/metrics/flog/report.html.erb +50 -0
- data/lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb +34 -0
- data/lib/metric_fu/metrics/hotspots/analysis/analyzer_tables.rb +114 -0
- data/lib/metric_fu/metrics/hotspots/analysis/grouping.rb +23 -0
- data/lib/metric_fu/metrics/hotspots/analysis/groupings.rb +12 -0
- data/lib/metric_fu/metrics/hotspots/analysis/problems.rb +20 -0
- data/lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb +70 -0
- data/lib/metric_fu/metrics/hotspots/analysis/ranking.rb +29 -0
- data/lib/metric_fu/metrics/hotspots/analysis/rankings.rb +91 -0
- data/lib/metric_fu/metrics/hotspots/analysis/record.rb +32 -0
- data/lib/metric_fu/metrics/hotspots/analysis/scoring_strategies.rb +24 -0
- data/lib/metric_fu/metrics/hotspots/analysis/table.rb +67 -0
- data/lib/metric_fu/metrics/hotspots/generator.rb +40 -0
- data/lib/metric_fu/metrics/hotspots/hotspot.rb +87 -0
- data/lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb +61 -0
- data/lib/metric_fu/metrics/hotspots/metric.rb +20 -0
- data/lib/metric_fu/metrics/hotspots/report.html.erb +60 -0
- data/lib/metric_fu/metrics/rails_best_practices/generator.rb +47 -0
- data/lib/metric_fu/metrics/rails_best_practices/grapher.rb +38 -0
- data/lib/metric_fu/metrics/rails_best_practices/metric.rb +31 -0
- data/lib/metric_fu/metrics/rails_best_practices/report.html.erb +22 -0
- data/lib/metric_fu/metrics/rcov/external_client.rb +22 -0
- data/lib/metric_fu/metrics/rcov/generator.rb +75 -0
- data/lib/metric_fu/metrics/rcov/grapher.rb +37 -0
- data/lib/metric_fu/metrics/rcov/hotspot.rb +46 -0
- data/lib/metric_fu/metrics/rcov/metric.rb +61 -0
- data/lib/metric_fu/metrics/rcov/rcov_format_coverage.rb +149 -0
- data/lib/metric_fu/metrics/rcov/rcov_line.rb +48 -0
- data/lib/metric_fu/metrics/rcov/report.html.erb +40 -0
- data/lib/metric_fu/metrics/rcov/simplecov_formatter.rb +74 -0
- data/lib/metric_fu/metrics/reek/generator.rb +94 -0
- data/lib/metric_fu/metrics/reek/grapher.rb +55 -0
- data/lib/metric_fu/metrics/reek/hotspot.rb +95 -0
- data/lib/metric_fu/metrics/reek/metric.rb +26 -0
- data/lib/metric_fu/metrics/reek/report.html.erb +35 -0
- data/lib/metric_fu/metrics/roodi/generator.rb +40 -0
- data/lib/metric_fu/metrics/roodi/grapher.rb +37 -0
- data/lib/metric_fu/metrics/roodi/hotspot.rb +39 -0
- data/lib/metric_fu/metrics/roodi/metric.rb +24 -0
- data/lib/metric_fu/metrics/roodi/report.html.erb +22 -0
- data/lib/metric_fu/metrics/saikuro/generator.rb +145 -0
- data/lib/metric_fu/metrics/saikuro/hotspot.rb +51 -0
- data/lib/metric_fu/metrics/saikuro/metric.rb +31 -0
- data/lib/metric_fu/metrics/saikuro/parsing_element.rb +37 -0
- data/lib/metric_fu/metrics/saikuro/report.html.erb +71 -0
- data/lib/metric_fu/metrics/saikuro/scratch_file.rb +108 -0
- data/lib/metric_fu/metrics/stats/generator.rb +82 -0
- data/lib/metric_fu/metrics/stats/grapher.rb +40 -0
- data/lib/metric_fu/metrics/stats/hotspot.rb +35 -0
- data/lib/metric_fu/metrics/stats/metric.rb +28 -0
- data/lib/metric_fu/metrics/stats/report.html.erb +44 -0
- data/lib/metric_fu/reporter.rb +37 -0
- data/lib/metric_fu/reporting/graphs/graph.rb +69 -0
- data/lib/metric_fu/reporting/graphs/grapher.rb +66 -0
- data/lib/metric_fu/reporting/result.rb +59 -0
- data/lib/metric_fu/run.rb +82 -0
- data/lib/metric_fu/tasks/metric_fu.rake +54 -0
- data/lib/metric_fu/templates/_graph.html.erb +2 -0
- data/lib/metric_fu/templates/_report_footer.html.erb +1 -0
- data/lib/metric_fu/templates/configuration.rb +25 -0
- data/lib/metric_fu/templates/css/bluff.css +15 -0
- data/lib/metric_fu/templates/css/buttons.css +82 -0
- data/lib/metric_fu/templates/css/default.css +43 -0
- data/lib/metric_fu/templates/css/integrity.css +337 -0
- data/lib/metric_fu/templates/css/rcov.css +32 -0
- data/lib/metric_fu/templates/css/reset.css +7 -0
- data/lib/metric_fu/templates/css/syntax.css +19 -0
- data/lib/metric_fu/templates/index.html.erb +10 -0
- data/lib/metric_fu/templates/javascripts/bluff-min.js +1 -0
- data/lib/metric_fu/templates/javascripts/bluff_graph.js +15 -0
- data/lib/metric_fu/templates/javascripts/excanvas.js +35 -0
- data/lib/metric_fu/templates/javascripts/highcharts.js +294 -0
- data/lib/metric_fu/templates/javascripts/highcharts_graph.js +38 -0
- data/lib/metric_fu/templates/javascripts/js-class.js +1 -0
- data/lib/metric_fu/templates/javascripts/standalone-framework.js +17 -0
- data/lib/metric_fu/templates/javascripts/utils.js +9 -0
- data/lib/metric_fu/templates/layout.html.erb +37 -0
- data/lib/metric_fu/templates/metrics_template.rb +80 -0
- data/lib/metric_fu/templates/report.html.erb +31 -0
- data/lib/metric_fu/templates/report.rb +41 -0
- data/lib/metric_fu/templates/template.rb +244 -0
- data/lib/metric_fu/utility.rb +79 -0
- data/lib/metric_fu/version.rb +9 -0
- data/metric_fu.gemspec +71 -0
- data/spec/capture_warnings.rb +55 -0
- data/spec/cli/helper_spec.rb +165 -0
- data/spec/dummy/.gitignore +1 -0
- data/spec/dummy/.gitkeep +0 -0
- data/spec/dummy/lib/.gitkeep +0 -0
- data/spec/dummy/lib/bad_encoding.rb +6 -0
- data/spec/dummy/spec/.gitkeep +0 -0
- data/spec/fixtures/20090630.yml +7922 -0
- data/spec/fixtures/coverage-153.rb +11 -0
- data/spec/fixtures/coverage.rb +13 -0
- data/spec/fixtures/exit0.sh +3 -0
- data/spec/fixtures/exit1.sh +3 -0
- data/spec/fixtures/hotspots/flog.yml +86 -0
- data/spec/fixtures/hotspots/generator.yml +47 -0
- data/spec/fixtures/hotspots/generator_analysis.yml +53 -0
- data/spec/fixtures/hotspots/reek.yml +14 -0
- data/spec/fixtures/hotspots/roodi.yml +13 -0
- data/spec/fixtures/hotspots/saikuro.yml +27 -0
- data/spec/fixtures/hotspots/several_metrics.yml +47 -0
- data/spec/fixtures/hotspots/stats.yml +4 -0
- data/spec/fixtures/hotspots/three_metrics_on_same_file.yml +36 -0
- data/spec/fixtures/line_numbers/foo.rb +33 -0
- data/spec/fixtures/line_numbers/module.rb +11 -0
- data/spec/fixtures/line_numbers/module_surrounds_class.rb +15 -0
- data/spec/fixtures/line_numbers/two_classes.rb +11 -0
- data/spec/fixtures/metric_missing.yml +1 -0
- data/spec/fixtures/rcov_output.txt +135 -0
- data/spec/fixtures/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
- data/spec/fixtures/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
- data/spec/fixtures/saikuro/index_cyclo.html +155 -0
- data/spec/fixtures/saikuro_sfiles/thing.rb_cyclo.html +11 -0
- data/spec/metric_fu/calculate_spec.rb +21 -0
- data/spec/metric_fu/configuration_spec.rb +90 -0
- data/spec/metric_fu/data_structures/line_numbers_spec.rb +63 -0
- data/spec/metric_fu/data_structures/location_spec.rb +110 -0
- data/spec/metric_fu/formatter/configuration_spec.rb +44 -0
- data/spec/metric_fu/formatter/html_spec.rb +138 -0
- data/spec/metric_fu/formatter/yaml_spec.rb +61 -0
- data/spec/metric_fu/formatter_spec.rb +49 -0
- data/spec/metric_fu/gem_version_spec.rb +12 -0
- data/spec/metric_fu/generator_spec.rb +130 -0
- data/spec/metric_fu/loader_spec.rb +13 -0
- data/spec/metric_fu/metric_spec.rb +46 -0
- data/spec/metric_fu/metrics/cane/configuration_spec.rb +22 -0
- data/spec/metric_fu/metrics/cane/generator_spec.rb +184 -0
- data/spec/metric_fu/metrics/churn/configuration_spec.rb +13 -0
- data/spec/metric_fu/metrics/churn/generator_spec.rb +64 -0
- data/spec/metric_fu/metrics/flay/configuration_spec.rb +13 -0
- data/spec/metric_fu/metrics/flay/generator_spec.rb +105 -0
- data/spec/metric_fu/metrics/flay/grapher_spec.rb +57 -0
- data/spec/metric_fu/metrics/flog/configuration_spec.rb +18 -0
- data/spec/metric_fu/metrics/flog/generator_spec.rb +77 -0
- data/spec/metric_fu/metrics/flog/grapher_spec.rb +107 -0
- data/spec/metric_fu/metrics/hotspots/analysis/analyzed_problems_spec.rb +104 -0
- data/spec/metric_fu/metrics/hotspots/analysis/analyzer_tables_spec.rb +71 -0
- data/spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb +30 -0
- data/spec/metric_fu/metrics/hotspots/analysis/rankings_spec.rb +97 -0
- data/spec/metric_fu/metrics/hotspots/analysis/table_spec.rb +6 -0
- data/spec/metric_fu/metrics/hotspots/generator_spec.rb +46 -0
- data/spec/metric_fu/metrics/hotspots/hotspot_analyzer_spec.rb +10 -0
- data/spec/metric_fu/metrics/hotspots/hotspot_spec.rb +16 -0
- data/spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb +55 -0
- data/spec/metric_fu/metrics/rails_best_practices/generator_spec.rb +33 -0
- data/spec/metric_fu/metrics/rails_best_practices/grapher_spec.rb +62 -0
- data/spec/metric_fu/metrics/rcov/configuration_spec.rb +28 -0
- data/spec/metric_fu/metrics/rcov/generator_spec.rb +22 -0
- data/spec/metric_fu/metrics/rcov/grapher_spec.rb +57 -0
- data/spec/metric_fu/metrics/rcov/hotspot_spec.rb +20 -0
- data/spec/metric_fu/metrics/rcov/rcov_line_spec.rb +89 -0
- data/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb +67 -0
- data/spec/metric_fu/metrics/reek/configuration_spec.rb +13 -0
- data/spec/metric_fu/metrics/reek/generator_spec.rb +203 -0
- data/spec/metric_fu/metrics/reek/grapher_spec.rb +66 -0
- data/spec/metric_fu/metrics/roodi/configuration_spec.rb +14 -0
- data/spec/metric_fu/metrics/roodi/generator_spec.rb +82 -0
- data/spec/metric_fu/metrics/roodi/grapher_spec.rb +57 -0
- data/spec/metric_fu/metrics/saikuro/configuration_spec.rb +25 -0
- data/spec/metric_fu/metrics/saikuro/generator_spec.rb +71 -0
- data/spec/metric_fu/metrics/stats/generator_spec.rb +96 -0
- data/spec/metric_fu/metrics/stats/grapher_spec.rb +69 -0
- data/spec/metric_fu/reporter_spec.rb +41 -0
- data/spec/metric_fu/reporting/graphs/graph_spec.rb +44 -0
- data/spec/metric_fu/reporting/graphs/grapher_spec.rb +24 -0
- data/spec/metric_fu/reporting/result_spec.rb +50 -0
- data/spec/metric_fu/run_spec.rb +197 -0
- data/spec/metric_fu/templates/configuration_spec.rb +51 -0
- data/spec/metric_fu/templates/metrics_template_spec.rb +11 -0
- data/spec/metric_fu/templates/report_spec.rb +15 -0
- data/spec/metric_fu/templates/template_spec.rb +233 -0
- data/spec/metric_fu/utility_spec.rb +12 -0
- data/spec/metric_fu_spec.rb +52 -0
- data/spec/quality_spec.rb +114 -0
- data/spec/shared/configured.rb +45 -0
- data/spec/shared/test_coverage.rb +95 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/support/.metrics +4 -0
- data/spec/support/deferred_garbaged_collection.rb +33 -0
- data/spec/support/helper_methods.rb +32 -0
- data/spec/support/matcher_create_file.rb +37 -0
- data/spec/support/matcher_create_files.rb +43 -0
- data/spec/support/samples/reek/alfa.rb +1 -0
- data/spec/support/suite.rb +26 -0
- data/spec/support/test_fixtures.rb +37 -0
- data/spec/support/timeout.rb +7 -0
- data/spec/support/usage_test.rb +150 -0
- data/spec/usage_test_spec.rb +93 -0
- metadata +735 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
---
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Profiling enabled.
|
|
2
|
+
.............................................................................................................................................................................................
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Top 10 slowest examples:
|
|
6
|
+
0.2707830 MetricFu::RoodiGrapher responding to #get_metrics should push 13 to roodi_count
|
|
7
|
+
0.1994550 MetricFu::RcovGrapher responding to #get_metrics should update labels with the date
|
|
8
|
+
0.1985800 MetricFu::ReekGrapher responding to #get_metrics should set a hash of code smells to reek_count
|
|
9
|
+
0.1919860 MetricFu::ReekGrapher responding to #get_metrics should update labels with the date
|
|
10
|
+
0.1907400 MetricFu::RoodiGrapher responding to #get_metrics should update labels with the date
|
|
11
|
+
0.1883000 MetricFu::FlogGrapher responding to #get_metrics should update labels with the date
|
|
12
|
+
0.1882650 MetricFu::FlayGrapher responding to #get_metrics should push 476 to flay_score
|
|
13
|
+
0.1868780 MetricFu::FlogGrapher responding to #get_metrics should push to top_five_percent_average
|
|
14
|
+
0.1847730 MetricFu::FlogGrapher responding to #get_metrics should push 9.9 to flog_average
|
|
15
|
+
0.1844090 MetricFu::FlayGrapher responding to #get_metrics should update labels with the date
|
|
16
|
+
|
|
17
|
+
Finished in 2.517686 seconds
|
|
18
|
+
|
|
19
|
+
189 examples, 0 failures
|
|
20
|
+
================================================================================
|
|
21
|
+
./lib/metric_fu/metrics/hotspots/analysis/record.rb
|
|
22
|
+
================================================================================
|
|
23
|
+
module MetricFu
|
|
24
|
+
class Record
|
|
25
|
+
--
|
|
26
|
+
attr_reader :data
|
|
27
|
+
--
|
|
28
|
+
def initialize(data, columns)
|
|
29
|
+
@data = data
|
|
30
|
+
-- end
|
|
31
|
+
--
|
|
32
|
+
def method_missing(name, *args, &block)
|
|
33
|
+
key = name.to_s
|
|
34
|
+
if key == 'fetch'
|
|
35
|
+
@data.send(name, *args, &block)
|
|
36
|
+
elsif @data.has_key?(key)
|
|
37
|
+
@data[key]
|
|
38
|
+
-- else
|
|
39
|
+
!! super(name, *args, &block)
|
|
40
|
+
-- end
|
|
41
|
+
-- end
|
|
42
|
+
--
|
|
43
|
+
def []=(key, value)
|
|
44
|
+
@data[key]=value
|
|
45
|
+
-- end
|
|
46
|
+
--
|
|
47
|
+
def [](key)
|
|
48
|
+
@data[key]
|
|
49
|
+
-- end
|
|
50
|
+
--
|
|
51
|
+
def has_key?(key)
|
|
52
|
+
@data.has_key?(key)
|
|
53
|
+
-- end
|
|
54
|
+
--
|
|
55
|
+
-- end
|
|
56
|
+
-- end
|
|
57
|
+
|
|
58
|
+
================================================================================
|
|
59
|
+
./lib/metric_fu/metrics/hotspots/analysis/table.rb
|
|
60
|
+
================================================================================
|
|
61
|
+
%w(record).each do |path|
|
|
62
|
+
MetricFu.metrics_require { "hotspots/analysis/#{path}" }
|
|
63
|
+
-- end
|
|
64
|
+
--
|
|
65
|
+
module MetricFu
|
|
66
|
+
class Table
|
|
67
|
+
include Enumerable
|
|
68
|
+
--
|
|
69
|
+
def initialize(opts = {})
|
|
70
|
+
@rows = []
|
|
71
|
+
@columns = opts.fetch(:column_names)
|
|
72
|
+
--
|
|
73
|
+
@make_index = opts.fetch(:make_index) {true}
|
|
74
|
+
@metric_index = {}
|
|
75
|
+
-- end
|
|
76
|
+
--
|
|
77
|
+
def <<(row)
|
|
78
|
+
record = nil
|
|
79
|
+
if row.is_a?(MetricFu::Record)
|
|
80
|
+
record = row
|
|
81
|
+
-- else
|
|
82
|
+
record = MetricFu::Record.new(row, @columns)
|
|
83
|
+
-- end
|
|
84
|
+
@rows << record
|
|
85
|
+
updated_key_index(record) if @make_index
|
|
86
|
+
-- end
|
|
87
|
+
--
|
|
88
|
+
def concat(records)
|
|
89
|
+
!! records.each do |record|
|
|
90
|
+
!! self << record
|
|
91
|
+
-- end
|
|
92
|
+
!! self
|
|
93
|
+
-- end
|
|
94
|
+
--
|
|
95
|
+
def each
|
|
96
|
+
@rows.each do |row|
|
|
97
|
+
yield row
|
|
98
|
+
-- end
|
|
99
|
+
-- end
|
|
100
|
+
--
|
|
101
|
+
def size
|
|
102
|
+
length
|
|
103
|
+
-- end
|
|
104
|
+
--
|
|
105
|
+
def length
|
|
106
|
+
@rows.length
|
|
107
|
+
-- end
|
|
108
|
+
--
|
|
109
|
+
def [](index)
|
|
110
|
+
@rows[index]
|
|
111
|
+
-- end
|
|
112
|
+
--
|
|
113
|
+
def column(column_name)
|
|
114
|
+
arr = []
|
|
115
|
+
@rows.each do |row|
|
|
116
|
+
arr << row[column_name]
|
|
117
|
+
-- end
|
|
118
|
+
arr
|
|
119
|
+
-- end
|
|
120
|
+
--
|
|
121
|
+
def group_by_metric
|
|
122
|
+
@metric_index.to_a
|
|
123
|
+
-- end
|
|
124
|
+
--
|
|
125
|
+
private
|
|
126
|
+
--
|
|
127
|
+
def updated_key_index(record)
|
|
128
|
+
if record.has_key?('metric')
|
|
129
|
+
@metric_index[record.metric] ||= MetricFu::Table.new(:column_names => @columns, :make_index => false)
|
|
130
|
+
@metric_index[record.metric] << record
|
|
131
|
+
-- end
|
|
132
|
+
-- end
|
|
133
|
+
--
|
|
134
|
+
-- end
|
|
135
|
+
-- end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- START --
|
|
2
|
+
Type:Global Name: Complexity:0 Lines:1
|
|
3
|
+
-- END --
|
|
4
|
+
-- START SessionsController --
|
|
5
|
+
Type:Class Name:SessionsController Complexity:6 Lines:40
|
|
6
|
+
Type:Def Name:new Complexity:2 Lines:2
|
|
7
|
+
Type:Def Name:create Complexity:2 Lines:19
|
|
8
|
+
Type:Def Name:destroy Complexity:1 Lines:4
|
|
9
|
+
Type:Def Name:note_failed_signin Complexity:1 Lines:3
|
|
10
|
+
-- END SessionsController --
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- START UsersController --
|
|
2
|
+
Type:Class Name:UsersController Complexity:25 Lines:111
|
|
3
|
+
Type:Def Name:signup Complexity:1 Lines:3
|
|
4
|
+
Type:Def Name:new Complexity:1 Lines:2
|
|
5
|
+
Type:Def Name:edit Complexity:1 Lines:3
|
|
6
|
+
Type:Def Name:update Complexity:2 Lines:8
|
|
7
|
+
Type:Def Name:index Complexity:1 Lines:2
|
|
8
|
+
Type:Def Name:create Complexity:4 Lines:15
|
|
9
|
+
Type:Def Name:thank_you Complexity:2 Lines:10
|
|
10
|
+
Type:Def Name:destroy Complexity:1 Lines:3
|
|
11
|
+
Type:Def Name:add_primary_site Complexity:1 Lines:4
|
|
12
|
+
Type:Def Name:users_have_changed Complexity:3 Lines:8
|
|
13
|
+
Type:Def Name:after_create_page Complexity:2 Lines:6
|
|
14
|
+
Type:Def Name:sanitize_params Complexity:3 Lines:3
|
|
15
|
+
Type:Def Name:authorize_user Complexity:3 Lines:5
|
|
16
|
+
-- END UsersController --
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<html><head><title>Index for cyclomatic complexity</title></head>
|
|
2
|
+
<style>
|
|
3
|
+
body {
|
|
4
|
+
margin: 20px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
font-size: 12px;
|
|
7
|
+
font-family: bitstream vera sans, verdana, arial, sans serif;
|
|
8
|
+
background-color: #efefef;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
table {
|
|
12
|
+
border-collapse: collapse;
|
|
13
|
+
/*border-spacing: 0;*/
|
|
14
|
+
border: 1px solid #666;
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
margin-bottom: 20px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
table, th, th+th, td, td+td {
|
|
20
|
+
border: 1px solid #ccc;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
table th {
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
color: #fc0;
|
|
26
|
+
padding: 4px 0;
|
|
27
|
+
background-color: #336;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
th, td {
|
|
31
|
+
padding: 4px 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
td {
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.class_name {
|
|
39
|
+
font-size: 17px;
|
|
40
|
+
margin: 20px 0 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.class_complexity {
|
|
44
|
+
margin: 0 auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.class_complexity>.class_complexity {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.class_total_complexity, .class_total_lines, .start_token_count, .file_count {
|
|
52
|
+
font-size: 13px;
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.class_total_complexity, .class_total_lines {
|
|
57
|
+
color: #c00;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.start_token_count, .file_count {
|
|
61
|
+
color: #333;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.warning {
|
|
65
|
+
background-color: yellow;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.error {
|
|
69
|
+
background-color: #f00;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
|
|
73
|
+
<body>
|
|
74
|
+
<h1>Index for cyclomatic complexity</h1>
|
|
75
|
+
<h2 class="class_name">Errors and Warnings</h2>
|
|
76
|
+
<table width="100%" border="1">
|
|
77
|
+
<tr><th>Class</th><th>Method</th><th>Complexity</th></tr>
|
|
78
|
+
|
|
79
|
+
<tr><td><a href="./app/controllers/activity_reports_controller.rb_cyclo.html">ActivityReportsController</a></td><td>authorize_user</td>
|
|
80
|
+
<td class="warning">6</td></tr>
|
|
81
|
+
<tr><td><a href="./app/controllers/primary_sites_controller.rb_cyclo.html">PrimarySitesController</a></td><td>create</td>
|
|
82
|
+
<td class="warning">5</td></tr>
|
|
83
|
+
<tr><td><a href="./app/controllers/primary_sites_controller.rb_cyclo.html">PrimarySitesController</a></td><td>save_link_targets</td>
|
|
84
|
+
<td class="warning">5</td></tr>
|
|
85
|
+
<tr><td><a href="./app/models/link_target.rb_cyclo.html">LinkTarget</a></td><td>update_backlink_status</td>
|
|
86
|
+
<td class="warning">5</td></tr>
|
|
87
|
+
</table>
|
|
88
|
+
<hr/>
|
|
89
|
+
<h2 class="class_name">Analyzed Files</h2>
|
|
90
|
+
<ul>
|
|
91
|
+
<li>
|
|
92
|
+
<p class="file_name"><a href="./app/models/user.rb_cyclo.html">app/models/user.rb</a>
|
|
93
|
+
</li>
|
|
94
|
+
<li>
|
|
95
|
+
<p class="file_name"><a href="./app/models/subscriber.rb_cyclo.html">app/models/subscriber.rb</a>
|
|
96
|
+
</li>
|
|
97
|
+
<li>
|
|
98
|
+
<p class="file_name"><a href="./app/models/primary_site.rb_cyclo.html">app/models/primary_site.rb</a>
|
|
99
|
+
</li>
|
|
100
|
+
<li>
|
|
101
|
+
<p class="file_name"><a href="./app/models/link_target.rb_cyclo.html">app/models/link_target.rb</a>
|
|
102
|
+
</li>
|
|
103
|
+
<li>
|
|
104
|
+
<p class="file_name"><a href="./app/models/comparison_site.rb_cyclo.html">app/models/comparison_site.rb</a>
|
|
105
|
+
</li>
|
|
106
|
+
<li>
|
|
107
|
+
<p class="file_name"><a href="./app/models/backlink_crawl_status.rb_cyclo.html">app/models/backlink_crawl_status.rb</a>
|
|
108
|
+
</li>
|
|
109
|
+
<li>
|
|
110
|
+
<p class="file_name"><a href="./app/models/backlink_crawl_notifier.rb_cyclo.html">app/models/backlink_crawl_notifier.rb</a>
|
|
111
|
+
</li>
|
|
112
|
+
<li>
|
|
113
|
+
<p class="file_name"><a href="./app/models/activity_report_measure.rb_cyclo.html">app/models/activity_report_measure.rb</a>
|
|
114
|
+
</li>
|
|
115
|
+
<li>
|
|
116
|
+
<p class="file_name"><a href="./app/models/activity_report.rb_cyclo.html">app/models/activity_report.rb</a>
|
|
117
|
+
</li>
|
|
118
|
+
<li>
|
|
119
|
+
<p class="file_name"><a href="./app/helpers/users_helper.rb_cyclo.html">app/helpers/users_helper.rb</a>
|
|
120
|
+
</li>
|
|
121
|
+
<li>
|
|
122
|
+
<p class="file_name"><a href="./app/helpers/sessions_helper.rb_cyclo.html">app/helpers/sessions_helper.rb</a>
|
|
123
|
+
</li>
|
|
124
|
+
<li>
|
|
125
|
+
<p class="file_name"><a href="./app/helpers/primary_sites_helper.rb_cyclo.html">app/helpers/primary_sites_helper.rb</a>
|
|
126
|
+
</li>
|
|
127
|
+
<li>
|
|
128
|
+
<p class="file_name"><a href="./app/helpers/link_targets_helper.rb_cyclo.html">app/helpers/link_targets_helper.rb</a>
|
|
129
|
+
</li>
|
|
130
|
+
<li>
|
|
131
|
+
<p class="file_name"><a href="./app/helpers/application_helper.rb_cyclo.html">app/helpers/application_helper.rb</a>
|
|
132
|
+
</li>
|
|
133
|
+
<li>
|
|
134
|
+
<p class="file_name"><a href="./app/controllers/users_controller.rb_cyclo.html">app/controllers/users_controller.rb</a>
|
|
135
|
+
</li>
|
|
136
|
+
<li>
|
|
137
|
+
<p class="file_name"><a href="./app/controllers/sessions_controller.rb_cyclo.html">app/controllers/sessions_controller.rb</a>
|
|
138
|
+
</li>
|
|
139
|
+
<li>
|
|
140
|
+
<p class="file_name"><a href="./app/controllers/primary_sites_controller.rb_cyclo.html">app/controllers/primary_sites_controller.rb</a>
|
|
141
|
+
</li>
|
|
142
|
+
<li>
|
|
143
|
+
<p class="file_name"><a href="./app/controllers/link_targets_controller.rb_cyclo.html">app/controllers/link_targets_controller.rb</a>
|
|
144
|
+
</li>
|
|
145
|
+
<li>
|
|
146
|
+
<p class="file_name"><a href="./app/controllers/bookmarklet_integration_controller.rb_cyclo.html">app/controllers/bookmarklet_integration_controller.rb</a>
|
|
147
|
+
</li>
|
|
148
|
+
<li>
|
|
149
|
+
<p class="file_name"><a href="./app/controllers/application.rb_cyclo.html">app/controllers/application.rb</a>
|
|
150
|
+
</li>
|
|
151
|
+
<li>
|
|
152
|
+
<p class="file_name"><a href="./app/controllers/activity_reports_controller.rb_cyclo.html">app/controllers/activity_reports_controller.rb</a>
|
|
153
|
+
</li>
|
|
154
|
+
</ul>
|
|
155
|
+
</body></html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- START Mod --
|
|
2
|
+
Type:Module Name:Mod Complexity:2 Lines:7
|
|
3
|
+
Type:Def Name:self.included Complexity:2 Lines:5
|
|
4
|
+
-- START --
|
|
5
|
+
Type:Class Name: Complexity:0 Lines:1
|
|
6
|
+
-- END --
|
|
7
|
+
Type:Def Name:update Complexity:1 Lines:1
|
|
8
|
+
-- END Mod --
|
|
9
|
+
-- START Thing --
|
|
10
|
+
Type:Class Name:Thing Complexity:0 Lines:2
|
|
11
|
+
-- END Thing --
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
MetricFu.lib_require { "calculate" }
|
|
3
|
+
|
|
4
|
+
describe MetricFu::Calculate do
|
|
5
|
+
describe "returns a percent rounded to the nearest integer" do
|
|
6
|
+
specify "3 / 10 == 30" do
|
|
7
|
+
expect(MetricFu::Calculate.integer_percent(3, 10)).to eq(30)
|
|
8
|
+
end
|
|
9
|
+
specify "3.0 / 10 == 30" do
|
|
10
|
+
expect(MetricFu::Calculate.integer_percent(3.0, 10)).to eq(30)
|
|
11
|
+
end
|
|
12
|
+
it "raises an ArgumentError on non-numeric input" do
|
|
13
|
+
expect {
|
|
14
|
+
MetricFu::Calculate.integer_percent("", 10)
|
|
15
|
+
}.to raise_error(ArgumentError)
|
|
16
|
+
end
|
|
17
|
+
it "returns 0 when the denominator is 0" do
|
|
18
|
+
expect(MetricFu::Calculate.integer_percent(3, 0)).to eq(0)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "shared/configured"
|
|
3
|
+
|
|
4
|
+
describe MetricFu::Configuration do
|
|
5
|
+
it_behaves_like "configured" do
|
|
6
|
+
describe "#is_cruise_control_rb?" do
|
|
7
|
+
before(:each) { get_new_config }
|
|
8
|
+
describe "when the CC_BUILD_ARTIFACTS env var is not nil" do
|
|
9
|
+
before(:each) do
|
|
10
|
+
ENV["CC_BUILD_ARTIFACTS"] = "is set"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should return true" do
|
|
14
|
+
expect(@config.is_cruise_control_rb?).to be_truthy
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
after(:each) do
|
|
18
|
+
ENV["CC_BUILD_ARTIFACTS"] = nil
|
|
19
|
+
FileUtils.rm_rf(File.join(MetricFu.root_dir, "is set"))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "when the CC_BUILD_ARTIFACTS env var is nil" do
|
|
24
|
+
before(:each) { ENV["CC_BUILD_ARTIFACTS"] = nil }
|
|
25
|
+
|
|
26
|
+
it "should return false" do
|
|
27
|
+
expect(@config.is_cruise_control_rb?).to be_falsey
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe "#reset" do
|
|
33
|
+
describe "when there is a CC_BUILD_ARTIFACTS environment variable" do
|
|
34
|
+
before do
|
|
35
|
+
ENV["CC_BUILD_ARTIFACTS"] = "foo"
|
|
36
|
+
@config = MetricFu.configuration
|
|
37
|
+
@config.reset
|
|
38
|
+
MetricFu.configure
|
|
39
|
+
end
|
|
40
|
+
it "should return the CC_BUILD_ARTIFACTS environment variable" do
|
|
41
|
+
compare_paths(base_directory, ENV["CC_BUILD_ARTIFACTS"])
|
|
42
|
+
end
|
|
43
|
+
after do
|
|
44
|
+
ENV["CC_BUILD_ARTIFACTS"] = nil
|
|
45
|
+
FileUtils.rm_rf(File.join(MetricFu.root_dir, "foo"))
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "when there is no CC_BUILD_ARTIFACTS environment variable" do
|
|
50
|
+
before(:each) do
|
|
51
|
+
ENV["CC_BUILD_ARTIFACTS"] = nil
|
|
52
|
+
get_new_config
|
|
53
|
+
end
|
|
54
|
+
it "should return 'tmp/metric_fu'" do
|
|
55
|
+
expect(base_directory).to eq(MetricFu.artifact_dir)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should set @metric_fu_root_directory to the base of the "\
|
|
59
|
+
"metric_fu application" do
|
|
60
|
+
app_root = File.join(File.dirname(__FILE__), "..", "..")
|
|
61
|
+
app_root_absolute_path = File.expand_path(app_root)
|
|
62
|
+
metric_fu_absolute_path = File.expand_path(metric_fu_root)
|
|
63
|
+
expect(metric_fu_absolute_path).to eq(app_root_absolute_path)
|
|
64
|
+
expect(MetricFu.root.to_s).to eq(app_root_absolute_path)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "should set @scratch_directory to scratch relative "\
|
|
68
|
+
"to @base_directory" do
|
|
69
|
+
scratch_dir = MetricFu.scratch_dir
|
|
70
|
+
expect(scratch_directory).to eq(scratch_dir)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "should set @output_directory to output relative "\
|
|
74
|
+
"to @base_directory" do
|
|
75
|
+
output_dir = MetricFu.output_dir
|
|
76
|
+
expect(output_directory).to eq(output_dir)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe "#platform" do
|
|
82
|
+
before(:each) { get_new_config }
|
|
83
|
+
|
|
84
|
+
it "should return the value of the PLATFORM constant" do
|
|
85
|
+
this_platform = RUBY_PLATFORM
|
|
86
|
+
expect(@config.platform).to eq(this_platform)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|