Class: FoodCritic::Rake::LintTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- FoodCritic::Rake::LintTask
- Defined in:
- lib/foodcritic/rake_task.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :foodcritic) {|_self| ... } ⇒ LintTask
constructor
A new instance of LintTask.
Constructor Details
#initialize(name = :foodcritic) {|_self| ... } ⇒ LintTask
Returns a new instance of LintTask.
9 10 11 12 13 14 15 |
# File 'lib/foodcritic/rake_task.rb', line 9 def initialize(name = :foodcritic) @name = name @files = [Dir.pwd] = {} yield self if block_given? define end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/foodcritic/rake_task.rb', line 7 def files @files end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/foodcritic/rake_task.rb', line 7 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/foodcritic/rake_task.rb', line 7 def end |
Instance Method Details
#define ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/foodcritic/rake_task.rb', line 17 def define desc "Lint Chef cookbooks" unless ::Rake.application.last_description task(name) do puts "Starting Foodcritic linting..." result = FoodCritic::Linter.new.check(.merge()) printer = if [:context] ContextOutput.new($stdout) else SummaryOutput.new($stdout) end printer.output(result) if result.warnings.any? abort if result.failed? puts "Completed!" end end |