Sha256: 46e70605d8208bb5f07097afa2bac585d317bb63fd059e0bbc133d99b9c049c5

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

namespace :check do
  namespace :rubocop do

    metric  = Hexx::Suit::Metrics::Rubocop
    caller  = Hexx::Suit::Utils::System
    format  = -> { ENV.fetch("RUBOCOP_FORMAT") { "html" } }
    output  = -> { ENV.fetch("RUBOCOP_OUTPUT") { "tmp/rubocop/index.html" } }
    options = lambda do
      "-f #{ format.call } -o #{ output.call } -c config/metrics/rubocop.yml"
    end

    # Loads settings for rubocop metric from the '.hexx-suit.yml'
    task :configure do
      metric.load
    end

    desc "Runs rubocop metric"
    task run: :configure do
      puts "******* STARTING METRIC rubocop"
      caller.call "rubocop #{ options.call }"
      puts "see results in #{ output.call }"
      puts "******* ENDING METRIC rubocop"
    end

    desc "Displays the results of rubocop last run"
    task display: :configure do
      if format.call == "html"
        caller.call "launchy #{ output.call }"
      else
        puts "******* DISPLAYING METRIC rubocop"
        caller.call "cat #{ output.call }"
        puts "******* ENDING METRIC rubocop"
      end
    end
  end

  desc "Runs rubocop metric and displays the results"
  task rubocop: %w(rubocop:run rubocop:display)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hexx-suit-0.2.2 lib/tasks/check/rubocop.rake
hexx-suit-0.2.1 lib/tasks/check/rubocop.rake
hexx-suit-0.2.0 lib/tasks/check/rubocop.rake