kevinrutherford-reek 0.3.1.4
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.
- data/History.txt +92 -0
 - data/README.txt +6 -0
 - data/Rakefile +7 -0
 - data/bin/reek +19 -0
 - data/lib/reek/block_context.rb +37 -0
 - data/lib/reek/class_context.rb +73 -0
 - data/lib/reek/code_context.rb +47 -0
 - data/lib/reek/code_parser.rb +204 -0
 - data/lib/reek/exceptions.reek +13 -0
 - data/lib/reek/if_context.rb +25 -0
 - data/lib/reek/method_context.rb +85 -0
 - data/lib/reek/module_context.rb +34 -0
 - data/lib/reek/name.rb +42 -0
 - data/lib/reek/object_refs.rb +53 -0
 - data/lib/reek/options.rb +92 -0
 - data/lib/reek/rake_task.rb +121 -0
 - data/lib/reek/report.rb +42 -0
 - data/lib/reek/sexp_formatter.rb +52 -0
 - data/lib/reek/singleton_method_context.rb +27 -0
 - data/lib/reek/smell_warning.rb +49 -0
 - data/lib/reek/smells/control_couple.rb +61 -0
 - data/lib/reek/smells/duplication.rb +50 -0
 - data/lib/reek/smells/feature_envy.rb +58 -0
 - data/lib/reek/smells/large_class.rb +50 -0
 - data/lib/reek/smells/long_method.rb +43 -0
 - data/lib/reek/smells/long_parameter_list.rb +43 -0
 - data/lib/reek/smells/long_yield_list.rb +18 -0
 - data/lib/reek/smells/nested_iterators.rb +28 -0
 - data/lib/reek/smells/smell_detector.rb +66 -0
 - data/lib/reek/smells/smells.rb +85 -0
 - data/lib/reek/smells/uncommunicative_name.rb +80 -0
 - data/lib/reek/smells/utility_function.rb +34 -0
 - data/lib/reek/source.rb +116 -0
 - data/lib/reek/spec.rb +130 -0
 - data/lib/reek/stop_context.rb +62 -0
 - data/lib/reek/yield_call_context.rb +14 -0
 - data/lib/reek.rb +8 -0
 - data/spec/integration/reek_source_spec.rb +20 -0
 - data/spec/integration/script_spec.rb +55 -0
 - data/spec/reek/class_context_spec.rb +198 -0
 - data/spec/reek/code_context_spec.rb +92 -0
 - data/spec/reek/code_parser_spec.rb +44 -0
 - data/spec/reek/config_spec.rb +42 -0
 - data/spec/reek/module_context_spec.rb +38 -0
 - data/spec/reek/object_refs_spec.rb +129 -0
 - data/spec/reek/options_spec.rb +13 -0
 - data/spec/reek/report_spec.rb +48 -0
 - data/spec/reek/sexp_formatter_spec.rb +31 -0
 - data/spec/reek/singleton_method_context_spec.rb +17 -0
 - data/spec/reek/smells/control_couple_spec.rb +23 -0
 - data/spec/reek/smells/duplication_spec.rb +81 -0
 - data/spec/reek/smells/feature_envy_spec.rb +129 -0
 - data/spec/reek/smells/large_class_spec.rb +86 -0
 - data/spec/reek/smells/long_method_spec.rb +59 -0
 - data/spec/reek/smells/long_parameter_list_spec.rb +92 -0
 - data/spec/reek/smells/nested_iterators_spec.rb +33 -0
 - data/spec/reek/smells/smell_spec.rb +24 -0
 - data/spec/reek/smells/uncommunicative_name_spec.rb +118 -0
 - data/spec/reek/smells/utility_function_spec.rb +96 -0
 - data/spec/samples/inline.rb +704 -0
 - data/spec/samples/inline_spec.rb +40 -0
 - data/spec/samples/optparse.rb +1788 -0
 - data/spec/samples/optparse_spec.rb +100 -0
 - data/spec/samples/redcloth.rb +1130 -0
 - data/spec/samples/redcloth_spec.rb +93 -0
 - data/spec/spec.opts +1 -0
 - data/spec/spec_helper.rb +15 -0
 - data/tasks/reek.rake +20 -0
 - data/tasks/rspec.rake +22 -0
 - 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
         
     |