class Vtasks::Lint
Lint
tasks
Attributes
file_list[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/vtasks/lint.rb, line 8 def initialize(options = {}) @file_list ||= options.fetch(:file_list, FileList['{lib,spec}/**/*.rb']) define_tasks end
Public Instance Methods
define_tasks()
click to toggle source
Define tasks
# File lib/vtasks/lint.rb, line 14 def define_tasks desc 'Check for code smells with Reek and Rubocop' task lint: ['lint:reek', 'lint:rubocop'] namespace :lint do rubocop reek rubycritic end end
reek()
click to toggle source
Reek
# File lib/vtasks/lint.rb, line 40 def reek begin require 'reek/rake/task' rescue LoadError nil # Might be in a group that is not installed end ::Reek::Rake::Task.new do |task| task.source_files = file_list task.fail_on_error = false task.reek_opts = '--wiki-links --color' end end
rubocop()
click to toggle source
RuboCop
# File lib/vtasks/lint.rb, line 26 def rubocop begin require 'rubocop/rake_task' rescue LoadError nil # Might be in a group that is not installed end desc 'Run RuboCop on the tasks and lib directory' ::RuboCop::RakeTask.new(:rubocop) do |task| task.patterns = file_list task.options = ['--display-cop-names', '--extra-details'] end end
rubycritic()
click to toggle source
Ruby Critic
# File lib/vtasks/lint.rb, line 54 def rubycritic begin require 'rubycritic/rake_task' rescue LoadError nil # Might be in a group that is not installed end ::RubyCritic::RakeTask.new do |task| task.paths = file_list end end