Sha256: af276d208bbdb14968859d60cfe2d9abc7bf10f0d268d3732c6344f7d3be7f2b

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

require 'pre-commit/checks/plugin'

module PreCommit
  module Checks
    ##
    # The CI check will run `rake pre_commmit:ci` before the commit and check
    # its exit code. If the task runs successfully, the commit will proceed.
    # If it fails, the commit will be aborted.
    #
    class Ci < Plugin
      CI_TASK_NAME = 'pre_commit:ci'

      def self.description
        "Runs 'rake #{CI_TASK_NAME} --silent'"
      end

      def call(_)
        return if system("rake", CI_TASK_NAME, "--silent")

        PreCommit::ErrorList.new(
          "your test suite has failed, for the full output run `#{CI_TASK_NAME}`"
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pre-commit-0.40.0 lib/plugins/pre_commit/checks/ci.rb
pre-commit-0.39.0 lib/plugins/pre_commit/checks/ci.rb
pre-commit-0.38.1 lib/plugins/pre_commit/checks/ci.rb
pre-commit-0.38.0 lib/plugins/pre_commit/checks/ci.rb