Class: GemOf::LintTasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/gem_of/rake_tasks.rb

Overview

various lint-oriented tasks

Instance Method Summary collapse

Constructor Details

#initializeLintTasks

instance lint takss in namespace :lint

Examples:

LintTasks.new




149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/gem_of/rake_tasks.rb', line 149

def initialize
  namespace :lint do
    desc "check number of lines of code changed. No long PRs"
    task "diff_length" do
      diff_length? exit diff_length: exit
    end

    # this will produce 'test:rubocop','test:rubocop:auto_correct' tasks
    RuboCop::RakeTask.new do |task|
      task.options = ["--debug"]
    end

    # this will produce the 'test:flog' task
    allowed_complexity = 585 # <cough!>
    FlogTask.new :flog, allowed_complexity, %w[lib]
    # this will produce the 'test:flay' task
    allowed_repitition = 0
    FlayTask.new :flay, allowed_repitition, %w[lib]
    # this will produce the 'test:roodi' task
    RoodiTask.new
    # this will produce the 'test:rubycritic' task
    RubyCritic::RakeTask.new do |task|
      task.paths   = FileList["lib/**/*.rb"]
    end
  end
end