<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,7 @@
 * Place *.reek files in source folder to configure smell detection behaviour
 * Added -f option to configure report format
 * --sort_order replaced by -f, -c and -s
+* Matchers provided for rspec; eg. foo.should_not reek
 
 === Minor enhancements:
 </diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -4,5 +4,5 @@ require 'reek/report'
 require 'reek/smells/smells'
 
 module Reek # :doc:
-  VERSION = '0.3.1.2'
+  VERSION = '0.3.1.3'
 end</diff>
      <filename>lib/reek.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,8 +24,12 @@ module Reek
 
     alias eql? &lt;=&gt;  # :nodoc:
 
-    def matches?(name_sym, patterns)
-      return false unless name_sym.to_s == @smell.class.class_name
+    #
+    # Returns +true+ only if this is a warning about an instance of
+    # +smell_class+ and its report string matches all of the +patterns+.
+    #
+    def matches?(smell_class, patterns)
+      return false unless smell_class.to_s == @smell.class.class_name
       rpt = report
       return patterns.all? {|exp| exp === rpt}
     end</diff>
      <filename>lib/reek/smell_warning.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,33 +1,61 @@
 require 'reek/code_parser'
 
 module Reek
+
+  #
+  # A +Source+ object represents a chunk of Ruby source code.
+  #
+  # The various class methods are factories that will create +Source+
+  # instances from various types of input.
+  #
   class Source
+
+    #
+    # Factory method: creates a +Source+ object by reading Ruby code from
+    # the +IO+ stream. The stream is consumed upto end-of-file, but the
+    # source code is not parsed until +report+ is called. +desc+ provides
+    # a string description to be used in the header of formatted reports.
+    #
     def self.from_io(ios, desc)
       code = ios.readlines.join
       return new(code, desc)
     end
 
+    #
+    # Factory method: creates a +Source+ object by reading Ruby code from
+    # the +code+ string. The code is not parsed until +report+ is called.
+    #
     def self.from_s(code)
       return new(code, 'string')
     end
 
+    #
+    # Factory method: creates a +Source+ object by reading Ruby code from
+    # File +file+. The source code is not parsed until +report+ is called.
+    #
     def self.from_f(file)
       from_path(file.path)
     end
 
+    #
+    # Factory method: creates a +Source+ object by reading Ruby code from
+    # the named file. The source code is not parsed until +report+ is called.
+    #
     def self.from_path(filename)
       code = IO.readlines(filename).join
       return new(code, filename, File.dirname(filename))
     end
 
-    def initialize(code, desc, dir = '.')
+    def initialize(code, desc, dir = '.')     # :nodoc:
       @source = code
       @dir = dir
       @desc = desc
     end
 
     #
-    # Returns a +Report+ listing the smells found in this source.
+    # Returns a +Report+ listing the smells found in this source. The first
+    # call to +report+ parses the source code and constructs a list of
+    # +SmellWarning+s found; subsequent calls simply return this same list.
     #
     def report
       unless @report
@@ -42,8 +70,12 @@ module Reek
       report.length &gt; 0
     end
 
-    def has_smell?(smell_sym, patterns)
-      report.any? { |smell| smell.matches?(smell_sym, patterns) }
+    #
+    # Checks this source for instances of +smell_class+, and returns +true+
+    # only if one of them has a report string matching all of the +patterns+.
+    #
+    def has_smell?(smell_class, patterns)
+      report.any? { |smell| smell.matches?(smell_class, patterns) }
     end
 
     def to_s</diff>
      <filename>lib/reek/source.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,34 @@
 module Reek
+
+  #
+  # Provides matchers for Rspec, making it easy to check code quality.
+  #
+  # === Examples
+  #
+  # Here's a spec that ensures there are no smell warnings in the current project:
+  #
+  #  describe 'source code quality' do
+  #    Dir['lib/**/*.rb'].each do |path|
+  #      it &quot;reports no smells in #{path}&quot; do
+  #        File.new(path).should_not reek
+  #      end
+  #    end
+  #  end
+  #
+  # Here's a simple check of a code fragment:
+  #
+  #  'def equals(other) other.thing == self.thing end'.should_not reek
+  #
+  # And a more complex example, making use of one of the factory methods for
+  # +Source+ so that the code is parsed and analysed only once:
+  # 
+  #   ruby = 'def double_thing() @other.thing.foo + @other.thing.foo end'.to_source
+  #   ruby.should reek_of(:Duplication, /@other.thing[^\.]/)
+  #   ruby.should reek_of(:Duplication, /@other.thing.foo/)
+  #   ruby.should_not reek_of(:FeatureEnvy)
+  #
   module Spec
-    class ShouldReek
+    class ShouldReek        # :nodoc:
       def matches?(actual)
         @source = actual.to_source
         @source.smelly?
@@ -9,15 +37,18 @@ module Reek
         &quot;Expected source to reek, but it didn't&quot;
       end
       def failure_message_for_should_not
-        &quot;Expected no smells, but got the following:\n#{@source.report}&quot;
+        &quot;Expected no smells, but got:\n#{@source.report}&quot;
       end
     end
 
+    #
+    # Returns +true+ if and only if the target source code contains smells.
+    #
     def reek
       ShouldReek.new
     end
 
-    class ShouldReekOf
+    class ShouldReekOf        # :nodoc:
       def initialize(klass, patterns)
         @klass = klass
         @patterns = patterns
@@ -34,11 +65,16 @@ module Reek
       end
     end
 
-    def reek_of(klass, *patterns)
-      ShouldReekOf.new(klass, patterns)
+    #
+    # Checks the target source code for instances of +smell_class+,
+    # and returns +true+ only if one of them has a report string matching
+    # all of the +patterns+.
+    #
+    def reek_of(smell_class, *patterns)
+      ShouldReekOf.new(smell_class, patterns)
     end
 
-    class ShouldReekOnlyOf
+    class ShouldReekOnlyOf        # :nodoc:
       def initialize(klass, patterns)
         @klass = klass
         @patterns = patterns
@@ -55,8 +91,12 @@ module Reek
       end
     end
 
-    def reek_only_of(klass, *patterns)
-      ShouldReekOnlyOf.new(klass, patterns)
+    #
+    # As for reek_of, but the matched smell warning must be the only warning of
+    # any kind in the target source code's Reek report.
+    #
+    def reek_only_of(smell_class, *patterns)
+      ShouldReekOnlyOf.new(smell_class, patterns)
     end
   end
 end</diff>
      <filename>lib/reek/spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,13 @@
 require File.dirname(__FILE__) + '/../spec_helper.rb'
 
 describe 'Reek source code:' do
-  Dir['lib/**/*.rb'].each do |source|
-    describe source do
-      it 'should report no smells' do
-        File.new(source).should_not reek
-      end
-      it 'should report no smells via bin/reek' do
-        `ruby -Ilib bin/reek #{source}`.should == ''
-        $?.exitstatus.should == 0
-      end
+  Dir['lib/**/*.rb'].each do |path|
+    it &quot;reports no smells in #{path}&quot; do
+      File.new(path).should_not reek
+    end
+    it &quot;reports no smells in #{path} via bin/reek&quot; do
+      `ruby -Ilib bin/reek #{path}`.should == ''
+      $?.exitstatus.should == 0
     end
   end
 end</diff>
      <filename>spec/integration/reek_source_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@ describe Duplication, &quot;repeated method calls&quot; do
   end
 
   it 'should report nested calls' do
-    ruby = Source.from_s('def double_thing() @other.thing.foo + @other.thing.foo end')
+    ruby = 'def double_thing() @other.thing.foo + @other.thing.foo end'.to_source
     ruby.should reek_of(:Duplication, /@other.thing[^\.]/)
     ruby.should reek_of(:Duplication, /@other.thing.foo/)
   end</diff>
      <filename>spec/reek/smells/duplication_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f4e1fc645ff3a826a4bc38bfd1a5bcf2d82a454c</id>
    </parent>
  </parents>
  <author>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </author>
  <url>http://github.com/kevinrutherford/reek/commit/95c8814f9618f49af7510ee35edb48fda619ddf1</url>
  <id>95c8814f9618f49af7510ee35edb48fda619ddf1</id>
  <committed-date>2009-03-29T03:09:01-07:00</committed-date>
  <authored-date>2009-03-29T03:09:01-07:00</authored-date>
  <message>Added rdoc for the spec matchers</message>
  <tree>a32854171f46a4d63a28989f5da21409ea70d916</tree>
  <committer>
    <name>Kevin Rutherford</name>
    <email>kevin@rutherford-software.com</email>
  </committer>
</commit>
