<commit_before>"""Git Commit Auto Save.

Sublime Text 3 package to auto save commit messages when the window is closed.
This allows the user to close the window without having to save before,
or having to deal with the "Save File" popup.
"""
import sublime_plugin


class GitCommitAutoSave(sublime_plugin.EventListener):
	def on_load(self, view):
		if view.file_name().endswith('COMMIT_EDITMSG'):
			view.set_scratch(True)  # disable save file dialog on exit

	def on_pre_close(self, view):
		if view.file_name().endswith('COMMIT_EDITMSG'):
			view.run_command("save")<commit_msg>Fix 'NoneType' object has no attribute 'endswith'<commit_after>"""Git Commit Auto Save.

Sublime Text 3 package to auto save commit messages when the window is closed.
This allows the user to close the window without having to save before,
or having to deal with the "Save File" popup.
"""
import sublime_plugin


class GitCommitAutoSave(sublime_plugin.EventListener):
	def on_load(self, view):
		if view.file_name() and view.file_name().endswith('COMMIT_EDITMSG'):
			view.set_scratch(True)  # disable save file dialog on exit

	def on_pre_close(self, view):
		if view.file_name() and view.file_name().endswith('COMMIT_EDITMSG'):
			view.run_command("save")
{'fraction_non_alphanumeric': 0.09531502423263329, 'fraction_numerical': 0.0016155088852988692, 'mean_word_length': 5.419689119170984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3265211', 'n_tokens_mistral': 404, 'n_tokens_neox': 376, 'n_words': 133}