Sha256: 8ad9c12aafa416ad3992a564f5dacbcedd6a4670f94c186006e48acd00869ad9

Contents?: true

Size: 1.15 KB

Versions: 2

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 = -> 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

2 entries across 2 versions & 1 rubygems

Version Path
hexx-suit-0.1.0 lib/tasks/check/rubocop.rake
hexx-suit-0.0.1 lib/tasks/check/rubocop.rake