Permalink
Browse files

make consistent references to rules instead of laws

  • Loading branch information...
bglusman
bglusman committed Jan 28, 2012
1 parent 5dbacab commit b80828ef196d329b1be9b8cc852e18f559283a10
Showing with 17 additions and 17 deletions.
  1. +8 −8 README.md
  2. +2 −2 lib/outlaw.rb
  3. +7 −7 lib/outlaw/enforcement.rb
View
@@ -12,13 +12,13 @@ The current version of outlaw takes a user provided configuration file
directory) and parses a series of method calls to the outlaw method (defined
within the Outlaw module namespace, but module_eval'd so you don't need to
namespace the file). You can also define constants in your .outlawed file as
-collections of strings for use in your laws, but that will be addressed below.
+collections of strings for use in your rules, but that will be addressed below.
Each call to the outlaw method consists of two string arguments, the first an
anti-pattern you wish to prohibit usage of in one or more projects, and the
second an explanation to be provided when the anti-pattern is detected.
-### Syntax for law creation:
+### Syntax for rule creation:
Some examples are include in the .outlawed.example file for reference:
@@ -57,14 +57,14 @@ are independent, but if there is interest special handling could be added to
also match specific instances of a collection much like the symbol handling.
Outlaw currently ignores whitespace, parentheses and new lines, though I have
-ideas to change this behavior dynamically in certain laws if desired.
+ideas to change this behavior dynamically in certain rules if desired.
Execute outlaw on your project from the root directory by simply entering
"outlaw" into your shell, or specify another directory to run
on with "outlaw /path/to/dir"
Before using outlaw in a project you should create a .outlawed file which
-Outlaw will read laws from.
+Outlaw will read rules from.
It comes with an example file (.outlawed.example) which is included in the
gem and will be loaded if no .outlawed file is found in current directory or
@@ -73,7 +73,7 @@ location of the sample file in your system from the gem installation).
###Planned features (unimplemented):
*Customize sensitivty , for instance whitespace is currently ignored, but
-could enforce style conventions with some whitespace sensitive laws.
+could enforce style conventions with some whitespace sensitive rules.
Also ignores parens, which might be required or prohibited in some
context.
*Specify AST-nodes of interest, and within them allow arbitrary amounts of
@@ -90,10 +90,10 @@ currently possible to outlaw in a useful way:
cylon"
*Integrate Rails Best Practices gem, Reek gem, and perhaps others, so that individual issue
-detections they provide can be added as laws in the outlawed file while
+detections they provide can be added as rules in the outlawed file while
ignoring/not running other detection routines.
*Automate optional integration with rake task and/or githooks for
-enforcement/notification of laws in a project.
+enforcement/notification of rules in a project.
-*Specify classes of laws, such as log, warn and prevent for differing behavior regarding violations at runtime.
+*Specify classes of rules, such as log, warn and prevent for differing behavior regarding violations at runtime.
View
@@ -7,8 +7,8 @@
module Outlaw
def self.outlaw(restriction, message)
- law = Outlaw::LawParser.parse(restriction, message)
- Outlaw::Enforcement.add(law)
+ rule = Outlaw::LawParser.parse(restriction, message)
+ Outlaw::Enforcement.add(rule)
end
def self.enforce(dir=".")
View
@@ -1,10 +1,10 @@
module Outlaw
class Enforcement
class << self
- attr_reader :laws
- def add(law)
- @laws ||= []
- @laws << law
+ attr_reader :rules
+ def add(rule)
+ @rules ||= []
+ @rules << rule
end
def process_directory(path)
@@ -21,10 +21,10 @@ def process_directory(path)
def handle(file)
if file.match(/.rb$/)
text = File.open(file) {|f| f.read}
- laws.each do |law|
- if law.call(text)
+ rules.each do |rule|
+ if rule.call(text)
puts "Outlaw Violation in file: #{file}\nRestriction:" +
- "#{law.restriction}\n\n#{law.message}"
+ "#{rule.restriction}\n\n#{rule.message}"
end
end
end

0 comments on commit b80828e

Please sign in to comment.