Class: SyntaxTree::Rake::CheckTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- SyntaxTree::Rake::CheckTask
- Defined in:
- lib/syntax_tree/rake/check_task.rb
Overview
A Rake task that runs check on a set of source files.
Example:
require 'syntax_tree/rake/check_task'
SyntaxTree::Rake::CheckTask.new do |t|
t.source_files = '{app,config,lib}/**/*.rb'
end
This will create task that can be run with:
rake stree_check
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of the task.
-
#plugins ⇒ Object
The set of plugins to require.
-
#print_width ⇒ Object
Max line length.
-
#source_files ⇒ Object
Glob pattern to match source files.
-
#target_ruby_version ⇒ Object
The target Ruby version to use for formatting.
Instance Method Summary collapse
-
#initialize(name = :"stree:check", source_files = ::Rake::FileList["lib/**/*.rb"], plugins = [], print_width = DEFAULT_PRINT_WIDTH, target_ruby_version = Gem::Version.new(RUBY_VERSION)) {|_self| ... } ⇒ CheckTask
constructor
A new instance of CheckTask.
Constructor Details
#initialize(name = :"stree:check", source_files = ::Rake::FileList["lib/**/*.rb"], plugins = [], print_width = DEFAULT_PRINT_WIDTH, target_ruby_version = Gem::Version.new(RUBY_VERSION)) {|_self| ... } ⇒ CheckTask
Returns a new instance of CheckTask.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/syntax_tree/rake/check_task.rb', line 46 def initialize( name = :"stree:check", source_files = ::Rake::FileList["lib/**/*.rb"], plugins = [], print_width = DEFAULT_PRINT_WIDTH, target_ruby_version = Gem::Version.new(RUBY_VERSION) ) @name = name @source_files = source_files @plugins = plugins @print_width = print_width @target_ruby_version = target_ruby_version yield self if block_given? define_task end |
Instance Attribute Details
#name ⇒ Object
Name of the task. Defaults to :“stree:check”.
28 29 30 |
# File 'lib/syntax_tree/rake/check_task.rb', line 28 def name @name end |
#plugins ⇒ Object
The set of plugins to require. Defaults to [].
36 37 38 |
# File 'lib/syntax_tree/rake/check_task.rb', line 36 def plugins @plugins end |
#print_width ⇒ Object
Max line length. Defaults to 80.
40 41 42 |
# File 'lib/syntax_tree/rake/check_task.rb', line 40 def print_width @print_width end |
#source_files ⇒ Object
Glob pattern to match source files. Defaults to ‘lib/*/.rb’.
32 33 34 |
# File 'lib/syntax_tree/rake/check_task.rb', line 32 def source_files @source_files end |
#target_ruby_version ⇒ Object
The target Ruby version to use for formatting. Defaults to Gem::Version.new(RUBY_VERSION).
44 45 46 |
# File 'lib/syntax_tree/rake/check_task.rb', line 44 def target_ruby_version @target_ruby_version end |