code_metric_fu 4.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (296) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +28 -0
  3. data/.metrics +3 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +15 -0
  6. data/.rubocop_todo.yml +69 -0
  7. data/.simplecov +74 -0
  8. data/.travis.yml +22 -0
  9. data/.yardopts +4 -0
  10. data/AUTHORS +12 -0
  11. data/CONTRIBUTING.md +47 -0
  12. data/CONTRIBUTORS +76 -0
  13. data/DEV.md +76 -0
  14. data/Gemfile +74 -0
  15. data/Guardfile +30 -0
  16. data/HISTORY.md +705 -0
  17. data/MIT-LICENSE +22 -0
  18. data/README.md +299 -0
  19. data/Rakefile +27 -0
  20. data/TODO.md +118 -0
  21. data/appveyor.yml +31 -0
  22. data/bin/metric_fu +9 -0
  23. data/bin/mf-cane +10 -0
  24. data/bin/mf-churn +10 -0
  25. data/bin/mf-flay +10 -0
  26. data/bin/mf-reek +10 -0
  27. data/bin/mf-roodi +10 -0
  28. data/bin/mf-saikuro +10 -0
  29. data/certs/bf4.pem +22 -0
  30. data/checksum/.gitkeep +0 -0
  31. data/checksum/metric_fu-4.10.0.gem.sha512 +1 -0
  32. data/checksum/metric_fu-4.11.0.gem.sha512 +1 -0
  33. data/checksum/metric_fu-4.11.1.gem.sha512 +1 -0
  34. data/checksum/metric_fu-4.11.2.gem.sha512 +1 -0
  35. data/checksum/metric_fu-4.11.3.gem.sha512 +1 -0
  36. data/checksum/metric_fu-4.11.4.gem.sha512 +1 -0
  37. data/checksum/metric_fu-4.12.0.gem.sha512 +1 -0
  38. data/checksum/metric_fu-4.2.0.gem.sha512 +1 -0
  39. data/checksum/metric_fu-4.2.1.gem.sha512 +1 -0
  40. data/checksum/metric_fu-4.3.0.gem.sha512 +1 -0
  41. data/checksum/metric_fu-4.3.1.gem.sha512 +1 -0
  42. data/checksum/metric_fu-4.4.0.gem.sha512 +1 -0
  43. data/checksum/metric_fu-4.4.1.gem.sha512 +1 -0
  44. data/checksum/metric_fu-4.4.2.gem.sha512 +1 -0
  45. data/checksum/metric_fu-4.4.3.gem.sha512 +1 -0
  46. data/checksum/metric_fu-4.4.4.gem.sha512 +1 -0
  47. data/checksum/metric_fu-4.5.0.gem.sha512 +1 -0
  48. data/checksum/metric_fu-4.5.1.gem.sha512 +1 -0
  49. data/checksum/metric_fu-4.5.2.gem.sha512 +1 -0
  50. data/checksum/metric_fu-4.6.0.gem.sha512 +1 -0
  51. data/checksum/metric_fu-4.7.0.gem.sha512 +1 -0
  52. data/checksum/metric_fu-4.7.1.gem.sha512 +1 -0
  53. data/checksum/metric_fu-4.7.2.gem.sha512 +1 -0
  54. data/checksum/metric_fu-4.7.3.gem.sha512 +1 -0
  55. data/checksum/metric_fu-4.7.4.gem.sha512 +1 -0
  56. data/checksum/metric_fu-4.8.0.gem.sha512 +1 -0
  57. data/checksum/metric_fu-4.9.0.gem.sha512 +1 -0
  58. data/config/roodi_config.yml +22 -0
  59. data/config/rubocop.yml +269 -0
  60. data/gem_tasks/build.rake +197 -0
  61. data/gem_tasks/rubocop.rake +10 -0
  62. data/gem_tasks/usage_test.rake +19 -0
  63. data/gem_tasks/yard.rake +24 -0
  64. data/lib/metric_fu/calculate.rb +10 -0
  65. data/lib/metric_fu/cli/client.rb +26 -0
  66. data/lib/metric_fu/cli/helper.rb +80 -0
  67. data/lib/metric_fu/cli/parser.rb +138 -0
  68. data/lib/metric_fu/configuration.rb +150 -0
  69. data/lib/metric_fu/constantize.rb +57 -0
  70. data/lib/metric_fu/data_structures/line_numbers.rb +112 -0
  71. data/lib/metric_fu/data_structures/location.rb +110 -0
  72. data/lib/metric_fu/data_structures/sexp_node.rb +107 -0
  73. data/lib/metric_fu/environment.rb +129 -0
  74. data/lib/metric_fu/errors/analysis_error.rb +4 -0
  75. data/lib/metric_fu/formatter/html.rb +96 -0
  76. data/lib/metric_fu/formatter/syntax.rb +45 -0
  77. data/lib/metric_fu/formatter/yaml.rb +18 -0
  78. data/lib/metric_fu/formatter.rb +40 -0
  79. data/lib/metric_fu/gem_run.rb +70 -0
  80. data/lib/metric_fu/gem_version.rb +92 -0
  81. data/lib/metric_fu/generator.rb +135 -0
  82. data/lib/metric_fu/io.rb +132 -0
  83. data/lib/metric_fu/loader.rb +105 -0
  84. data/lib/metric_fu/logger.rb +62 -0
  85. data/lib/metric_fu/logging/mf_debugger.rb +23 -0
  86. data/lib/metric_fu/metric.rb +143 -0
  87. data/lib/metric_fu/metrics/cane/generator.rb +95 -0
  88. data/lib/metric_fu/metrics/cane/grapher.rb +37 -0
  89. data/lib/metric_fu/metrics/cane/metric.rb +34 -0
  90. data/lib/metric_fu/metrics/cane/report.html.erb +87 -0
  91. data/lib/metric_fu/metrics/cane/violations.rb +46 -0
  92. data/lib/metric_fu/metrics/churn/generator.rb +37 -0
  93. data/lib/metric_fu/metrics/churn/hotspot.rb +43 -0
  94. data/lib/metric_fu/metrics/churn/metric.rb +29 -0
  95. data/lib/metric_fu/metrics/churn/report.html.erb +58 -0
  96. data/lib/metric_fu/metrics/flay/generator.rb +51 -0
  97. data/lib/metric_fu/metrics/flay/grapher.rb +37 -0
  98. data/lib/metric_fu/metrics/flay/hotspot.rb +52 -0
  99. data/lib/metric_fu/metrics/flay/metric.rb +28 -0
  100. data/lib/metric_fu/metrics/flay/report.html.erb +29 -0
  101. data/lib/metric_fu/metrics/flog/generator.rb +113 -0
  102. data/lib/metric_fu/metrics/flog/grapher.rb +77 -0
  103. data/lib/metric_fu/metrics/flog/hotspot.rb +46 -0
  104. data/lib/metric_fu/metrics/flog/metric.rb +29 -0
  105. data/lib/metric_fu/metrics/flog/report.html.erb +50 -0
  106. data/lib/metric_fu/metrics/hotspots/analysis/analyzed_problems.rb +34 -0
  107. data/lib/metric_fu/metrics/hotspots/analysis/analyzer_tables.rb +114 -0
  108. data/lib/metric_fu/metrics/hotspots/analysis/grouping.rb +23 -0
  109. data/lib/metric_fu/metrics/hotspots/analysis/groupings.rb +12 -0
  110. data/lib/metric_fu/metrics/hotspots/analysis/problems.rb +20 -0
  111. data/lib/metric_fu/metrics/hotspots/analysis/ranked_problem_location.rb +70 -0
  112. data/lib/metric_fu/metrics/hotspots/analysis/ranking.rb +29 -0
  113. data/lib/metric_fu/metrics/hotspots/analysis/rankings.rb +91 -0
  114. data/lib/metric_fu/metrics/hotspots/analysis/record.rb +32 -0
  115. data/lib/metric_fu/metrics/hotspots/analysis/scoring_strategies.rb +24 -0
  116. data/lib/metric_fu/metrics/hotspots/analysis/table.rb +67 -0
  117. data/lib/metric_fu/metrics/hotspots/generator.rb +40 -0
  118. data/lib/metric_fu/metrics/hotspots/hotspot.rb +87 -0
  119. data/lib/metric_fu/metrics/hotspots/hotspot_analyzer.rb +61 -0
  120. data/lib/metric_fu/metrics/hotspots/metric.rb +20 -0
  121. data/lib/metric_fu/metrics/hotspots/report.html.erb +60 -0
  122. data/lib/metric_fu/metrics/rails_best_practices/generator.rb +47 -0
  123. data/lib/metric_fu/metrics/rails_best_practices/grapher.rb +38 -0
  124. data/lib/metric_fu/metrics/rails_best_practices/metric.rb +31 -0
  125. data/lib/metric_fu/metrics/rails_best_practices/report.html.erb +22 -0
  126. data/lib/metric_fu/metrics/rcov/external_client.rb +22 -0
  127. data/lib/metric_fu/metrics/rcov/generator.rb +75 -0
  128. data/lib/metric_fu/metrics/rcov/grapher.rb +37 -0
  129. data/lib/metric_fu/metrics/rcov/hotspot.rb +46 -0
  130. data/lib/metric_fu/metrics/rcov/metric.rb +61 -0
  131. data/lib/metric_fu/metrics/rcov/rcov_format_coverage.rb +149 -0
  132. data/lib/metric_fu/metrics/rcov/rcov_line.rb +48 -0
  133. data/lib/metric_fu/metrics/rcov/report.html.erb +40 -0
  134. data/lib/metric_fu/metrics/rcov/simplecov_formatter.rb +74 -0
  135. data/lib/metric_fu/metrics/reek/generator.rb +97 -0
  136. data/lib/metric_fu/metrics/reek/grapher.rb +55 -0
  137. data/lib/metric_fu/metrics/reek/hotspot.rb +95 -0
  138. data/lib/metric_fu/metrics/reek/metric.rb +26 -0
  139. data/lib/metric_fu/metrics/reek/report.html.erb +35 -0
  140. data/lib/metric_fu/metrics/roodi/generator.rb +41 -0
  141. data/lib/metric_fu/metrics/roodi/grapher.rb +37 -0
  142. data/lib/metric_fu/metrics/roodi/hotspot.rb +39 -0
  143. data/lib/metric_fu/metrics/roodi/metric.rb +24 -0
  144. data/lib/metric_fu/metrics/roodi/report.html.erb +22 -0
  145. data/lib/metric_fu/metrics/saikuro/generator.rb +145 -0
  146. data/lib/metric_fu/metrics/saikuro/hotspot.rb +51 -0
  147. data/lib/metric_fu/metrics/saikuro/metric.rb +31 -0
  148. data/lib/metric_fu/metrics/saikuro/parsing_element.rb +37 -0
  149. data/lib/metric_fu/metrics/saikuro/report.html.erb +71 -0
  150. data/lib/metric_fu/metrics/saikuro/scratch_file.rb +108 -0
  151. data/lib/metric_fu/metrics/stats/generator.rb +82 -0
  152. data/lib/metric_fu/metrics/stats/grapher.rb +40 -0
  153. data/lib/metric_fu/metrics/stats/hotspot.rb +35 -0
  154. data/lib/metric_fu/metrics/stats/metric.rb +28 -0
  155. data/lib/metric_fu/metrics/stats/report.html.erb +44 -0
  156. data/lib/metric_fu/reporter.rb +37 -0
  157. data/lib/metric_fu/reporting/graphs/graph.rb +69 -0
  158. data/lib/metric_fu/reporting/graphs/grapher.rb +66 -0
  159. data/lib/metric_fu/reporting/result.rb +59 -0
  160. data/lib/metric_fu/run.rb +82 -0
  161. data/lib/metric_fu/tasks/metric_fu.rake +54 -0
  162. data/lib/metric_fu/templates/_gem_info.html.erb +8 -0
  163. data/lib/metric_fu/templates/_graph.html.erb +2 -0
  164. data/lib/metric_fu/templates/_report_footer.html.erb +1 -0
  165. data/lib/metric_fu/templates/configuration.rb +25 -0
  166. data/lib/metric_fu/templates/css/bluff.css +15 -0
  167. data/lib/metric_fu/templates/css/buttons.css +82 -0
  168. data/lib/metric_fu/templates/css/default.css +43 -0
  169. data/lib/metric_fu/templates/css/integrity.css +337 -0
  170. data/lib/metric_fu/templates/css/rcov.css +32 -0
  171. data/lib/metric_fu/templates/css/reset.css +7 -0
  172. data/lib/metric_fu/templates/css/syntax.css +19 -0
  173. data/lib/metric_fu/templates/index.html.erb +13 -0
  174. data/lib/metric_fu/templates/javascripts/bluff-min.js +1 -0
  175. data/lib/metric_fu/templates/javascripts/bluff_graph.js +15 -0
  176. data/lib/metric_fu/templates/javascripts/excanvas.js +35 -0
  177. data/lib/metric_fu/templates/javascripts/highcharts.js +294 -0
  178. data/lib/metric_fu/templates/javascripts/highcharts_graph.js +38 -0
  179. data/lib/metric_fu/templates/javascripts/js-class.js +1 -0
  180. data/lib/metric_fu/templates/javascripts/standalone-framework.js +17 -0
  181. data/lib/metric_fu/templates/javascripts/utils.js +9 -0
  182. data/lib/metric_fu/templates/layout.html.erb +41 -0
  183. data/lib/metric_fu/templates/metrics_template.rb +86 -0
  184. data/lib/metric_fu/templates/report.html.erb +31 -0
  185. data/lib/metric_fu/templates/report.rb +41 -0
  186. data/lib/metric_fu/templates/template.rb +247 -0
  187. data/lib/metric_fu/utility.rb +79 -0
  188. data/lib/metric_fu/version.rb +9 -0
  189. data/lib/metric_fu.rb +143 -0
  190. data/metric_fu.gemspec +72 -0
  191. data/spec/capture_warnings.rb +55 -0
  192. data/spec/cli/helper_spec.rb +165 -0
  193. data/spec/dummy/.gitignore +1 -0
  194. data/spec/dummy/.gitkeep +0 -0
  195. data/spec/dummy/.metrics +4 -0
  196. data/spec/dummy/lib/.gitkeep +0 -0
  197. data/spec/dummy/lib/bad_encoding.rb +6 -0
  198. data/spec/dummy/spec/.gitkeep +0 -0
  199. data/spec/fixtures/20090630.yml +7922 -0
  200. data/spec/fixtures/coverage-153.rb +11 -0
  201. data/spec/fixtures/coverage.rb +13 -0
  202. data/spec/fixtures/exit0.sh +3 -0
  203. data/spec/fixtures/exit1.sh +3 -0
  204. data/spec/fixtures/hotspots/flog.yml +86 -0
  205. data/spec/fixtures/hotspots/generator.yml +47 -0
  206. data/spec/fixtures/hotspots/generator_analysis.yml +53 -0
  207. data/spec/fixtures/hotspots/reek.yml +14 -0
  208. data/spec/fixtures/hotspots/roodi.yml +13 -0
  209. data/spec/fixtures/hotspots/saikuro.yml +27 -0
  210. data/spec/fixtures/hotspots/several_metrics.yml +47 -0
  211. data/spec/fixtures/hotspots/stats.yml +4 -0
  212. data/spec/fixtures/hotspots/three_metrics_on_same_file.yml +36 -0
  213. data/spec/fixtures/line_numbers/foo.rb +33 -0
  214. data/spec/fixtures/line_numbers/module.rb +11 -0
  215. data/spec/fixtures/line_numbers/module_surrounds_class.rb +15 -0
  216. data/spec/fixtures/line_numbers/two_classes.rb +11 -0
  217. data/spec/fixtures/metric_missing.yml +1 -0
  218. data/spec/fixtures/rcov_output.txt +135 -0
  219. data/spec/fixtures/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
  220. data/spec/fixtures/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
  221. data/spec/fixtures/saikuro/index_cyclo.html +155 -0
  222. data/spec/fixtures/saikuro_sfiles/thing.rb_cyclo.html +11 -0
  223. data/spec/metric_fu/calculate_spec.rb +21 -0
  224. data/spec/metric_fu/configuration_spec.rb +90 -0
  225. data/spec/metric_fu/data_structures/line_numbers_spec.rb +63 -0
  226. data/spec/metric_fu/data_structures/location_spec.rb +110 -0
  227. data/spec/metric_fu/formatter/configuration_spec.rb +44 -0
  228. data/spec/metric_fu/formatter/html_spec.rb +138 -0
  229. data/spec/metric_fu/formatter/yaml_spec.rb +61 -0
  230. data/spec/metric_fu/formatter_spec.rb +49 -0
  231. data/spec/metric_fu/gem_version_spec.rb +12 -0
  232. data/spec/metric_fu/generator_spec.rb +130 -0
  233. data/spec/metric_fu/loader_spec.rb +10 -0
  234. data/spec/metric_fu/metric_spec.rb +46 -0
  235. data/spec/metric_fu/metrics/cane/configuration_spec.rb +22 -0
  236. data/spec/metric_fu/metrics/cane/generator_spec.rb +184 -0
  237. data/spec/metric_fu/metrics/churn/configuration_spec.rb +13 -0
  238. data/spec/metric_fu/metrics/churn/generator_spec.rb +64 -0
  239. data/spec/metric_fu/metrics/flay/configuration_spec.rb +13 -0
  240. data/spec/metric_fu/metrics/flay/generator_spec.rb +105 -0
  241. data/spec/metric_fu/metrics/flay/grapher_spec.rb +57 -0
  242. data/spec/metric_fu/metrics/flog/configuration_spec.rb +18 -0
  243. data/spec/metric_fu/metrics/flog/generator_spec.rb +77 -0
  244. data/spec/metric_fu/metrics/flog/grapher_spec.rb +107 -0
  245. data/spec/metric_fu/metrics/hotspots/analysis/analyzed_problems_spec.rb +104 -0
  246. data/spec/metric_fu/metrics/hotspots/analysis/analyzer_tables_spec.rb +71 -0
  247. data/spec/metric_fu/metrics/hotspots/analysis/ranking_spec.rb +30 -0
  248. data/spec/metric_fu/metrics/hotspots/analysis/rankings_spec.rb +97 -0
  249. data/spec/metric_fu/metrics/hotspots/analysis/table_spec.rb +6 -0
  250. data/spec/metric_fu/metrics/hotspots/generator_spec.rb +46 -0
  251. data/spec/metric_fu/metrics/hotspots/hotspot_analyzer_spec.rb +10 -0
  252. data/spec/metric_fu/metrics/hotspots/hotspot_spec.rb +16 -0
  253. data/spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb +55 -0
  254. data/spec/metric_fu/metrics/rails_best_practices/generator_spec.rb +33 -0
  255. data/spec/metric_fu/metrics/rails_best_practices/grapher_spec.rb +62 -0
  256. data/spec/metric_fu/metrics/rcov/configuration_spec.rb +28 -0
  257. data/spec/metric_fu/metrics/rcov/generator_spec.rb +22 -0
  258. data/spec/metric_fu/metrics/rcov/grapher_spec.rb +57 -0
  259. data/spec/metric_fu/metrics/rcov/hotspot_spec.rb +20 -0
  260. data/spec/metric_fu/metrics/rcov/rcov_line_spec.rb +89 -0
  261. data/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb +67 -0
  262. data/spec/metric_fu/metrics/reek/configuration_spec.rb +13 -0
  263. data/spec/metric_fu/metrics/reek/generator_spec.rb +169 -0
  264. data/spec/metric_fu/metrics/reek/grapher_spec.rb +66 -0
  265. data/spec/metric_fu/metrics/roodi/configuration_spec.rb +14 -0
  266. data/spec/metric_fu/metrics/roodi/generator_spec.rb +82 -0
  267. data/spec/metric_fu/metrics/roodi/grapher_spec.rb +57 -0
  268. data/spec/metric_fu/metrics/saikuro/configuration_spec.rb +25 -0
  269. data/spec/metric_fu/metrics/saikuro/generator_spec.rb +71 -0
  270. data/spec/metric_fu/metrics/stats/generator_spec.rb +96 -0
  271. data/spec/metric_fu/metrics/stats/grapher_spec.rb +69 -0
  272. data/spec/metric_fu/reporter_spec.rb +41 -0
  273. data/spec/metric_fu/reporting/graphs/graph_spec.rb +44 -0
  274. data/spec/metric_fu/reporting/graphs/grapher_spec.rb +24 -0
  275. data/spec/metric_fu/reporting/result_spec.rb +50 -0
  276. data/spec/metric_fu/run_spec.rb +197 -0
  277. data/spec/metric_fu/templates/configuration_spec.rb +51 -0
  278. data/spec/metric_fu/templates/metrics_template_spec.rb +11 -0
  279. data/spec/metric_fu/templates/report_spec.rb +15 -0
  280. data/spec/metric_fu/templates/template_spec.rb +233 -0
  281. data/spec/metric_fu/utility_spec.rb +12 -0
  282. data/spec/metric_fu_spec.rb +33 -0
  283. data/spec/quality_spec.rb +114 -0
  284. data/spec/shared/configured.rb +45 -0
  285. data/spec/shared/test_coverage.rb +95 -0
  286. data/spec/spec_helper.rb +54 -0
  287. data/spec/support/deferred_garbaged_collection.rb +33 -0
  288. data/spec/support/helper_methods.rb +32 -0
  289. data/spec/support/matcher_create_file.rb +37 -0
  290. data/spec/support/matcher_create_files.rb +43 -0
  291. data/spec/support/suite.rb +26 -0
  292. data/spec/support/test_fixtures.rb +37 -0
  293. data/spec/support/timeout.rb +7 -0
  294. data/spec/support/usage_test.rb +150 -0
  295. data/spec/usage_test_spec.rb +93 -0
  296. metadata +757 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1ed526fc057c65f525f4da0ca4fbe912ce55b4d
4
+ data.tar.gz: 300ab4f5400f9babb33a9254260aec163bcebb96
5
+ SHA512:
6
+ metadata.gz: 6bda1409f5803ea9b66125d7ab450b8761216ec2d3609aff500d363ea8a36850a09f131489b4d65800a7a64f0a96f75dce0b7ecd9b5f764eb0dd1aacdac8c190
7
+ data.tar.gz: 5ad355b62d0828c6e63c739d75f206905958d75a6616feae203f91731fb768112ddbe57c92edf0564a1dca60283fa55b650e5f5133d28da2d9b3108aad278dd6
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ .DS_Store
2
+ .rvmrc*
3
+ *.gem
4
+ *.rbc
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.swp
21
+ tags
22
+ .idea
23
+
24
+ # rvm
25
+ .ruby-version
26
+ .ruby-gemset
27
+
28
+ .overcommit.yml
data/.metrics ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Put configuration code here
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --profile
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ inherit_from:
2
+ - config/rubocop.yml
3
+ - .rubocop_todo.yml
4
+
5
+ # Files you want to exclude
6
+ AllCops:
7
+ Exclude:
8
+ - bin/*
9
+ - gem_tasks/*
10
+ - lib/tasks/*
11
+ - Gemfile
12
+ - Rakefile
13
+ - bundle/**/*
14
+ - vendor/bundle/**/*
15
+ - spec/fixtures/line_numbers/*
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,69 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-01-27 12:05:28 -0600 using RuboCop version 0.28.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 2
9
+ # Configuration parameters: AlignWith, SupportedStyles.
10
+ Lint/EndAlignment:
11
+ Enabled: false
12
+
13
+ # Offense count: 2
14
+ Lint/EnsureReturn:
15
+ Enabled: false
16
+
17
+ # Offense count: 1
18
+ Lint/RescueException:
19
+ Enabled: false
20
+
21
+ # Offense count: 10
22
+ Lint/ShadowingOuterLocalVariable:
23
+ Enabled: false
24
+
25
+ # Offense count: 1
26
+ Lint/UselessAccessModifier:
27
+ Enabled: false
28
+
29
+ # Offense count: 27
30
+ Lint/UselessAssignment:
31
+ Enabled: false
32
+
33
+ # Offense count: 44
34
+ Metrics/AbcSize:
35
+ Max: 56
36
+
37
+ # Offense count: 393
38
+ # Configuration parameters: AllowURI, URISchemes.
39
+ Metrics/LineLength:
40
+ Max: 709
41
+
42
+ # Offense count: 3
43
+ Metrics/PerceivedComplexity:
44
+ Max: 13
45
+
46
+ # Offense count: 4
47
+ # Cop supports --auto-correct.
48
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
49
+ Style/AndOr:
50
+ Enabled: false
51
+
52
+ # Offense count: 2
53
+ Style/EmptyElse:
54
+ Enabled: false
55
+
56
+ # Offense count: 2
57
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist.
58
+ Style/PredicateName:
59
+ Enabled: false
60
+
61
+ # Offense count: 1
62
+ Style/RescueModifier:
63
+ Enabled: false
64
+
65
+ # Offense count: 4
66
+ # Cop supports --auto-correct.
67
+ # Configuration parameters: AllowAsExpressionSeparator.
68
+ Style/Semicolon:
69
+ Enabled: false
data/.simplecov ADDED
@@ -0,0 +1,74 @@
1
+ # https://github.com/colszowka/simplecov#using-simplecov-for-centralized-config
2
+ # see https://github.com/colszowka/simplecov/blob/master/lib/simplecov/defaults.rb
3
+ # vim: set ft=ruby
4
+ @minimum_coverage = ENV.fetch("COVERAGE_MINIMUM") { 87.8 }.to_f.round(2)
5
+ if SimpleCov.respond_to?(:profiles)
6
+ SimpleCov.profiles
7
+ else
8
+ SimpleCov.adapters
9
+ end.define 'metric_fu' do
10
+ if defined?(load_profile)
11
+ load_profile 'test_frameworks'
12
+ else
13
+ load_adapter 'test_frameworks'
14
+ end
15
+
16
+ add_group "Cli", "lib/metric_fu/cli"
17
+ add_group "Data Structures", "lib/metric_fu/data_structures"
18
+ add_group "Formatters", "lib/metric_fu/formatter"
19
+ add_group "Hotspots", "lib/metric_fu/metrics/hotspots"
20
+ add_group "Metrics", "lib/metric_fu/metrics"
21
+ add_group "Reporters", "lib/metric_fu/reporting"
22
+ add_group "Templates", "lib/metric_fu/templates"
23
+
24
+ add_group "Long files" do |src_file|
25
+ src_file.lines.count > 100
26
+ end
27
+ class MaxLinesFilter < SimpleCov::Filter
28
+ def matches?(source_file)
29
+ source_file.lines.count < filter_argument
30
+ end
31
+ end
32
+ add_group "Short files", MaxLinesFilter.new(5)
33
+
34
+ # Exclude these paths from analysis
35
+ add_filter 'bundle'
36
+ add_filter 'vendor/bundle'
37
+ add_filter 'bin'
38
+ add_filter 'lib/metric_fu/tasks'
39
+
40
+ # https://github.com/colszowka/simplecov/blob/v0.9.1/lib/simplecov/defaults.rb#L60
41
+ # minimum_coverage @minimum_coverage
42
+ end
43
+
44
+ ## RUN SIMPLECOV
45
+ if defined?(@running_tests)
46
+ @running_tests = false
47
+ else
48
+ @running_tests = caller.any? {|line| line =~ /exe\/rspec/ }
49
+ end
50
+ if ENV["COVERAGE"] =~ /\Atrue\z/i
51
+ puts "[COVERAGE] Running with SimpleCov HTML Formatter"
52
+ formatters = [SimpleCov::Formatter::HTMLFormatter]
53
+ begin
54
+ puts '[COVERAGE] Running with SimpleCov HTML Formatter'
55
+ require 'metric_fu/metrics/rcov/simplecov_formatter'
56
+ formatters << SimpleCov::Formatter::MetricFu
57
+ puts '[COVERAGE] Running with SimpleCov MetricFu Formatter'
58
+ rescue LoadError
59
+ puts '[COVERAGE] SimpleCov MetricFu formatter could not be loaded'
60
+ end
61
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ *formatters ]
62
+ SimpleCov.start "metric_fu" if @running_tests
63
+ else
64
+ SimpleCov.formatters = []
65
+ end
66
+ SimpleCov.at_exit do
67
+ SimpleCov.result.format!
68
+ percent = Float(SimpleCov.result.covered_percent)
69
+ if percent < @minimum_coverage
70
+ abort "Spec coverage was not high enough: #{percent.round(2)} is < #{@minimum_coverage}%"
71
+ else
72
+ puts "Nice job! Spec coverage is still above #{@minimum_coverage}%"
73
+ end
74
+ end
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ sudo: false
2
+ language: ruby
3
+ bundler_args: --path vendor/bundle --jobs=3 --retry=3
4
+ script: bundle exec rspec
5
+ cache: bundler
6
+
7
+ before_install:
8
+ - gem install bundler
9
+ - bundle config --local without local_development yard guard
10
+ rvm:
11
+ # 2.1, not 2.1.0 until fixed https://github.com/travis-ci/travis-ci/issues/2220
12
+ - 2.2
13
+ - 2.1
14
+ - 2.0.0
15
+ - 1.9.2
16
+ - 1.9.3
17
+ - jruby
18
+ - "rbx-2"
19
+ matrix:
20
+ allow_failures:
21
+ - rvm: rbx-2
22
+ fast_finish: true
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private
2
+ --readme README.md
3
+ lib/metric_fu.rb
4
+ lib/metric_fu/**/*.rb
data/AUTHORS ADDED
@@ -0,0 +1,12 @@
1
+ Jake Scruggs
2
+ Sean Soper
3
+ Andre Arko
4
+ Petrik de Heus
5
+ Grant McInnes
6
+ Nick Quaranto
7
+ Édouard Brière
8
+ Carl Youngblood
9
+ Richard Huang
10
+ Dan Mayer
11
+ Benjamin Fleischer
12
+ Robin Curry
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,47 @@
1
+ How to contribute:
2
+
3
+ ## Bug reports / Issues
4
+
5
+ * Is something broken or not working as expected? Check for an existing issue or [create a new one](https://github.com/metricfu/metric_fu/issues/new)
6
+ * See [Quick guide to writing good bug reports](https://github.com/metricfu/metric_fu/wiki/Issues:-Quick-guide-to-writing-good-bug-reports)
7
+ * IMPORTANT: Include the output of `metric_fu --debug-info`
8
+
9
+ ## Code
10
+
11
+ 1. Fork and clone the repo: `git clone git://github.com/yourghname/metric_fu.git && cd metric_fu`
12
+ 2. Install the gem dependencies: `bundle install`
13
+ 3. Make the changes you want and back them up with tests.
14
+ * Run the tests (`bundle exec rspec`)
15
+ * Run metric_fu on itself (`bundle exec ruby -Ilib bin/metric_fu`)
16
+ 4. Update the HISTORY.md file with your changes and give yourself credit
17
+ 5. Commit and create a pull request with details as to what has been changed and why
18
+ * Use well-described, small (atomic) commits.
19
+ * Include links to any relevant github issues.
20
+ * *Don't* change the VERSION file.
21
+ 6. Extra Credit: [Confirm it runs and tests pass on the rubies specified in the travis config](.travis.yml). I will otherwise confirm it runs on these.
22
+
23
+ How I handle pull requests:
24
+
25
+ * If the tests pass and the pull request looks good, I will merge it.
26
+ * If the pull request needs to be changed,
27
+ * you can change it by updating the branch you generated the pull request from
28
+ * either by adding more commits, or
29
+ * by force pushing to it
30
+ * I can make any changes myself and manually merge the code in.
31
+
32
+ ### Commit Messages
33
+
34
+ * [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
35
+ * [http://stopwritingramblingcommitmessages.com/](http://stopwritingramblingcommitmessages.com/)
36
+ * [ThoughtBot style guide](https://github.com/thoughtbot/guides/tree/master/style#git)
37
+
38
+ ### About Pull Requests (PR's)
39
+
40
+ * [All Your Open Source Code Are Belong To Us](http://www.benjaminfleischer.com/2013/07/30/all-your-open-source-code-are-belong-to-us/)
41
+ * [Using Pull Requests](https://help.github.com/articles/using-pull-requests)
42
+ * [Github pull requests made easy](http://www.element84.com/github-pull-requests-made-easy.html)
43
+
44
+ ## Documentation
45
+
46
+ * If relevant, you may update [the metric_fu website](https://github.com/metricfu/metricfu.github.com) in a separate pull request to that repo
47
+ * Update the wiki
data/CONTRIBUTORS ADDED
@@ -0,0 +1,76 @@
1
+ Benjamin Fleischer
2
+ Jake Scruggs
3
+ Édouard Brière
4
+ Richard Huang
5
+ Grant McInnes
6
+ Petrik
7
+ Dan Mayer
8
+ Robin Curry
9
+ Sean Soper
10
+ Delwyn de Villiers
11
+ Martin Gotink
12
+ Carl Youngblood
13
+ Andre Arko
14
+ Chris Griego
15
+ Sathish
16
+ Michael Stark
17
+ Nick Quaranto
18
+ dan sinclair
19
+ joshuacronemeyer
20
+ jscruggs
21
+ David Chelimsky
22
+ adrien
23
+ Jay Zeschin
24
+ Greg Allen
25
+ Alex Rothenberg
26
+ calveto
27
+ Avdi Grimm
28
+ Kevin Rutherford
29
+ Randy Souza
30
+ GeorgeErickson
31
+ Josef Šimánek
32
+ Andy Gregorowicz
33
+ Tarsoly András
34
+ Benjamin Fleischer / Paul Swagerty
35
+ Nick Veys
36
+ unknown
37
+ Micah Geisel
38
+ Extrovert
39
+ Ben Turner
40
+ Andrew Timberlake
41
+ KAKUTANI Shintaro
42
+ Guilherme Souza
43
+ Przemysław Dąbek
44
+ carlost
45
+ David Barri
46
+ Beau Fabry
47
+ Chris Mason
48
+ Andrew Selder
49
+ iain
50
+ Mark Wilden
51
+ Alessandro Dias
52
+ Lars E. Hoeg
53
+ Eric Wollesen
54
+ Adam Bair
55
+ Jinzhu
56
+ Matthew Van Horn
57
+ Diego Carrion
58
+ saltracer
59
+ benlovell
60
+ ff-cviradiya
61
+ khall
62
+ Stefan Huber
63
+ Todd A. Jacobs
64
+ jayzes
65
+ Hans Hasselberg
66
+ Scyllinice
67
+ Bitdeli Chef
68
+ René Föhring
69
+ Matthew Gordon
70
+ factorylabs
71
+ Mike Ball
72
+ Guilherme Simões
73
+ Paul Elliott
74
+ Joel Nimety
75
+ Chris Ian Fiel
76
+ Mike Szyndel
data/DEV.md ADDED
@@ -0,0 +1,76 @@
1
+ ## Contracted Interfaces
2
+
3
+ ```ruby
4
+ MetricFu.run_dir #=> Dir.pwd
5
+ MetricFu.run_dir = 'some_path'
6
+ MetricFu.run_path #=> Pathname(Dir.pwd)
7
+ MetricFu.root_dir
8
+ MetricFu.loader.load_user_configuration
9
+ MetricFu.loader.loaded_files
10
+ MetricFu.lib_require { 'utility' }
11
+ MetricFu.lib_dir #=> metric_fu/lib
12
+ MetricFu.lib_require('metrics') { 'flog/metric' }
13
+ MetricFu.metrics_require {'flog/metric' }
14
+ MetricFu.metrics_dir #=> metric_fu/lib/metrics
15
+ MetricFu.formatter_require { 'html' }
16
+ MetricFu.formatter_dir #=> metric_fu/lib/formatter
17
+ MetricFu.reporting_require { 'result' }
18
+ MetricFu.reporting_dir #=> metric_fu/lib/reporting
19
+ MetricFu.logging_require { 'mf_debugger' }
20
+ MetricFu.lib_require { 'logger' }
21
+ MetricFu.logging_dir #=> metric_fu/lib/logging
22
+ MetricFu.errors_require { 'analysis_error' }
23
+ MetricFu.errors_dir #=> metric_fu/lib/errors
24
+ MetricFu.data_structures_require { 'line_numbers' }
25
+ MetricFu.data_structures_dir #=> metric_fu/lib/data_structures
26
+ MetricFu.tasks_require { } # Doesn't work as expected. Don't use
27
+ MetricFu.tasks_dir #=> metric_fu/lib/tasks
28
+
29
+ MetricFu.configuration #=> MetricFu::Configuration.new
30
+ MetricFu.configuration.configure_metrics # for each metric, yield to block or runs enable, activate
31
+ MetricFu.configuration.configure_metric(:flog) do |metric|
32
+ metric.run_options #=> metric.default_run_options.merge(metric.configured_run_options)
33
+ metric.enable
34
+ metric.enabled = true
35
+ metric.activate
36
+ metric.activated = true
37
+ metric.name #=> :flog
38
+ end
39
+ ```
40
+
41
+ ## Templates
42
+
43
+ ```ruby
44
+ # Given
45
+ template = MetricFu::Templates::MetricsTemplate.new
46
+
47
+ # Render _report_footer.html.erb partial:
48
+
49
+ template.render_partial('report_footer')
50
+
51
+ # Render _graph.html.erb partial and set a graph_name instance variable:
52
+
53
+ template.render_partial 'graph', {:graph_name => 'reek'}
54
+ ```
55
+
56
+ ## Testing
57
+
58
+ `bundle exec rspec`
59
+
60
+ ## Forking
61
+
62
+ ## Issues / Pull Requests
63
+
64
+ * see [CONTRIBUTING](CONTRIBUTING.md)
65
+
66
+ ## Building
67
+
68
+ `rake build` or `rake install`
69
+
70
+ ## Releasing
71
+
72
+ 0. Run `rake usage_test` to make sure the examples are still valid
73
+ 1. Update lib/metric_fu/version.rb
74
+ 2. Update HISTORY.md
75
+ 3. Update CONTRIBUTORS and erd per README in etc
76
+ 3. `rake release`
data/Gemfile ADDED
@@ -0,0 +1,74 @@
1
+ # encoding: utf-8
2
+ source "https://rubygems.org"
3
+
4
+ if RUBY_VERSION =~ /^2\.2\.[0-1]p?\d*/ || RUBY_VERSION =~ /^2\.1\.\d*p?\d*/
5
+ gem "activesupport", "~> 4.2"
6
+ gem "json", "~> 1.7"
7
+ gem "rubocop", platforms: :mri, groups: [:test, :local_development]
8
+ elsif RUBY_VERSION =~ /^2\.0\..*/
9
+ gem "activesupport", "~> 4.2"
10
+ gem "json", "~> 1.7"
11
+ gem "unparser", "0.2.4"
12
+ gem "rubocop", platforms: :mri, groups: [:test, :local_development]
13
+ elsif RUBY_VERSION =~ /^1\.9\.3.*/
14
+ gem "activesupport", "~> 4.2"
15
+ gem "json", "~> 1.7"
16
+ gem "unparser", "0.2.4"
17
+ gem "json_pure", "2.0.1"
18
+ gem "mime-types", "2.99.3"
19
+ gem "rest-client", "1.8.0"
20
+ gem "rubocop", platforms: :mri, groups: [:test, :local_development]
21
+ gem "addressable", "2.4.0"
22
+ gem "ffi", "1.9.14" # windows support
23
+ elsif RUBY_VERSION =~ /^1\.9\.2.*/
24
+ # because of https://github.com/railsbp/rails_best_practices/blob/master/rails_best_practices.gemspec
25
+ gem "activesupport", "~> 3.2"
26
+ # because of https://github.com/troessner/reek/issues/334
27
+ gem "reek", "~> 1.4.0"
28
+ # rbp -> as -> i18n
29
+ gem "i18n", "0.6.11"
30
+ gem "parallel", "= 1.3.3" # 1.3.4 disallows 1.9.2
31
+ gem "unparser", "0.1.5"
32
+ gem "json_pure", "2.0.1"
33
+ gem "mime-types", "2.99.3"
34
+ gem "rest-client", "1.8.0"
35
+ gem "json", "~> 1.7"
36
+ gem "addressable", "2.4.0"
37
+ gem "rainbow", "2.1.0"
38
+ gem "ffi", "1.9.14" # windows support
39
+ end
40
+
41
+ gemspec path: File.expand_path("..", __FILE__)
42
+
43
+ platform :jruby do
44
+ group :jruby do
45
+ gem "jruby-openssl", "~> 0.9.17"
46
+ end
47
+ end
48
+
49
+ group :test, :local_development do
50
+ gem "pry"
51
+ gem "pry-nav"
52
+ end
53
+
54
+ # Added by devtools
55
+ group :development do
56
+ gem "rake", "~> 10.1.0"
57
+ gem "yard", "~> 0.8.7", group: :yard
58
+ end
59
+
60
+ group :guard do
61
+ gem "guard", "~> 1.8.1"
62
+ gem "guard-bundler", "~> 1.0.0"
63
+ gem "guard-rspec"
64
+
65
+ # file system change event handling
66
+ gem "listen", "~> 1.3.0"
67
+ gem "rb-fchange", "~> 0.0.6", require: false
68
+ gem "rb-fsevent", "~> 0.9.3", require: false
69
+ gem "rb-inotify", "~> 0.9.0", require: false
70
+
71
+ # notification handling
72
+ gem "libnotify", "~> 0.8.0", require: false
73
+ gem "terminal-notifier-guard", "~> 1.5.3", require: false
74
+ end
data/Guardfile ADDED
@@ -0,0 +1,30 @@
1
+ guard :bundler do
2
+ watch("Gemfile")
3
+ watch("Gemfile.lock")
4
+ watch(%w{.+.gemspec\z})
5
+ end
6
+
7
+ guard :rspec, cli: File.read(".rspec").split.push("--fail-fast").join(" "), keep_failed: false do
8
+ # Run all specs if configuration is modified
9
+ watch(".rspec") { "spec" }
10
+ watch("Guardfile") { "spec" }
11
+ watch("Gemfile.lock") { "spec" }
12
+ watch("spec/spec_helper.rb") { "spec" }
13
+
14
+ # Run all specs if supporting files are modified
15
+ watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { "spec" }
16
+
17
+ # Run unit specs if associated lib code is modified
18
+ watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
19
+ watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { "spec" }
20
+
21
+ # Run a spec if it is modified
22
+ watch(%r{\Aspec/.+_spec\.rb$\z})
23
+ end
24
+
25
+ # TODO enable once we're ready to handle all the violations :)
26
+ # guard :rubocop, cli: %w[--config config/rubocop.yml] do
27
+ # watch(%r{.+\.(?:rb|rake)\z})
28
+ # watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) }
29
+ # watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) }
30
+ # end