Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit 645bb0847b2b9569b304e3c84df99dff7f17d695 @ericallam ericallam committed May 26, 2011
@@ -0,0 +1,5 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
+.rvmrc
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in ruby_cop.gemspec
+gemspec
0 README
No changes.
@@ -0,0 +1,2 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
@@ -0,0 +1,12 @@
+module RubyCop
+ # Your code goes here...
+end
+
+require 'ripper'
+
+require 'ruby_cop/ruby'
+require 'ruby_cop/node_builder'
+require 'ruby_cop/gray_list'
+require 'ruby_cop/policy'
+
+
@@ -0,0 +1,26 @@
+require 'set'
+
+module RubyCop
+ # Combination blacklist and whitelist.
+ class GrayList
+ def initialize
+ @blacklist = Set.new
+ @whitelist = Set.new
+ end
+
+ # An item is allowed if it's whitelisted, or if it's not blacklisted.
+ def allow?(item)
+ @whitelist.include?(item) || !@blacklist.include?(item)
+ end
+
+ def blacklist(item)
+ @whitelist.delete(item)
+ @blacklist.add(item)
+ end
+
+ def whitelist(item)
+ @blacklist.delete(item)
+ @whitelist.add(item)
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 645bb08

Please sign in to comment.