Skip to content
This repository
Browse code

might help if i added the new file, updated readme too

  • Loading branch information...
commit 38f341d794448b1e028d367d81d8d4cb8435492e 1 parent 9c0fa3b
Brian Glusman authored

Showing 2 changed files with 17 additions and 0 deletions. Show diff stats Hide diff stats

  1. +9 0 README.md
  2. +8 0 lib/outlaw/rule_methods.rb
9 README.md
Source Rendered
@@ -36,6 +36,9 @@ Some examples are include in the .outlawed.example file for reference:
36 36 outlaw "class :symbol < :core_class", "core classes implemented in c,
37 37 can cause bad mojo"
38 38
  39 + outlaw :trailing_whitespace
  40 +
  41 +
39 42 The first three examples are actual ruby keywords and features being outlawed
40 43 and may not require much explanation except to indicate that they are detected
41 44 via regular expression matches constructed from the strings, and attempt to use
@@ -56,6 +59,12 @@ patterns as above. Presently mutliple references to the same collection
56 59 are independent, but if there is interest special handling could be added to
57 60 also match specific instances of a collection much like the symbol handling.
58 61
  62 +The last one is a custom rule that calls a method defined on the Outlaw
  63 +module called 'trailing_whitespace' which returns a Rule object. Any
  64 +such new methods may be defined in the .outlawed file (since it is
  65 +module_eval'd into the outlaw namespace) and then outawed the same way.
  66 +
  67 +
59 68 Outlaw currently ignores whitespace, parentheses and new lines, though I have
60 69 ideas to change this behavior dynamically in certain rules if desired.
61 70
8 lib/outlaw/rule_methods.rb
... ... @@ -0,0 +1,8 @@
  1 +module Outlaw
  2 + def trailing_whitespace
  3 + Rule.new("Trailing whitespace",
  4 + "Trailing whitespace is ugly and can mess up version history") do |file|
  5 + file.match(/ \n/)
  6 + end
  7 + end
  8 +end

0 comments on commit 38f341d

Please sign in to comment.
Something went wrong with that request. Please try again.