Class: Vtasks::Lint
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Vtasks::Lint
- Defined in:
- lib/vtasks/lint.rb
Overview
Lint tasks
Instance Attribute Summary collapse
-
#file_list ⇒ Object
readonly
Returns the value of attribute file_list.
Instance Method Summary collapse
-
#define_tasks ⇒ Object
Define tasks.
-
#initialize(options = {}) ⇒ Lint
constructor
A new instance of Lint.
-
#reek ⇒ Object
Reek.
-
#rubocop ⇒ Object
RuboCop.
-
#rubycritic ⇒ Object
Ruby Critic.
Constructor Details
#initialize(options = {}) ⇒ Lint
Returns a new instance of Lint.
8 9 10 11 |
# File 'lib/vtasks/lint.rb', line 8 def initialize( = {}) @file_list ||= .fetch(:file_list, FileList['{lib,spec}/**/*.rb']) define_tasks end |
Instance Attribute Details
#file_list ⇒ Object (readonly)
Returns the value of attribute file_list.
6 7 8 |
# File 'lib/vtasks/lint.rb', line 6 def file_list @file_list end |
Instance Method Details
#define_tasks ⇒ Object
Define tasks
14 15 16 17 18 19 20 21 22 23 |
# 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 ⇒ Object
Reek
40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 ⇒ Object
RuboCop
26 27 28 29 30 31 32 33 34 35 36 37 |
# 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. = ['--display-cop-names', '--extra-details'] end end |
#rubycritic ⇒ Object
Ruby Critic
54 55 56 57 58 59 60 61 62 63 |
# 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 |