Sha256: 7332079a06d63faa30ca40796c4d98b96bc55a1be3ad54518749fc4d9b9ea978

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require "rubocop/stylecheck"
require "fileutils"

namespace :style do
  namespace :rubocop do
    desc "Run RuboCop with auto_correct"
    task :with_auto_correct do
      Rubocop::Stylecheck::Cli.run(
        Rubocop::Stylecheck::Cli.options_with_auto_correct
      )
    end

    desc "Run RuboCop without auto_correct"
    task :without_auto_correct do
      Rubocop::Stylecheck::Cli.run(
        Rubocop::Stylecheck::Cli.options_with_cop
      )
    end

    desc "Generate local RuboCop config"
    task :generate_local_config do
      template_config_path = Rubocop::Stylecheck.config_path
      project_config_path = Rubocop::Stylecheck.project_config_path

      if template_config_path && File.exist?(template_config_path)
        FileUtils.cp(template_config_path, project_config_path)
      else
        abort "Config file doesn't exist, please use" \
              "Robocop::Stylecheck.config_path = ..."
      end
    end
  end
end

desc "Check codestyle and fix common errors"
task :style do
  Rake::Task["style:rubocop:with_auto_correct"].invoke
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-stylecheck-0.1.3 lib/rubocop/stylecheck/tasks/rubocop.rake
rubocop-stylecheck-0.1.2 lib/rubocop/stylecheck/tasks/rubocop.rake