Sha256: 5cfb87e2b80e4f903bc6451a7be9b0cd98f1098cdd6729a423c3f61494d8d3c6

Contents?: true

Size: 564 Bytes

Versions: 28

Compression:

Stored size: 564 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `shellcheck` against any modified shell script files.
  #
  # @see http://www.shellcheck.net/
  class ShellCheck < Base
    MESSAGE_TYPE_CATEGORIZER = lambda do |type|
      type.include?('note') ? :warning : :error
    end

    def run
      result = execute(command, args: applicable_files)
      return :pass if result.success?

      extract_messages(
        result.stdout.split("\n"),
        /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
        MESSAGE_TYPE_CATEGORIZER,
      )
    end
  end
end

Version data entries

28 entries across 26 versions & 2 rubygems

Version Path
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/shell_check.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/shell_check.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/shell_check.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.46.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.45.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.44.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.43.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.42.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.41.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.40.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.39.1 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.39.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.38.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.37.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.36.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.35.0 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.34.2 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.34.1 lib/overcommit/hook/pre_commit/shell_check.rb
overcommit-0.34.0 lib/overcommit/hook/pre_commit/shell_check.rb