Permalink
Browse files

Provide ability to disable style and documentation checks from within…

… the RakeTask
  • Loading branch information...
1 parent ba10a2a commit 6f26ef42031441f5188e9a6a73cf5814ee2930bf Derek Lindahl committed Mar 29, 2012
Showing with 8 additions and 0 deletions.
  1. +1 −0 README.md
  2. +7 −0 lib/cane/rake_task.rb
View
1 README.md
@@ -72,6 +72,7 @@ It works just like this:
Cane::RakeTask.new(:quality) do |cane|
cane.abc_max = 10
cane.add_threshold 'coverage/covered_percent', :>=, 99
+ cane.no_style = true
end
task :default => :quality
View
7 lib/cane/rake_task.rb
@@ -10,6 +10,7 @@ module Cane
# Cane::RakeTask.new(:quality) do |cane|
# cane.abc_max = 10
# cane.doc_glob = 'lib/**/*.rb'
+ # cane.no_style = true
# cane.add_threshold 'coverage/covered_percent', :>=, 99
# end
class RakeTask < ::Rake::TaskLib
@@ -21,10 +22,14 @@ class RakeTask < ::Rake::TaskLib
attr_accessor :abc_max
# Glob to run style checks over (default: "{lib,spec}/**/*.rb")
attr_accessor :style_glob
+ # TRUE to disable style checks
+ attr_accessor :no_style
# Max line length (default: 80)
attr_accessor :style_measure
# Glob to run doc checks over (default: "lib/**/*.rb")
attr_accessor :doc_glob
+ # TRUE to disable doc checks
+ attr_accessor :no_doc
# Max violations to tolerate (default: 0)
attr_accessor :max_violations
@@ -54,8 +59,10 @@ def options
:abc_glob,
:abc_max,
:doc_glob,
+ :no_doc,
:max_violations,
:style_glob,
+ :no_style,
:style_measure
].inject(threshold: @threshold) do |opts, setting|
value = self.send(setting)

0 comments on commit 6f26ef4

Please sign in to comment.