class Overcommit::Hook::PreCommit::CodeSpellCheck
Runs ‘alfonsox` spell-checking tool against any modified code file.
Public Instance Methods
Source
# File lib/overcommit/hook/pre_commit/code_spell_check.rb, line 8 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 Instance Methods
Source
# File lib/overcommit/hook/pre_commit/code_spell_check.rb, line 24 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
Create the error messages