kevinrutherford-reek 0.3.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/History.txt +92 -0
  2. data/README.txt +6 -0
  3. data/Rakefile +7 -0
  4. data/bin/reek +19 -0
  5. data/lib/reek/block_context.rb +37 -0
  6. data/lib/reek/class_context.rb +73 -0
  7. data/lib/reek/code_context.rb +47 -0
  8. data/lib/reek/code_parser.rb +204 -0
  9. data/lib/reek/exceptions.reek +13 -0
  10. data/lib/reek/if_context.rb +25 -0
  11. data/lib/reek/method_context.rb +85 -0
  12. data/lib/reek/module_context.rb +34 -0
  13. data/lib/reek/name.rb +42 -0
  14. data/lib/reek/object_refs.rb +53 -0
  15. data/lib/reek/options.rb +92 -0
  16. data/lib/reek/rake_task.rb +121 -0
  17. data/lib/reek/report.rb +42 -0
  18. data/lib/reek/sexp_formatter.rb +52 -0
  19. data/lib/reek/singleton_method_context.rb +27 -0
  20. data/lib/reek/smell_warning.rb +49 -0
  21. data/lib/reek/smells/control_couple.rb +61 -0
  22. data/lib/reek/smells/duplication.rb +50 -0
  23. data/lib/reek/smells/feature_envy.rb +58 -0
  24. data/lib/reek/smells/large_class.rb +50 -0
  25. data/lib/reek/smells/long_method.rb +43 -0
  26. data/lib/reek/smells/long_parameter_list.rb +43 -0
  27. data/lib/reek/smells/long_yield_list.rb +18 -0
  28. data/lib/reek/smells/nested_iterators.rb +28 -0
  29. data/lib/reek/smells/smell_detector.rb +66 -0
  30. data/lib/reek/smells/smells.rb +85 -0
  31. data/lib/reek/smells/uncommunicative_name.rb +80 -0
  32. data/lib/reek/smells/utility_function.rb +34 -0
  33. data/lib/reek/source.rb +116 -0
  34. data/lib/reek/spec.rb +130 -0
  35. data/lib/reek/stop_context.rb +62 -0
  36. data/lib/reek/yield_call_context.rb +14 -0
  37. data/lib/reek.rb +8 -0
  38. data/spec/integration/reek_source_spec.rb +20 -0
  39. data/spec/integration/script_spec.rb +55 -0
  40. data/spec/reek/class_context_spec.rb +198 -0
  41. data/spec/reek/code_context_spec.rb +92 -0
  42. data/spec/reek/code_parser_spec.rb +44 -0
  43. data/spec/reek/config_spec.rb +42 -0
  44. data/spec/reek/module_context_spec.rb +38 -0
  45. data/spec/reek/object_refs_spec.rb +129 -0
  46. data/spec/reek/options_spec.rb +13 -0
  47. data/spec/reek/report_spec.rb +48 -0
  48. data/spec/reek/sexp_formatter_spec.rb +31 -0
  49. data/spec/reek/singleton_method_context_spec.rb +17 -0
  50. data/spec/reek/smells/control_couple_spec.rb +23 -0
  51. data/spec/reek/smells/duplication_spec.rb +81 -0
  52. data/spec/reek/smells/feature_envy_spec.rb +129 -0
  53. data/spec/reek/smells/large_class_spec.rb +86 -0
  54. data/spec/reek/smells/long_method_spec.rb +59 -0
  55. data/spec/reek/smells/long_parameter_list_spec.rb +92 -0
  56. data/spec/reek/smells/nested_iterators_spec.rb +33 -0
  57. data/spec/reek/smells/smell_spec.rb +24 -0
  58. data/spec/reek/smells/uncommunicative_name_spec.rb +118 -0
  59. data/spec/reek/smells/utility_function_spec.rb +96 -0
  60. data/spec/samples/inline.rb +704 -0
  61. data/spec/samples/inline_spec.rb +40 -0
  62. data/spec/samples/optparse.rb +1788 -0
  63. data/spec/samples/optparse_spec.rb +100 -0
  64. data/spec/samples/redcloth.rb +1130 -0
  65. data/spec/samples/redcloth_spec.rb +93 -0
  66. data/spec/spec.opts +1 -0
  67. data/spec/spec_helper.rb +15 -0
  68. data/tasks/reek.rake +20 -0
  69. data/tasks/rspec.rake +22 -0
  70. metadata +167 -0
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe 'sample gem source code' do
4
+ it "reports the correct smells in inline.rb" do
5
+ ruby = File.new('spec/samples/inline.rb').to_source
6
+ ruby.should reek_of(:ControlCouple, /Inline::C#parse_signature/, /raw/)
7
+ ruby.should reek_of(:ControlCouple, /Module#inline/, /options/)
8
+ ruby.should reek_of(:Duplication, /Inline::C#build/, /\$\?\.==\(0\)/)
9
+ ruby.should reek_of(:Duplication, /Inline::C#build/, /Inline.directory/)
10
+ ruby.should reek_of(:Duplication, /Inline::C#build/, /io.puts/)
11
+ ruby.should reek_of(:Duplication, /Inline::C#build/, /io.puts\(#endif\)/)
12
+ ruby.should reek_of(:Duplication, /Inline::C#build/, /io.puts\(#ifdef __cplusplus\)/)
13
+ ruby.should reek_of(:Duplication, /Inline::C#crap_for_windoze/, /Config::CONFIG\[libdir\]/)
14
+ ruby.should reek_of(:Duplication, /Inline::C#generate/, /result.sub!\(\(\?-mix:\\A\\n\), \)/)
15
+ ruby.should reek_of(:Duplication, /Inline::C#generate/, /signature\[args\]/)
16
+ ruby.should reek_of(:Duplication, /Inline::C#generate/, /signature\[args\].map/)
17
+ ruby.should reek_of(:Duplication, /Inline::C#initialize/, /stack.empty?/)
18
+ ruby.should reek_of(:Duplication, /Inline::self.rootdir/, /env.nil?/)
19
+ ruby.should reek_of(:Duplication, /Module#inline/, /Inline.const_get\(lang\)/)
20
+ ruby.should reek_of(:FeatureEnvy, /Inline::C#strip_comments/, /src/)
21
+ ruby.should reek_of(:LargeClass, /Inline::C/)
22
+ ruby.should reek_of(:LongMethod, /File#self.write_with_backup/)
23
+ ruby.should reek_of(:LongMethod, /Inline::C#build/)
24
+ ruby.should reek_of(:LongMethod, /Inline::C#generate/)
25
+ ruby.should reek_of(:LongMethod, /Inline::C#load_cache/)
26
+ ruby.should reek_of(:LongMethod, /Inline::C#module_name/)
27
+ ruby.should reek_of(:LongMethod, /Inline::C#parse_signature/)
28
+ ruby.should reek_of(:LongMethod, /Inline::self.rootdir/)
29
+ ruby.should reek_of(:LongMethod, /Module#inline/)
30
+ ruby.should reek_of(:NestedIterators, /Inline::C#build/)
31
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#build/, /'t'/)
32
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#build/, /'n'/)
33
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#c/, /'c'/)
34
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#module_name/, /'m'/)
35
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#module_name/, /'x'/)
36
+ ruby.should reek_of(:UncommunicativeName, /Inline::C#parse_signature/, /'x'/)
37
+ ruby.should reek_of(:UtilityFunction, /Inline::C#strip_comments/)
38
+ ruby.report.length.should == 32
39
+ end
40
+ end