<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>README</filename>
    </added>
    <added>
      <filename>lib/flogger/.LCKassertions.rb~</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 module Flogger
   module InstanceMethods
+    ERROR_MESSAGE_PREFIX = 'Error when flogging your files:'
+    ERROR_MESSAGE = &quot;%s has a flog score of %.2f (exceeding treshold of %.2f by %.2f)&quot;
+    
     # 
     # assert the flog score of file(s) is below a treshold (default treshold is 20).
     # 
@@ -27,7 +30,7 @@ module Flogger
       options = {:treshold =&gt; 20}.merge(options)
       flogger = Flog.new()
       flogger.flog_files(files)
-      failures = reject_success(flogger.totals, options)
+      failures = reject_success_and_sort(flogger.totals, options)
       assert_block(build_flog_message(failures, options)) do
         failures.size == 0
       end
@@ -50,10 +53,10 @@ module Flogger
     # Builds a 'nice' error message listing all failed methods
     #
     def build_flog_message(failures, options)
-      message = ['Error when flogging your files:']
-      failures.each do |key, value|
-        limit = treshold_for_key(key, options)
-        message &lt;&lt; &quot;#{key.ljust(40, ' ')} has a flog score of #{value} (exceeding treshold of #{limit} by #{value - limit})&quot;
+      message = [ERROR_MESSAGE_PREFIX]
+      failures.each do |item|
+        limit = treshold_for_key(item.first, options)
+        message &lt;&lt;  ERROR_MESSAGE % [item.first.ljust(40, ' '), item.last, limit, (item.last - limit)]
       end
       message.join(&quot;\n&quot;)
     end
@@ -61,10 +64,10 @@ module Flogger
     #
     # Remove all values which are not exceeding the threshold
     #
-    def reject_success(totals, options)
+    def reject_success_and_sort(totals, options)
       totals.reject do |key, value| 
         value &lt; treshold_for_key(key, options)
-      end
+      end.to_a.sort() {|a, b| b.last &lt;=&gt; a.last}
     end
     
     </diff>
      <filename>lib/flogger/assertions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,10 @@ class TestAssertions &lt; Test::Unit::TestCase
     assert_flog(__FILE__, :treshold =&gt; 10, :tresholds =&gt; {'TestAssertions#test_extract_files_and_options' =&gt; 23})
   end
   
+  def test_flunk
+    assert_flog(__FILE__, :treshold =&gt; 1)
+  end
+  
   # flog score of &gt; 22
   def test_extract_files_and_options
     files, options = public_extract_files_and_options('some')</diff>
      <filename>test/test_assertions.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>458b61b454d2f93e73b9fb000874f1db544757e5</id>
    </parent>
  </parents>
  <author>
    <name>pascalbetz</name>
    <email>pascal.betz@simplificator.com</email>
  </author>
  <url>http://github.com/simplificator/flogger/commit/fe8640fbf9d2d9edbb4157f0d450eaf7df326a6f</url>
  <id>fe8640fbf9d2d9edbb4157f0d450eaf7df326a6f</id>
  <committed-date>2008-09-11T02:41:38-07:00</committed-date>
  <authored-date>2008-09-11T02:41:38-07:00</authored-date>
  <message>added sorting of error messages</message>
  <tree>bc2fe186fb4f80971f4c601902a364d42075feab</tree>
  <committer>
    <name>pascalbetz</name>
    <email>pascal.betz@simplificator.com</email>
  </committer>
</commit>
