Sha256: ea7939d695e6f4ada21d94e6d0587bfa2ecd2085fc6c7c9b884de99a4a7d4553
Contents?: true
Size: 650 Bytes
Versions: 19
Compression:
Stored size: 650 Bytes
Contents
# frozen_string_literal: true module Overcommit::Hook::PreCommit # Runs 'sqlint' against any modified SQL files. # # @see https://github.com/purcell/sqlint class Sqlint < Base MESSAGE_REGEX = /(?<file>(?:\w:)?.+):(?<line>\d+):\d+:(?<type>\w+)/ MESSAGE_TYPE_CATEGORIZER = lambda do |type| type == 'ERROR' ? :error : :warning end def run result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? extract_messages( output.split("\n"), MESSAGE_REGEX, MESSAGE_TYPE_CATEGORIZER ) end end end
Version data entries
19 entries across 19 versions & 2 rubygems