yardstick 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +4 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +11 -16
  6. data/CONTRIBUTING.md +11 -0
  7. data/Gemfile +3 -59
  8. data/Gemfile.devtools +54 -0
  9. data/Guardfile +32 -0
  10. data/LICENSE +1 -1
  11. data/README.md +71 -55
  12. data/Rakefile +2 -7
  13. data/TODO +12 -0
  14. data/bin/yardstick +1 -0
  15. data/config/devtools.yml +2 -0
  16. data/config/flay.yml +2 -2
  17. data/config/flog.yml +1 -1
  18. data/config/mutant.yml +3 -0
  19. data/config/{site.reek → reek.yml} +31 -25
  20. data/config/rubocop.yml +49 -0
  21. data/config/yardstick.yml +31 -0
  22. data/lib/yardstick.rb +35 -15
  23. data/lib/yardstick/cli.rb +7 -7
  24. data/lib/yardstick/config.rb +176 -0
  25. data/lib/yardstick/document.rb +215 -0
  26. data/lib/yardstick/document_set.rb +21 -0
  27. data/lib/yardstick/measurement.rb +18 -145
  28. data/lib/yardstick/measurement_set.rb +2 -2
  29. data/lib/yardstick/parser.rb +61 -0
  30. data/lib/yardstick/processor.rb +21 -35
  31. data/lib/yardstick/rake/measurement.rb +7 -49
  32. data/lib/yardstick/rake/verify.rb +28 -55
  33. data/lib/yardstick/report_output.rb +57 -0
  34. data/lib/yardstick/rule.rb +64 -37
  35. data/lib/yardstick/rule_config.rb +56 -0
  36. data/lib/yardstick/rules/api_tag.rb +95 -0
  37. data/lib/yardstick/rules/example_tag.rb +33 -0
  38. data/lib/yardstick/rules/return_tag.rb +21 -0
  39. data/lib/yardstick/rules/summary.rb +87 -0
  40. data/lib/yardstick/version.rb +1 -1
  41. data/lib/yardstick/yard_ext.rb +1 -6
  42. data/spec/integration/yardstick/class_methods/measure_spec.rb +22 -0
  43. data/spec/integration/yardstick/class_methods/measure_string_spec.rb +20 -0
  44. data/spec/integration/yardstick/document/file_spec.rb +16 -0
  45. data/spec/integration/yardstick/document/line_spec.rb +25 -0
  46. data/spec/integration/yardstick/document/path_spec.rb +45 -0
  47. data/spec/integration/yardstick/processor/process_string_spec.rb +401 -0
  48. data/spec/integration/yardstick/rake/measurement_spec.rb +22 -0
  49. data/spec/integration/yardstick/rake/verify_spec.rb +19 -0
  50. data/spec/shared/measured_itself_behavior.rb +15 -0
  51. data/spec/spec_helper.rb +13 -26
  52. data/spec/support/document_mock.rb +16 -0
  53. data/spec/support/rules.rb +51 -0
  54. data/spec/unit/yardstick/class_methods/measure_spec.rb +31 -0
  55. data/spec/unit/yardstick/class_methods/measure_string_spec.rb +33 -0
  56. data/spec/unit/yardstick/cli_spec.rb +11 -8
  57. data/spec/unit/yardstick/config/class_methods/coerce_spec.rb +32 -0
  58. data/spec/unit/yardstick/config/for_rule_spec.rb +47 -0
  59. data/spec/unit/yardstick/config/initialize_spec.rb +21 -0
  60. data/spec/unit/yardstick/config/output_spec.rb +15 -0
  61. data/spec/unit/yardstick/config/output_writer_spec.rb +20 -0
  62. data/spec/unit/yardstick/config/path_spec.rb +13 -0
  63. data/spec/unit/yardstick/config/path_writer_spec.rb +11 -0
  64. data/spec/unit/yardstick/config/require_exact_threshold_predicate_spec.rb +19 -0
  65. data/spec/unit/yardstick/config/require_exact_threshold_writer_spec.rb +19 -0
  66. data/spec/unit/yardstick/config/set_defaults_spec.rb +42 -0
  67. data/spec/unit/yardstick/config/threshold_writer_spec.rb +15 -0
  68. data/spec/unit/yardstick/config/verbose_predicate_spec.rb +19 -0
  69. data/spec/unit/yardstick/config/verbose_writer_spec.rb +19 -0
  70. data/spec/unit/yardstick/document/api_predicate_spec.rb +25 -0
  71. data/spec/unit/yardstick/document/class_methods/measure_spec.rb +25 -0
  72. data/spec/unit/yardstick/document/class_methods/register_rule_spec.rb +19 -0
  73. data/spec/unit/yardstick/document/class_methods/registered_rules_spec.rb +9 -0
  74. data/spec/unit/yardstick/document/docstring_spec.rb +11 -0
  75. data/spec/unit/yardstick/document/file_spec.rb +14 -0
  76. data/spec/unit/yardstick/document/has_tag_predicate_spec.rb +15 -0
  77. data/spec/unit/yardstick/document/line_spec.rb +12 -0
  78. data/spec/unit/yardstick/document/null_tag/text_spec.rb +9 -0
  79. data/spec/unit/yardstick/document/null_tag/types_spec.rb +9 -0
  80. data/spec/unit/yardstick/document/path_spec.rb +12 -0
  81. data/spec/unit/yardstick/document/summary_text_spec.rb +23 -0
  82. data/spec/unit/yardstick/document/tag_text_spec.rb +17 -0
  83. data/spec/unit/yardstick/document/tag_types_spec.rb +18 -0
  84. data/spec/unit/yardstick/document/visibility_spec.rb +22 -0
  85. data/spec/unit/yardstick/document_set/measure_spec.rb +28 -0
  86. data/spec/unit/yardstick/measurement/description_spec.rb +12 -0
  87. data/spec/unit/yardstick/measurement/initialize_spec.rb +12 -0
  88. data/spec/unit/yardstick/measurement/ok_predicate_spec.rb +21 -0
  89. data/spec/unit/yardstick/measurement/puts_spec.rb +62 -0
  90. data/spec/unit/yardstick/measurement/skip_predicate_spec.rb +27 -0
  91. data/spec/unit/yardstick/measurement_set/coverage_spec.rb +23 -0
  92. data/spec/unit/yardstick/measurement_set/failed_spec.rb +28 -0
  93. data/spec/unit/yardstick/measurement_set/initialize_spec.rb +27 -0
  94. data/spec/unit/yardstick/measurement_set/puts_spec.rb +63 -0
  95. data/spec/unit/yardstick/measurement_set/successful_spec.rb +13 -0
  96. data/spec/unit/yardstick/measurement_set/total_spec.rb +12 -0
  97. data/spec/unit/yardstick/ordered_set/each_spec.rb +18 -0
  98. data/spec/unit/yardstick/ordered_set/empty_predicate_spec.rb +19 -0
  99. data/spec/unit/yardstick/ordered_set/include_predicate_spec.rb +21 -0
  100. data/spec/unit/yardstick/ordered_set/index_spec.rb +21 -0
  101. data/spec/unit/yardstick/ordered_set/left_shift_operator_spec.rb +16 -0
  102. data/spec/unit/yardstick/ordered_set/length_spec.rb +11 -0
  103. data/spec/unit/yardstick/ordered_set/merge_spec.rb +16 -0
  104. data/spec/unit/yardstick/parser/class_methods/parse_paths_spec.rb +28 -0
  105. data/spec/unit/yardstick/parser/class_methods/parse_string_spec.rb +28 -0
  106. data/spec/unit/yardstick/processor/process_spec.rb +17 -0
  107. data/spec/unit/yardstick/processor/process_string_spec.rb +17 -0
  108. data/spec/unit/yardstick/rake/measurement/initialize_spec.rb +64 -0
  109. data/spec/unit/yardstick/rake/measurement/yardstick_measure_spec.rb +22 -0
  110. data/spec/unit/yardstick/rake/verify/initialize_spec.rb +72 -0
  111. data/spec/unit/yardstick/rake/verify/verify_measurements_spec.rb +85 -0
  112. data/spec/unit/yardstick/report_output/class_methods/coerce_spec.rb +18 -0
  113. data/spec/unit/yardstick/report_output/initialize_spec.rb +11 -0
  114. data/spec/unit/yardstick/report_output/to_s_spec.rb +12 -0
  115. data/spec/unit/yardstick/report_output/write_spec.rb +31 -0
  116. data/spec/unit/yardstick/round_percentage_spec.rb +9 -0
  117. data/spec/unit/yardstick/rule/class_methods/coerce_spec.rb +21 -0
  118. data/spec/unit/yardstick/rule/class_methods/inherited_spec.rb +15 -0
  119. data/spec/unit/yardstick/rule/enabled_predicate_spec.rb +18 -0
  120. data/spec/unit/yardstick/rule/initialize_spec.rb +25 -0
  121. data/spec/unit/yardstick/rule/validatable_predicate_spec.rb +11 -0
  122. data/spec/unit/yardstick/rule_config/enabled_for_path_predicate_spec.rb +41 -0
  123. data/spec/unit/yardstick/rule_config/initialize_spec.rb +16 -0
  124. data/spec/unit/yardstick/rules/api_tag/inclusion/valid_predicate_spec.rb +27 -0
  125. data/spec/unit/yardstick/rules/api_tag/presence/valid_predicate_spec.rb +25 -0
  126. data/spec/unit/yardstick/rules/api_tag/private_method/valid_predicate_spec.rb +21 -0
  127. data/spec/unit/yardstick/rules/api_tag/private_method/validatable_predicate_spec.rb +21 -0
  128. data/spec/unit/yardstick/rules/api_tag/protected_method/valid_predicate_spec.rb +25 -0
  129. data/spec/unit/yardstick/rules/api_tag/protected_method/validatable_predicate_spec.rb +21 -0
  130. data/spec/unit/yardstick/rules/example_tag/valid_predicate_spec.rb +25 -0
  131. data/spec/unit/yardstick/rules/example_tag/validatable_predicate_spec.rb +32 -0
  132. data/spec/unit/yardstick/rules/return_tag/valid_predicate_spec.rb +21 -0
  133. data/spec/unit/yardstick/rules/summary/delimiter/valid_predicate_spec.rb +21 -0
  134. data/spec/unit/yardstick/rules/summary/length/valid_predicate_spec.rb +27 -0
  135. data/spec/unit/yardstick/rules/summary/presence/valid_predicate_spec.rb +21 -0
  136. data/spec/unit/yardstick/rules/summary/presence/validatable_predicate_spec.rb +21 -0
  137. data/spec/unit/yardstick/rules/summary/single_line/valid_predicate_spec.rb +21 -0
  138. data/yardstick.gemspec +7 -11
  139. metadata +222 -65
  140. data/.rvmrc +0 -1
  141. data/lib/yardstick/measurable.rb +0 -67
  142. data/lib/yardstick/method.rb +0 -113
  143. data/lib/yardstick/rule_set.rb +0 -22
  144. data/spec/support/config_alias.rb +0 -5
  145. data/spec/unit/yardstick/measurement_set_spec.rb +0 -266
  146. data/spec/unit/yardstick/measurement_spec.rb +0 -257
  147. data/spec/unit/yardstick/method_spec.rb +0 -357
  148. data/spec/unit/yardstick/rake/measurement_spec.rb +0 -175
  149. data/spec/unit/yardstick/rake/verify_spec.rb +0 -231
  150. data/spec/unit/yardstick/rule_spec.rb +0 -36
  151. data/spec/unit/yardstick_spec.rb +0 -71
  152. data/tasks/metrics/ci.rake +0 -9
  153. data/tasks/metrics/flay.rake +0 -53
  154. data/tasks/metrics/flog.rake +0 -44
  155. data/tasks/metrics/heckle.rake +0 -52
  156. data/tasks/metrics/metric_fu.rake +0 -31
  157. data/tasks/metrics/reek.rake +0 -21
  158. data/tasks/metrics/roodi.rake +0 -19
  159. data/tasks/metrics/yardstick.rake +0 -27
  160. data/tasks/spec.rake +0 -64
  161. data/tasks/yard.rake +0 -11
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c2137c6b2747b94bf79c7d18f96f3046b88cad1
4
+ data.tar.gz: 3b701a6a2923c7925ff69040a03befa7a6a6ba85
5
+ SHA512:
6
+ metadata.gz: 2cd3503aa97404404f678d781a4f144f73cf80662389cef07a2252af4236ffe51b10311e274847b457c1ce2cd4c4da44e7b4225f0a23c51704f0d50ee1258bf1
7
+ data.tar.gz: dc976e0b2f8477add7b52a5bdf2142bea4e5d22150601da3e0e8e493cfe1794c851eb83d14e8bef81ee6f0788865986d38a0f1ac301cd9bf124809c7d212ad48
data/.gitignore CHANGED
@@ -28,6 +28,7 @@ doc
28
28
  log
29
29
  .yardoc
30
30
  measurements
31
+ tags
31
32
 
32
33
  ## BUNDLER
33
34
  .bundle
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format progress
3
+ --profile
4
+ --order random
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ yardstick
data/.travis.yml CHANGED
@@ -3,29 +3,24 @@ before_install: gem install bundler
3
3
  bundler_args: --without yard guard benchmarks
4
4
  script: "bundle exec rake ci"
5
5
  rvm:
6
- - ree
7
- - 1.8.7
8
- - 1.9.2
9
6
  - 1.9.3
10
7
  - 2.0.0
11
8
  - ruby-head
12
- - rbx-18mode
13
9
  - rbx-19mode
14
- - jruby-18mode
15
- notifications:
16
- irc:
17
- channels:
18
- - irc.freenode.org#datamapper
19
- on_success: never
20
- on_failure: change
21
- email:
22
- recipients:
23
- - dan.kubb@gmail.com
24
- on_success: never
25
- on_failure: change
26
10
  matrix:
27
11
  include:
28
12
  - rvm: jruby-19mode
29
13
  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
30
14
  - rvm: jruby-head
31
15
  env: JRUBY_OPTS="$JRUBY_OPTS --debug"
16
+ allow_failures:
17
+ - rvm: 1.9.3 # mutant fails
18
+ - rvm: 2.0.0 # mutant fails
19
+ - rvm: ruby-head # travis broken
20
+ - rvm: rbx-19mode # mutant fails
21
+ notifications:
22
+ irc:
23
+ channels:
24
+ - irc.freenode.org#rom-rb
25
+ on_success: never
26
+ on_failure: change
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,11 @@
1
+ Contributing
2
+ ------------
3
+
4
+ * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
5
+ * Fork the project.
6
+ * Make your feature addition or bug fix.
7
+ * Follow this [style guide](https://github.com/dkubb/styleguide).
8
+ * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
9
+ * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
10
+ * Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
11
+ * Send me a pull request. Bonus points for topic branches.
data/Gemfile CHANGED
@@ -4,64 +4,8 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- group :development do
8
- gem 'rake', '~> 10.0.4'
9
- gem 'rspec', '~> 1.3.2'
7
+ group :development, :test do
8
+ gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
10
9
  end
11
10
 
12
- group :yard do
13
- gem 'kramdown', '~> 1.0.1'
14
- end
15
-
16
- group :guard do
17
- gem 'guard', '~> 1.7.0'
18
- gem 'guard-bundler', '~> 1.0.0'
19
- gem 'guard-rspec', '~> 1.2.1'
20
-
21
- # file system change event handling
22
- gem 'listen', '~> 0.7.3'
23
- gem 'rb-fchange', '~> 0.0.6', :require => false
24
- gem 'rb-fsevent', '~> 0.9.3', :require => false
25
- gem 'rb-inotify', '~> 0.9.0', :require => false
26
-
27
- # notification handling
28
- gem 'libnotify', '~> 0.8.0', :require => false
29
- gem 'rb-notifu', '~> 0.0.4', :require => false
30
- gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
31
- end
32
-
33
- group :metrics do
34
- gem 'coveralls', '~> 0.6.5'
35
- gem 'flay', '~> 1.4.3'
36
- gem 'flog', '~> 2.5.3'
37
- gem 'roodi', '~> 2.2.0'
38
- gem 'simplecov', '~> 0.7.1'
39
- gem 'yard-spellcheck', '~> 0.1.5'
40
-
41
- platforms :mri_18 do
42
- gem 'arrayfields', '~> 4.7.4' # for metric_fu
43
- gem 'fattr', '~> 2.2.0' # for metric_fu
44
- gem 'heckle', '~> 1.4.3'
45
- gem 'json', '~> 1.7.7' # for metric_fu rake task
46
- gem 'map', '~> 6.3.0' # for metric_fu
47
- gem 'metric_fu', '~> 2.1.1'
48
- gem 'mspec', '~> 1.5.17'
49
- gem 'rails_best_practices', '= 1.13.3' # for metric_fu
50
- gem 'rcov', '~> 1.0.0'
51
- gem 'ruby2ruby', '= 1.2.2' # for heckle
52
- end
53
-
54
- platforms :rbx do
55
- gem 'pelusa', '~> 0.2.2'
56
- end
57
- end
58
-
59
- group :benchmarks do
60
- gem 'rbench', '~> 0.2.3'
61
- end
62
-
63
- platform :jruby do
64
- group :jruby do
65
- gem 'jruby-openssl', '~> 0.8.5'
66
- end
67
- end
11
+ eval_gemfile 'Gemfile.devtools'
data/Gemfile.devtools ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ group :development do
4
+ gem 'rake', '~> 10.1.0'
5
+ gem 'rspec', '~> 2.14.1'
6
+ gem 'yard', '~> 0.8.7'
7
+ end
8
+
9
+ group :yard do
10
+ gem 'kramdown', '~> 1.2.0'
11
+ end
12
+
13
+ group :guard do
14
+ gem 'guard', '~> 1.8.1'
15
+ gem 'guard-bundler', '~> 1.0.0'
16
+ gem 'guard-rspec', '~> 3.0.2'
17
+ gem 'guard-rubocop', '~> 0.2.0'
18
+ gem 'guard-mutant', '~> 0.0.1'
19
+
20
+ # file system change event handling
21
+ gem 'listen', '~> 1.3.0'
22
+ gem 'rb-fchange', '~> 0.0.6', require: false
23
+ gem 'rb-fsevent', '~> 0.9.3', require: false
24
+ gem 'rb-inotify', '~> 0.9.0', require: false
25
+
26
+ # notification handling
27
+ gem 'libnotify', '~> 0.8.0', require: false
28
+ gem 'rb-notifu', '~> 0.0.4', require: false
29
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
30
+ end
31
+
32
+ group :metrics do
33
+ gem 'coveralls', '~> 0.6.7'
34
+ gem 'flay', '~> 2.4.0'
35
+ gem 'flog', '~> 4.1.1'
36
+ gem 'reek', '~> 1.3.2'
37
+ gem 'rubocop', '~> 0.12.0'
38
+ gem 'simplecov', '~> 0.7.1'
39
+
40
+ platforms :ruby_19, :ruby_20 do
41
+ gem 'mutant', git: 'https://github.com/mbj/mutant.git'
42
+ gem 'yard-spellcheck', '~> 0.1.5'
43
+ end
44
+ end
45
+
46
+ group :benchmarks do
47
+ gem 'rbench', '~> 0.2.3'
48
+ end
49
+
50
+ platform :jruby do
51
+ group :jruby do
52
+ gem 'jruby-openssl', '~> 0.8.5'
53
+ end
54
+ end
data/Guardfile ADDED
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ guard :bundler do
4
+ watch('Gemfile')
5
+ watch('Gemfile.lock')
6
+ watch(%w{.+.gemspec\z})
7
+ end
8
+
9
+ guard :rspec, cli: File.read('.rspec').split.push('--fail-fast').join(' '), keep_failed: false do
10
+ # Run all specs if configuration is modified
11
+ watch('.rspec') { 'spec' }
12
+ watch('Guardfile') { 'spec' }
13
+ watch('Gemfile.lock') { 'spec' }
14
+ watch('spec/spec_helper.rb') { 'spec' }
15
+
16
+ # Run all specs if supporting files files are modified
17
+ watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }
18
+
19
+ # Run unit specs if associated lib code is modified
20
+ watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}*"] }
21
+ watch(%r{\Alib/(.+)/support/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}/#{m[2]}*"] }
22
+ watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
23
+
24
+ # Run a spec if it is modified
25
+ watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
26
+ end
27
+
28
+ guard :rubocop, cli: %w[--config config/rubocop.yml] do
29
+ watch(%r{.+\.(?:rb|rake)\z})
30
+ watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) }
31
+ watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) }
32
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Dan Kubb
1
+ Copyright (c) 2009-2013 Dan Kubb
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # Yardstick
2
- ===========
1
+ # yardstick
3
2
 
4
3
  [![Gem Version](https://badge.fury.io/rb/yardstick.png)][gem]
5
4
  [![Build Status](https://secure.travis-ci.org/dkubb/yardstick.png?branch=master)][travis]
@@ -15,43 +14,8 @@
15
14
 
16
15
  Yardstick is a tool that verifies documentation coverage of Ruby code. It will measure the source and provide feedback on what is missing from the documentation and what can be improved.
17
16
 
18
- * [Homepage](http://yardstick.rubyforge.org/)
19
- * [Git](http://github.com/dkubb/yardstick)
20
- * [Bug Tracker](http://github.com/dkubb/yardstick/issues)
21
- * [Mailing List](http://groups.google.com/group/yardstick)
22
- * [IRC](irc://irc.freenode.net/yardstick)
23
-
24
- Installation
25
- ------------
26
-
27
- With Rubygems:
28
-
29
- ```
30
- $ sudo gem install yardstick
31
- $ irb -rubygems
32
- >> require 'yardstick'
33
- => true
34
- ```
35
-
36
- With the [Rip package manager](http://hellorip.com/):
37
-
38
- ```
39
- $ rip install git://github.com/dkubb/yardstick.git 0.1.0
40
- $ irb -rrip
41
- >> require 'yardstick'
42
- => true
43
- ```
44
-
45
- With git and local working copy:
46
-
47
- ```
48
- $ git clone git://github.com/dkubb/yardstick.git
49
- $ cd yardstick
50
- $ rake build && sudo rake install
51
- $ irb -rubygems
52
- >> require 'yardstick'
53
- => true
54
- ```
17
+ * [Git](https://github.com/dkubb/yardstick)
18
+ * [Bug Tracker](https://github.com/dkubb/yardstick/issues)
55
19
 
56
20
  ## Usage
57
21
 
@@ -121,19 +85,71 @@ measurements = Yardstick.measure_string <<-RUBY
121
85
  RUBY
122
86
  ```
123
87
 
124
- ## TODO
125
-
126
- * Add more measurements, especially for @param, @yield and type
127
- validation
128
- * Update yardstick_measure task to use the Yardstick::CLI library
129
- underneath.
130
- * Output results as HTML from command line tool and Rake task
131
- * Specify method_missing to allow public, semipublic or private even
132
- if its visibility is private
133
- * Allow initialize to be public, semipublic or private regardless of
134
- its visibility. A constructor may not necessarily be public, and may
135
- not be used externally.
136
- * Allow @return type to be "self" to specify the return value is
137
- the object itself. Ask argv[0] if it can be made a YARD convention.
138
-
139
- Copyright (c) 2009 Dan Kubb. See LICENSE for details.
88
+ ### 4. Configuration
89
+
90
+ Every rule in Yardstick can be turned off globally and locally. All rules are enabled and threshold is set to maximum by default.
91
+
92
+ Default configuration:
93
+ ```yaml
94
+ ---
95
+ threshold: 100
96
+ rules:
97
+ ApiTag::Presence:
98
+ enabled: true
99
+ exclude: []
100
+ ApiTag::Inclusion:
101
+ enabled: true
102
+ exclude: []
103
+ ApiTag::ProtectedMethod:
104
+ enabled: true
105
+ exclude: []
106
+ ApiTag::PrivateMethod:
107
+ enabled: true
108
+ exclude: []
109
+ ExampleTag:
110
+ enabled: true
111
+ exclude: []
112
+ ReturnTag:
113
+ enabled: true
114
+ exclude: []
115
+ Summary::Presence:
116
+ enabled: true
117
+ exclude: []
118
+ Summary::Length:
119
+ enabled: true
120
+ exclude: []
121
+ Summary::Delimiter:
122
+ enabled: true
123
+ exclude: []
124
+ Summary::SingleLine:
125
+ enabled: true
126
+ exclude: []
127
+ ```
128
+
129
+ To disable a rule for some part of the code use:
130
+
131
+ ```yaml
132
+ rules:
133
+ ApiTag::Presence:
134
+ enabled: true
135
+ exclude:
136
+ - Foo::Bar # class or module
137
+ - Foo#bar # instance method
138
+ - Foo.bar # class method
139
+ ```
140
+
141
+ Rake tasks take these options as a second argument:
142
+
143
+ ```ruby
144
+ options = YAML.load_file('config/yardstick.yml')
145
+
146
+ Yardstick::Rake::Verify.new(:verify_measurements, options)
147
+ ```
148
+
149
+ ## Contributing
150
+
151
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
152
+
153
+ ## Copyright
154
+
155
+ Copyright (c) 2009-2013 Dan Kubb. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,9 +1,4 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rake'
4
-
5
- require File.expand_path('../lib/yardstick/version', __FILE__)
6
-
7
- FileList['tasks/**/*.rake'].each { |task| import task }
8
-
9
- task :default => :spec
3
+ require 'devtools'
4
+ Devtools.init_rake_tasks
data/TODO ADDED
@@ -0,0 +1,12 @@
1
+ * TODO:
2
+
3
+ * Add more measurements, especially for @param, @yield and type
4
+ validation
5
+ * Update yardstick_measure task to use the Yardstick::CLI library
6
+ underneath.
7
+ * Output results as HTML from command line tool and Rake task
8
+ * Specify method_missing to allow public, semipublic or private even
9
+ if its visibility is private
10
+ * Allow initialize to be public, semipublic or private regardless of
11
+ its visibility. A constructor may not necessarily be public, and may
12
+ not be used externally.
data/bin/yardstick CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby -KU
2
+ # encoding: utf-8
2
3
 
3
4
  $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
4
5
 
@@ -0,0 +1,2 @@
1
+ ---
2
+ unit_test_timeout: 0.3
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
- threshold: 16
3
- total_score: 257
2
+ threshold: 12
3
+ total_score: 160
data/config/flog.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 15.0
2
+ threshold: 11.4
data/config/mutant.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ name: yardstick
3
+ namespace: Yardstick
@@ -2,16 +2,16 @@
2
2
  Attribute:
3
3
  enabled: true
4
4
  exclude:
5
- - Yardstick::Rake::Verify
6
- - Yardstick::Rake::Measurement
7
- - Yardstick::Measurement
5
+ - Yardstick::Config
6
+ - Yardstick::Rule
7
+ - Yardstick::Document
8
8
  BooleanParameter:
9
9
  enabled: true
10
10
  exclude: []
11
11
  ClassVariable:
12
12
  enabled: true
13
13
  exclude: []
14
- ControlCouple:
14
+ ControlParameter:
15
15
  enabled: true
16
16
  exclude: []
17
17
  DataClump:
@@ -19,7 +19,7 @@ DataClump:
19
19
  exclude: []
20
20
  max_copies: 2
21
21
  min_clump_size: 2
22
- Duplication:
22
+ DuplicateMethodCall:
23
23
  enabled: true
24
24
  exclude: []
25
25
  max_calls: 1
@@ -29,25 +29,7 @@ FeatureEnvy:
29
29
  exclude: []
30
30
  IrresponsibleModule:
31
31
  enabled: true
32
- exclude:
33
- - YARD::Docstring
34
- LargeClass:
35
- enabled: true
36
- exclude:
37
- - Yardstick::Measurement
38
- - Yardstick::Rake::Verify
39
- max_instance_variables: 3
40
- max_methods: 10
41
- LongMethod:
42
- enabled: true
43
- exclude:
44
- - Yardstick::CLI#self.option_parser
45
- - Yardstick::CLI#self.parse_options
46
- - Yardstick::CLI#self.run
47
- - Yardstick::OrderedSet#<<
48
- - Yardstick::Processor#self.measurements
49
- - Yardstick::Rake::Verify#verify_measurements
50
- max_statements: 2
32
+ exclude: []
51
33
  LongParameterList:
52
34
  enabled: true
53
35
  exclude: []
@@ -64,10 +46,31 @@ NestedIterators:
64
46
  exclude: []
65
47
  max_allowed_nesting: 1
66
48
  ignore_iterators: []
67
- SimulatedPolymorphism:
49
+ NilCheck:
50
+ enabled: true
51
+ exclude: []
52
+ RepeatedConditional:
68
53
  enabled: true
69
54
  exclude: []
70
55
  max_ifs: 1
56
+ TooManyInstanceVariables:
57
+ enabled: true
58
+ exclude:
59
+ - Yardstick::Config
60
+ max_instance_variables: 3
61
+ TooManyMethods:
62
+ enabled: true
63
+ exclude:
64
+ - Yardstick::Document
65
+ max_methods: 10
66
+ TooManyStatements:
67
+ enabled: true
68
+ exclude:
69
+ - Yardstick::CLI#self.option_parser
70
+ - Yardstick::CLI#self.parse_config
71
+ - Yardstick::Config#set_defaults
72
+ - Yardstick::Config#self.normalize_hash
73
+ max_statements: 3
71
74
  UncommunicativeMethodName:
72
75
  enabled: true
73
76
  exclude: []
@@ -99,6 +102,9 @@ UncommunicativeVariableName:
99
102
  - !ruby/regexp /[0-9]$/
100
103
  - !ruby/regexp /[A-Z]/
101
104
  accept: []
105
+ UnusedParameters:
106
+ enabled: true
107
+ exclude: []
102
108
  UtilityFunction:
103
109
  enabled: true
104
110
  exclude: []