Class: Overcommit::HookContext::RunAll

Inherits:
Base
  • Object
show all
Defined in:
lib/overcommit/hook_context/run_all.rb

Overview

Simulates a pre-commit context pretending that all files have been changed.

This results in pre-commit hooks running against the entire repository, which is useful for automated CI scripts.

Constant Summary collapse

EMPTY_SET =
Set.new

Instance Method Summary collapse

Methods inherited from Base

#cleanup_environment, #initialize, #modified_lines, #setup_environment

Constructor Details

This class inherits a constructor from Overcommit::HookContext::Base

Instance Method Details

#hook_class_nameObject



21
22
23
# File 'lib/overcommit/hook_context/run_all.rb', line 21

def hook_class_name
  'PreCommit'
end

#hook_script_nameObject



29
30
31
# File 'lib/overcommit/hook_context/run_all.rb', line 29

def hook_script_name
  'pre-commit'
end

#hook_type_nameObject



25
26
27
# File 'lib/overcommit/hook_context/run_all.rb', line 25

def hook_type_name
  'pre_commit'
end

#modified_filesObject



11
12
13
# File 'lib/overcommit/hook_context/run_all.rb', line 11

def modified_files
  all_files
end

#modified_lines_in_file(_file) ⇒ Object

Return an empty set since in this context the user didn’t actually touch any lines.



17
18
19
# File 'lib/overcommit/hook_context/run_all.rb', line 17

def modified_lines_in_file(_file)
  EMPTY_SET
end