Sha256: 7dd47c1d59f80c716506f1c5ffb0c438fe8d8e5dba89d93123290ffc60ee8254
Contents?: true
Size: 1019 Bytes
Versions: 28
Compression:
Stored size: 1019 Bytes
Contents
# frozen_string_literal: true module Overcommit::Hook::PreCommit # Runs `alfonsox` spell-checking tool against any modified code file. # # @see https://github.com/diegojromerolopez/alfonsox class CodeSpellCheck < Base def run # Create default file config if it does not exist # Run spell-check result = execute(command, args: applicable_files) return :pass if result.success? spellchecking_errors = result.stderr.split("\n") spellchecking_errors.pop error_messages(spellchecking_errors) end private # Create the error messages def error_messages(spellchecking_errors) messages = [] spellchecking_errors.each do |spellchecking_error_i| error_location, word = spellchecking_error_i.split(' ') error_file_path, line = error_location.split(':') messages << Overcommit::Hook::Message.new( :error, error_file_path, line, "#{error_location}: #{word}" ) end messages end end end
Version data entries
28 entries across 28 versions & 2 rubygems