Sha256: d2bfb7eb3c601147ed392848ee88f6b81b29b770cd359227c67a941907c4eaa0

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

require "fileutils"

namespace :style do
  namespace :rubocop do
    desc "Run RuboCop with auto_correct"
    task :with_auto_correct do
      options = ["--rails", "--auto-correct", "--display-cop-names"]
      options += ["--fail-level", "refactor"]
      options += ["-c", BookingSync::Stylecheck::RubocopHelpers.config]
      sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
        abort "Fix code style errors" unless ok
      end
    end

    desc "Run RuboCop without auto_correct"
    task :without_auto_correct do
      options = ["--rails", "--display-cop-names"]
      options += ["--fail-level", "refactor"]
      options += ["-c", BookingSync::Stylecheck::RubocopHelpers.config]
      sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
        abort "Fix code style errors" unless ok
      end
    end

    desc "Run RuboCop using the BookingSync config and concatenate custom commands"
    task :custom, [:command_string, :no_fail] do |t, args|
      args[:no_fail] ||= false

      options = ["--rails", "--fail-level", "refactor", "--display-cop-names"]
      options += ["-c", BookingSync::Stylecheck::RubocopHelpers.config]
      options += [args[:command_string]]
      sh "bundle exec rubocop #{options.join(' ')}" do |ok, res|
        abort "Fix code style errors" if !args[:no_fail] && !ok
      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

6 entries across 6 versions & 1 rubygems

Version Path
bookingsync-stylecheck-0.0.13 lib/bookingsync/tasks/stylecheck.rake
bookingsync-stylecheck-0.0.12 lib/bookingsync/tasks/stylecheck.rake
bookingsync-stylecheck-0.0.11 lib/bookingsync/tasks/stylecheck.rake
bookingsync-stylecheck-0.0.10 lib/bookingsync/tasks/stylecheck.rake
bookingsync-stylecheck-0.0.9 lib/bookingsync/tasks/stylecheck.rake
bookingsync-stylecheck-0.0.8 lib/bookingsync/tasks/stylecheck.rake