Class: SyntaxTree::Rake::CheckTask

Inherits:
Rake::TaskLib
  • Object
show all
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

Instance Method Summary collapse

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.

Yields:

  • (_self)

Yield Parameters:



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

#nameObject

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

#pluginsObject

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

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_filesObject

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_versionObject

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