checkoff 0.201.0 → 0.203.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +130 -28
- data/.git-hooks/pre_commit/solargraph_typecheck.rb +12 -11
- data/.overcommit.yml +27 -2
- data/.rubocop.yml +20 -2
- data/.rubocop_todo.yml +90 -0
- data/.solargraph.yml +10 -1
- data/DEVELOPMENT.md +1 -1
- data/Gemfile +11 -8
- data/Gemfile.lock +66 -42
- data/LICENSE +1 -1
- data/Makefile +14 -12
- data/bin/brakeman +27 -0
- data/bin/overcommit_branch +117 -0
- data/bin/spoom +27 -0
- data/bin/srb +27 -0
- data/bin/srb-rbi +27 -0
- data/bin/tapioca +27 -0
- data/config/annotations_misc.rb +35 -0
- data/docs/cookiecutter_input.json +1 -0
- data/fix.sh +14 -6
- data/lib/checkoff/internal/search_url/simple_param_converter.rb +11 -0
- data/lib/checkoff/version.rb +1 -1
- data/requirements_dev.txt +1 -1
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/activesupport.rbi +453 -0
- data/sorbet/rbi/annotations/faraday.rbi +17 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/mocha.rbi +34 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/annotations/webmock.rbi +9 -0
- data/sorbet/rbi/dsl/.gitattributes +1 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +23 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.rbi +18749 -0
- data/sorbet/rbi/gems/addressable@2.8.6.rbi +1994 -0
- data/sorbet/rbi/gems/ansi@1.5.0.rbi +688 -0
- data/sorbet/rbi/gems/asana@0.10.6-ab9393136d9ca59b75e42a661fdddc1c65c8f7c3.rbi +6142 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/backport@1.2.0.rbi +523 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.5.rbi +78 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +505 -0
- data/sorbet/rbi/gems/bump@0.10.0.rbi +169 -0
- data/sorbet/rbi/gems/cache@0.4.1.rbi +211 -0
- data/sorbet/rbi/gems/cache_method@0.2.7.rbi +293 -0
- data/sorbet/rbi/gems/chef-utils@18.3.0.rbi +9 -0
- data/sorbet/rbi/gems/childprocess@5.1.0.rbi +383 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +3427 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +11591 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +9 -0
- data/sorbet/rbi/gems/crack@0.4.5.rbi +145 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +969 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +377 -0
- data/sorbet/rbi/gems/drb@2.2.0.rbi +1347 -0
- data/sorbet/rbi/gems/e2mmap@0.1.0.rbi +9 -0
- data/sorbet/rbi/gems/erubi@1.13.0.rbi +152 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +222 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +126 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +136 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +145 -0
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +259 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +142 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +118 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +125 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +133 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +198 -0
- data/sorbet/rbi/gems/faraday@1.10.3.rbi +2729 -0
- data/sorbet/rbi/gems/faraday_middleware-multi_json@0.0.6.rbi +29 -0
- data/sorbet/rbi/gems/faraday_middleware@1.2.0.rbi +1004 -0
- data/sorbet/rbi/gems/gli@2.21.1.rbi +9 -0
- data/sorbet/rbi/gems/hashdiff@1.0.1.rbi +351 -0
- data/sorbet/rbi/gems/i18n@1.14.1.rbi +2326 -0
- data/sorbet/rbi/gems/imagen@0.1.8.rbi +340 -0
- data/sorbet/rbi/gems/iniparse@1.5.0.rbi +899 -0
- data/sorbet/rbi/gems/jaro_winkler@1.6.0.rbi +22 -0
- data/sorbet/rbi/gems/json@2.7.1.rbi +1562 -0
- data/sorbet/rbi/gems/jwt@2.7.1.rbi +1405 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +128 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +3272 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14238 -0
- data/sorbet/rbi/gems/logger@1.6.1.rbi +920 -0
- data/sorbet/rbi/gems/mdl@0.13.0.rbi +445 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +273 -0
- data/sorbet/rbi/gems/mime-types-data@3.2023.1205.rbi +127 -0
- data/sorbet/rbi/gems/mime-types@3.5.1.rbi +1252 -0
- data/sorbet/rbi/gems/minitest-profile@0.0.2.rbi +136 -0
- data/sorbet/rbi/gems/minitest-reporters@1.6.1.rbi +1014 -0
- data/sorbet/rbi/gems/minitest@5.21.1.rbi +1539 -0
- data/sorbet/rbi/gems/mixlib-cli@2.1.8.rbi +314 -0
- data/sorbet/rbi/gems/mixlib-config@3.0.27.rbi +581 -0
- data/sorbet/rbi/gems/mixlib-shellout@3.2.7.rbi +629 -0
- data/sorbet/rbi/gems/mocha@2.1.0.rbi +12 -0
- data/sorbet/rbi/gems/multi_json@1.15.0.rbi +268 -0
- data/sorbet/rbi/gems/multi_xml@0.6.0.rbi +102 -0
- data/sorbet/rbi/gems/multipart-post@2.3.0.rbi +234 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +94 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/nokogiri@1.16.7.rbi +7311 -0
- data/sorbet/rbi/gems/oauth2@1.4.11.rbi +833 -0
- data/sorbet/rbi/gems/ostruct@0.6.1.rbi +354 -0
- data/sorbet/rbi/gems/overcommit@0.64.0.rbi +2400 -0
- data/sorbet/rbi/gems/parallel@1.23.0.rbi +274 -0
- data/sorbet/rbi/gems/parser@3.2.2.4.rbi +7253 -0
- data/sorbet/rbi/gems/prism@1.2.0.rbi +39085 -0
- data/sorbet/rbi/gems/pry@0.14.2.rbi +10070 -0
- data/sorbet/rbi/gems/public_suffix@5.0.4.rbi +936 -0
- data/sorbet/rbi/gems/punchlist@1.3.2.rbi +173 -0
- data/sorbet/rbi/gems/racc@1.7.3.rbi +162 -0
- data/sorbet/rbi/gems/rack@3.0.8.rbi +5184 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.1.0.rbi +3022 -0
- data/sorbet/rbi/gems/rbi@0.2.1.rbi +4535 -0
- data/sorbet/rbi/gems/rbs@2.8.4.rbi +5613 -0
- data/sorbet/rbi/gems/regexp_parser@2.8.3.rbi +3750 -0
- data/sorbet/rbi/gems/reverse_markdown@2.1.1.rbi +390 -0
- data/sorbet/rbi/gems/rexml@3.2.6.rbi +4888 -0
- data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7061 -0
- data/sorbet/rbi/gems/rubocop-minitest@0.34.5.rbi +2577 -0
- data/sorbet/rbi/gems/rubocop-performance@1.20.2.rbi +3262 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +329 -0
- data/sorbet/rbi/gems/rubocop@1.59.0.rbi +57238 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/rugged@1.6.3.rbi +1577 -0
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +217 -0
- data/sorbet/rbi/gems/simplecov-lcov@0.8.0.rbi +256 -0
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2149 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +9 -0
- data/sorbet/rbi/gems/solargraph@0.50.1-904b9304770a59fac393c5cc3cad481e5bdf0fd8.rbi +9396 -0
- data/sorbet/rbi/gems/source_finder@3.2.1.rbi +317 -0
- data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
- data/sorbet/rbi/gems/tapioca@0.16.4.rbi +3604 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/tilt@2.4.0.rbi +933 -0
- data/sorbet/rbi/gems/tomlrb@2.0.3.rbi +9 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
- data/sorbet/rbi/gems/undercover@0.5.0.rbi +433 -0
- data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +66 -0
- data/sorbet/rbi/gems/webmock@3.19.1.rbi +1769 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.34.rbi +18247 -0
- data/sorbet/rbi/todo.rbi +11 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +134 -3
@@ -0,0 +1,2400 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `overcommit` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem overcommit`.
|
6
|
+
|
7
|
+
|
8
|
+
# Provides a handler for interrupt signals (SIGINT), allowing the application to
|
9
|
+
# finish what it's currently working on.
|
10
|
+
#
|
11
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#7
|
12
|
+
class InterruptHandler
|
13
|
+
include ::Singleton
|
14
|
+
extend ::Singleton::SingletonClassMethods
|
15
|
+
|
16
|
+
# Initialize safe interrupt signal handling.
|
17
|
+
#
|
18
|
+
# @return [InterruptHandler] a new instance of InterruptHandler
|
19
|
+
#
|
20
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#13
|
21
|
+
def initialize; end
|
22
|
+
|
23
|
+
# Returns the value of attribute isolate_signals.
|
24
|
+
#
|
25
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
26
|
+
def isolate_signals; end
|
27
|
+
|
28
|
+
# Sets the attribute isolate_signals
|
29
|
+
#
|
30
|
+
# @param value the value to set the attribute isolate_signals to.
|
31
|
+
#
|
32
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
33
|
+
def isolate_signals=(_arg0); end
|
34
|
+
|
35
|
+
# Returns the value of attribute reenable_on_interrupt.
|
36
|
+
#
|
37
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
38
|
+
def reenable_on_interrupt; end
|
39
|
+
|
40
|
+
# Sets the attribute reenable_on_interrupt
|
41
|
+
#
|
42
|
+
# @param value the value to set the attribute reenable_on_interrupt to.
|
43
|
+
#
|
44
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
45
|
+
def reenable_on_interrupt=(_arg0); end
|
46
|
+
|
47
|
+
# Returns the value of attribute signal_received.
|
48
|
+
#
|
49
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
50
|
+
def signal_received; end
|
51
|
+
|
52
|
+
# Sets the attribute signal_received
|
53
|
+
#
|
54
|
+
# @param value the value to set the attribute signal_received to.
|
55
|
+
#
|
56
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#10
|
57
|
+
def signal_received=(_arg0); end
|
58
|
+
|
59
|
+
class << self
|
60
|
+
# Disable interrupt isolation.
|
61
|
+
#
|
62
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#71
|
63
|
+
def disable!; end
|
64
|
+
|
65
|
+
# Provide a way to allow a single Ctrl-C interrupt to happen and atomically
|
66
|
+
# re-enable interrupt protections once that interrupt is propagated.
|
67
|
+
#
|
68
|
+
# This prevents a race condition where code like the following:
|
69
|
+
#
|
70
|
+
# begin
|
71
|
+
# InterruptHandler.disable!
|
72
|
+
# ... do stuff ...
|
73
|
+
# rescue Interrupt
|
74
|
+
# ... handle it ...
|
75
|
+
# ensure
|
76
|
+
# InterruptHandler.enable!
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# ...could have the `enable!` call to the interrupt handler not called in
|
80
|
+
# the event another interrupt was received in between the interrupt being
|
81
|
+
# handled and the `ensure` block being entered.
|
82
|
+
#
|
83
|
+
# Thus you should always write:
|
84
|
+
#
|
85
|
+
# begin
|
86
|
+
# InterruptHandler.disable_until_finished_or_interrupted do
|
87
|
+
# ... do stuff ...
|
88
|
+
# end
|
89
|
+
# rescue Interrupt
|
90
|
+
# ... handle it ...
|
91
|
+
# rescue
|
92
|
+
# ... handle any other exceptions ...
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#62
|
96
|
+
def disable_until_finished_or_interrupted; end
|
97
|
+
|
98
|
+
# Enable interrupt isolation.
|
99
|
+
#
|
100
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#76
|
101
|
+
def enable!; end
|
102
|
+
|
103
|
+
# Enable interrupt isolation while executing the provided block.
|
104
|
+
#
|
105
|
+
# @yield block to execute with interrupt isolation
|
106
|
+
#
|
107
|
+
# source://overcommit//lib/overcommit/interrupt_handler.rb#83
|
108
|
+
def isolate_from_interrupts; end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def allocate; end
|
113
|
+
def new(*_arg0); end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Defines the gem version.
|
118
|
+
#
|
119
|
+
# source://overcommit//lib/overcommit/os.rb#5
|
120
|
+
module Overcommit; end
|
121
|
+
|
122
|
+
# source://overcommit//lib/overcommit/constants.rb#12
|
123
|
+
Overcommit::BUG_REPORT_URL = T.let(T.unsafe(nil), String)
|
124
|
+
|
125
|
+
# source://overcommit//lib/overcommit/constants.rb#6
|
126
|
+
Overcommit::CONFIG_FILE_NAME = T.let(T.unsafe(nil), String)
|
127
|
+
|
128
|
+
# Distributes a list of arguments over multiple invocations of a command.
|
129
|
+
#
|
130
|
+
# This accomplishes the same functionality provided by `xargs` but in a
|
131
|
+
# cross-platform way that does not require any pre-existing tools.
|
132
|
+
#
|
133
|
+
# One of the tradeoffs with this approach is that we no longer deal with a
|
134
|
+
# single exit status from a command, but multiple (one for each invocation).
|
135
|
+
#
|
136
|
+
# This will return a struct similar to `Subprocess::Result` but with
|
137
|
+
# additional `statuses`, `stdouts`, and `stderrs` fields so hook authors can
|
138
|
+
# actually see the results of each invocation. If they don't care, the
|
139
|
+
# standard `status`, `stdout`, and `stderr` will still work but be a
|
140
|
+
# aggregation/concatenation of all statuses/outputs.
|
141
|
+
#
|
142
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#17
|
143
|
+
class Overcommit::CommandSplitter
|
144
|
+
class << self
|
145
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#56
|
146
|
+
def execute(initial_args, options); end
|
147
|
+
|
148
|
+
private
|
149
|
+
|
150
|
+
# @return [Array<Array<String>, Integer>] tuple of arguments and new index
|
151
|
+
#
|
152
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#104
|
153
|
+
def arguments_under_limit(splittable_args, start_index, byte_limit); end
|
154
|
+
|
155
|
+
# Given a list of prefix arguments and suffix arguments that can be split,
|
156
|
+
# returns a list of argument lists that are executable on the current OS
|
157
|
+
# without exceeding command line limitations.
|
158
|
+
#
|
159
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#79
|
160
|
+
def extract_argument_lists(args, splittable_args); end
|
161
|
+
|
162
|
+
# Returns the maximum number of arguments allowed in a single command on
|
163
|
+
# this system.
|
164
|
+
#
|
165
|
+
# @return [Integer]
|
166
|
+
#
|
167
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#132
|
168
|
+
def max_command_length; end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Encapsulates the result of a split argument run.
|
173
|
+
#
|
174
|
+
# @attr_reader statuses [Array<Integer>] status codes for invocations
|
175
|
+
# @attr_reader stdouts [Array<String>] standard outputs from invocations
|
176
|
+
# @attr_reader stderrs [Array<String>] standard error outputs from invocations
|
177
|
+
#
|
178
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#23
|
179
|
+
class Overcommit::CommandSplitter::Result < ::Struct
|
180
|
+
# Returns `0` if all invocations returned `0`; `1` otherwise.
|
181
|
+
#
|
182
|
+
# @return [true, false]
|
183
|
+
#
|
184
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#34
|
185
|
+
def status; end
|
186
|
+
|
187
|
+
# status codes for invocations
|
188
|
+
#
|
189
|
+
# @return [Array<Integer>] the current value of statuses
|
190
|
+
def statuses; end
|
191
|
+
|
192
|
+
def statuses=(_); end
|
193
|
+
|
194
|
+
# Returns concatenated standard error streams of all invocations in the
|
195
|
+
# order they were executed.
|
196
|
+
#
|
197
|
+
# @return [String]
|
198
|
+
#
|
199
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#50
|
200
|
+
def stderr; end
|
201
|
+
|
202
|
+
# standard error outputs from invocations
|
203
|
+
#
|
204
|
+
# @return [Array<String>] the current value of stderrs
|
205
|
+
def stderrs; end
|
206
|
+
|
207
|
+
def stderrs=(_); end
|
208
|
+
|
209
|
+
# Returns concatenated standard output streams of all invocations in the
|
210
|
+
# order they were executed.
|
211
|
+
#
|
212
|
+
# @return [String]
|
213
|
+
#
|
214
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#42
|
215
|
+
def stdout; end
|
216
|
+
|
217
|
+
# standard outputs from invocations
|
218
|
+
#
|
219
|
+
# @return [Array<String>] the current value of stdouts
|
220
|
+
def stdouts; end
|
221
|
+
|
222
|
+
def stdouts=(_); end
|
223
|
+
|
224
|
+
# Returns whether all invocations were successful.
|
225
|
+
#
|
226
|
+
# @return [true, false]
|
227
|
+
#
|
228
|
+
# source://overcommit//lib/overcommit/command_splitter.rb#27
|
229
|
+
def success?; end
|
230
|
+
|
231
|
+
class << self
|
232
|
+
def [](*_arg0); end
|
233
|
+
def inspect; end
|
234
|
+
def keyword_init?; end
|
235
|
+
def members; end
|
236
|
+
def new(*_arg0); end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
# Stores configuration for Overcommit and the hooks it runs.
|
241
|
+
#
|
242
|
+
# source://overcommit//lib/overcommit/configuration.rb#8
|
243
|
+
class Overcommit::Configuration
|
244
|
+
# Creates a configuration from the given hash.
|
245
|
+
#
|
246
|
+
# @option default
|
247
|
+
# @option logger
|
248
|
+
# @param hash [Hash] loaded YAML config file as a hash
|
249
|
+
# @param options [Hash]
|
250
|
+
# @param default [Hash] a customizable set of options
|
251
|
+
# @param logger [Hash] a customizable set of options
|
252
|
+
# @return [Configuration] a new instance of Configuration
|
253
|
+
#
|
254
|
+
# source://overcommit//lib/overcommit/configuration.rb#15
|
255
|
+
def initialize(hash, options = T.unsafe(nil)); end
|
256
|
+
|
257
|
+
# source://overcommit//lib/overcommit/configuration.rb#24
|
258
|
+
def ==(other); end
|
259
|
+
|
260
|
+
# Access the configuration as if it were a hash.
|
261
|
+
#
|
262
|
+
# @param key [String]
|
263
|
+
# @return [Array, Hash, Number, String]
|
264
|
+
#
|
265
|
+
# source://overcommit//lib/overcommit/configuration.rb#32
|
266
|
+
def [](key); end
|
267
|
+
|
268
|
+
# Returns configuration for all built-in hooks in each hook type.
|
269
|
+
#
|
270
|
+
# @return [Hash]
|
271
|
+
#
|
272
|
+
# source://overcommit//lib/overcommit/configuration.rb#72
|
273
|
+
def all_builtin_hook_configs; end
|
274
|
+
|
275
|
+
# Returns configuration for all hooks in each hook type.
|
276
|
+
#
|
277
|
+
# @return [Hash]
|
278
|
+
#
|
279
|
+
# source://overcommit//lib/overcommit/configuration.rb#65
|
280
|
+
def all_hook_configs; end
|
281
|
+
|
282
|
+
# Returns configuration for all plugin hooks in each hook type.
|
283
|
+
#
|
284
|
+
# @return [Hash]
|
285
|
+
#
|
286
|
+
# source://overcommit//lib/overcommit/configuration.rb#91
|
287
|
+
def all_plugin_hook_configs; end
|
288
|
+
|
289
|
+
# Applies additional configuration settings based on the provided
|
290
|
+
# environment variables.
|
291
|
+
#
|
292
|
+
# source://overcommit//lib/overcommit/configuration.rb#157
|
293
|
+
def apply_environment!(hook_context, env); end
|
294
|
+
|
295
|
+
# source://overcommit//lib/overcommit/configuration.rb#42
|
296
|
+
def concurrency; end
|
297
|
+
|
298
|
+
# Returns the ad hoc hooks that have been enabled for a hook type.
|
299
|
+
#
|
300
|
+
# source://overcommit//lib/overcommit/configuration.rb#123
|
301
|
+
def enabled_ad_hoc_hooks(hook_context); end
|
302
|
+
|
303
|
+
# Returns the built-in hooks that have been enabled for a hook type.
|
304
|
+
#
|
305
|
+
# source://overcommit//lib/overcommit/configuration.rb#115
|
306
|
+
def enabled_builtin_hooks(hook_context); end
|
307
|
+
|
308
|
+
# Returns a non-modifiable configuration for a hook.
|
309
|
+
#
|
310
|
+
# source://overcommit//lib/overcommit/configuration.rb#131
|
311
|
+
def for_hook(hook, hook_type = T.unsafe(nil)); end
|
312
|
+
|
313
|
+
# Merges the given configuration with this one, returning a new
|
314
|
+
# {Configuration}. The provided configuration will either add to or replace
|
315
|
+
# any options defined in this configuration.
|
316
|
+
#
|
317
|
+
# source://overcommit//lib/overcommit/configuration.rb#151
|
318
|
+
def merge(config); end
|
319
|
+
|
320
|
+
# Returns absolute path to the directory that external hook plugins should
|
321
|
+
# be loaded from.
|
322
|
+
#
|
323
|
+
# source://overcommit//lib/overcommit/configuration.rb#38
|
324
|
+
def plugin_directory; end
|
325
|
+
|
326
|
+
# @return [Boolean]
|
327
|
+
#
|
328
|
+
# source://overcommit//lib/overcommit/configuration.rb#181
|
329
|
+
def plugin_hook?(hook_context_or_type, hook_name); end
|
330
|
+
|
331
|
+
# Return whether a previous signature has been recorded for this
|
332
|
+
# configuration.
|
333
|
+
#
|
334
|
+
# @return [true, false]
|
335
|
+
#
|
336
|
+
# source://overcommit//lib/overcommit/configuration.rb#205
|
337
|
+
def previous_signature?; end
|
338
|
+
|
339
|
+
# Return whether the signature for this configuration has changed since it
|
340
|
+
# was last calculated.
|
341
|
+
#
|
342
|
+
# @return [true, false]
|
343
|
+
#
|
344
|
+
# source://overcommit//lib/overcommit/configuration.rb#197
|
345
|
+
def signature_changed?; end
|
346
|
+
|
347
|
+
# Update the currently stored signature for this hook.
|
348
|
+
#
|
349
|
+
# source://overcommit//lib/overcommit/configuration.rb#234
|
350
|
+
def update_signature!; end
|
351
|
+
|
352
|
+
# Returns whether this configuration should verify itself by checking the
|
353
|
+
# stored configuration for the repo.
|
354
|
+
#
|
355
|
+
# @return [true, false]
|
356
|
+
#
|
357
|
+
# source://overcommit//lib/overcommit/configuration.rb#213
|
358
|
+
def verify_signatures?; end
|
359
|
+
|
360
|
+
protected
|
361
|
+
|
362
|
+
# Returns the value of attribute hash.
|
363
|
+
#
|
364
|
+
# source://overcommit//lib/overcommit/configuration.rb#252
|
365
|
+
def hash; end
|
366
|
+
|
367
|
+
private
|
368
|
+
|
369
|
+
# @return [Boolean]
|
370
|
+
#
|
371
|
+
# source://overcommit//lib/overcommit/configuration.rb#256
|
372
|
+
def ad_hoc_hook?(hook_context, hook_name); end
|
373
|
+
|
374
|
+
# @return [Boolean]
|
375
|
+
#
|
376
|
+
# source://overcommit//lib/overcommit/configuration.rb#266
|
377
|
+
def built_in_hook?(hook_context, hook_name); end
|
378
|
+
|
379
|
+
# @return [Boolean]
|
380
|
+
#
|
381
|
+
# source://overcommit//lib/overcommit/configuration.rb#279
|
382
|
+
def hook_enabled?(hook_context_or_type, hook_name); end
|
383
|
+
|
384
|
+
# @return [Boolean]
|
385
|
+
#
|
386
|
+
# source://overcommit//lib/overcommit/configuration.rb#273
|
387
|
+
def hook_exists?(hook_context, hook_name); end
|
388
|
+
|
389
|
+
# Returns the unique signature of this configuration.
|
390
|
+
#
|
391
|
+
# @return [String]
|
392
|
+
#
|
393
|
+
# source://overcommit//lib/overcommit/configuration.rb#317
|
394
|
+
def signature; end
|
395
|
+
|
396
|
+
# source://overcommit//lib/overcommit/configuration.rb#342
|
397
|
+
def signature_config_key; end
|
398
|
+
|
399
|
+
# source://overcommit//lib/overcommit/configuration.rb#296
|
400
|
+
def smart_merge(parent, child); end
|
401
|
+
|
402
|
+
# Returns the stored signature of this repo's Overcommit configuration.
|
403
|
+
#
|
404
|
+
# This is intended to be compared against the current signature of this
|
405
|
+
# configuration object.
|
406
|
+
#
|
407
|
+
# @return [String]
|
408
|
+
#
|
409
|
+
# source://overcommit//lib/overcommit/configuration.rb#327
|
410
|
+
def stored_signature; end
|
411
|
+
|
412
|
+
# source://overcommit//lib/overcommit/configuration.rb#346
|
413
|
+
def verify_signature_config_key; end
|
414
|
+
end
|
415
|
+
|
416
|
+
# Manages configuration file loading.
|
417
|
+
#
|
418
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#7
|
419
|
+
class Overcommit::ConfigurationLoader
|
420
|
+
# Create a configuration loader which writes warnings/errors to the given
|
421
|
+
# {Overcommit::Logger} instance.
|
422
|
+
#
|
423
|
+
# @option verify
|
424
|
+
# @param logger [Overcommit::Logger]
|
425
|
+
# @param options [Hash]
|
426
|
+
# @param verify [Hash] a customizable set of options
|
427
|
+
# @return [ConfigurationLoader] a new instance of ConfigurationLoader
|
428
|
+
#
|
429
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#47
|
430
|
+
def initialize(logger, options = T.unsafe(nil)); end
|
431
|
+
|
432
|
+
# Loads a configuration, ensuring it extends the default configuration.
|
433
|
+
#
|
434
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#71
|
435
|
+
def load_file(file, local_file = T.unsafe(nil)); end
|
436
|
+
|
437
|
+
# Loads and returns the configuration for the repository we're running in.
|
438
|
+
#
|
439
|
+
# @return [Overcommit::Configuration]
|
440
|
+
#
|
441
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#55
|
442
|
+
def load_repo_config; end
|
443
|
+
|
444
|
+
private
|
445
|
+
|
446
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#92
|
447
|
+
def verify_signatures(config); end
|
448
|
+
|
449
|
+
class << self
|
450
|
+
# Loads and returns the default configuration.
|
451
|
+
#
|
452
|
+
# @return [Overcommit::Configuration]
|
453
|
+
#
|
454
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#14
|
455
|
+
def default_configuration; end
|
456
|
+
|
457
|
+
# Loads configuration from file.
|
458
|
+
#
|
459
|
+
# @option logger
|
460
|
+
# @option verify
|
461
|
+
# @option default
|
462
|
+
# @param verify [Hash] a customizable set of options
|
463
|
+
# @param logger [Hash] a customizable set of options
|
464
|
+
# @param options [Hash]
|
465
|
+
# @param file [String] path to file
|
466
|
+
# @param default [Hash] a customizable set of options
|
467
|
+
# @return [Overcommit::Configuration]
|
468
|
+
#
|
469
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#26
|
470
|
+
def load_from_file(file, options = T.unsafe(nil)); end
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
# source://overcommit//lib/overcommit/configuration_loader.rb#8
|
475
|
+
Overcommit::ConfigurationLoader::DEFAULT_CONFIG_PATH = T.let(T.unsafe(nil), String)
|
476
|
+
|
477
|
+
# Validates and normalizes a configuration.
|
478
|
+
#
|
479
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#6
|
480
|
+
class Overcommit::ConfigurationValidator
|
481
|
+
# Validates hash for any invalid options, normalizing where possible.
|
482
|
+
#
|
483
|
+
# @option logger
|
484
|
+
# @option default
|
485
|
+
# @param hash [Hash] hash representation of YAML config
|
486
|
+
# @param default [Hash] a customizable set of options
|
487
|
+
# @param logger [Hash] a customizable set of options
|
488
|
+
# @param options [Hash]
|
489
|
+
# @param config [Overcommit::Configuration]
|
490
|
+
# @return [Hash] validated hash (potentially modified)
|
491
|
+
#
|
492
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#15
|
493
|
+
def validate(config, hash, options); end
|
494
|
+
|
495
|
+
private
|
496
|
+
|
497
|
+
# Prints a warning if there are any hooks listed in the configuration
|
498
|
+
# without `enabled` explicitly set.
|
499
|
+
#
|
500
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#125
|
501
|
+
def check_for_missing_enabled_option(hash); end
|
502
|
+
|
503
|
+
# Prints a warning if any hook has a number of processors larger than the
|
504
|
+
# global `concurrency` setting.
|
505
|
+
#
|
506
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#147
|
507
|
+
def check_for_too_many_processors(config, hash); end
|
508
|
+
|
509
|
+
# Prints a warning if the `verify_plugin_signatures` option is used instead
|
510
|
+
# of the new `verify_signatures` option.
|
511
|
+
#
|
512
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#174
|
513
|
+
def check_for_verify_plugin_signatures_option(hash); end
|
514
|
+
|
515
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#58
|
516
|
+
def check_hook_env(hash); end
|
517
|
+
|
518
|
+
# Prints an error message and raises an exception if a hook has an
|
519
|
+
# invalid name, since this can result in strange errors elsewhere.
|
520
|
+
#
|
521
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#98
|
522
|
+
def check_hook_name_format(hash); end
|
523
|
+
|
524
|
+
# Normalizes `nil` values to empty hashes.
|
525
|
+
#
|
526
|
+
# This is useful for when we want to merge two configuration hashes
|
527
|
+
# together, since it's easier to merge two hashes than to have to check if
|
528
|
+
# one of the values is nil.
|
529
|
+
#
|
530
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#46
|
531
|
+
def convert_nils_to_empty_hashes(hash); end
|
532
|
+
|
533
|
+
# Ensures that keys for all supported hook types exist (PreCommit,
|
534
|
+
# CommitMsg, etc.)
|
535
|
+
#
|
536
|
+
# source://overcommit//lib/overcommit/configuration_validator.rb#34
|
537
|
+
def ensure_hook_type_sections_exist(hash); end
|
538
|
+
end
|
539
|
+
|
540
|
+
# source://overcommit//lib/overcommit/exceptions.rb#3
|
541
|
+
module Overcommit::Exceptions; end
|
542
|
+
|
543
|
+
# Raised when a {Configuration} could not be loaded from a file.
|
544
|
+
#
|
545
|
+
# source://overcommit//lib/overcommit/exceptions.rb#8
|
546
|
+
class Overcommit::Exceptions::ConfigurationError < ::Overcommit::Exceptions::Error; end
|
547
|
+
|
548
|
+
# Raised when the Overcommit configuration file signature has changed.
|
549
|
+
#
|
550
|
+
# source://overcommit//lib/overcommit/exceptions.rb#11
|
551
|
+
class Overcommit::Exceptions::ConfigurationSignatureChanged < ::Overcommit::Exceptions::Error; end
|
552
|
+
|
553
|
+
# Base error class.
|
554
|
+
#
|
555
|
+
# source://overcommit//lib/overcommit/exceptions.rb#5
|
556
|
+
class Overcommit::Exceptions::Error < ::StandardError; end
|
557
|
+
|
558
|
+
# Raised when trying to read/write to/from the local repo git config fails.
|
559
|
+
#
|
560
|
+
# source://overcommit//lib/overcommit/exceptions.rb#14
|
561
|
+
class Overcommit::Exceptions::GitConfigError < ::Overcommit::Exceptions::Error; end
|
562
|
+
|
563
|
+
# Raised when there was a problem reading git revision information with `rev-list`.
|
564
|
+
#
|
565
|
+
# source://overcommit//lib/overcommit/exceptions.rb#20
|
566
|
+
class Overcommit::Exceptions::GitRevListError < ::Overcommit::Exceptions::Error; end
|
567
|
+
|
568
|
+
# Raised when there was a problem reading submodule information for a repo.
|
569
|
+
#
|
570
|
+
# source://overcommit//lib/overcommit/exceptions.rb#17
|
571
|
+
class Overcommit::Exceptions::GitSubmoduleError < ::Overcommit::Exceptions::Error; end
|
572
|
+
|
573
|
+
# Raised when a hook run was cancelled by the user.
|
574
|
+
#
|
575
|
+
# source://overcommit//lib/overcommit/exceptions.rb#29
|
576
|
+
class Overcommit::Exceptions::HookCancelled < ::Overcommit::Exceptions::Error; end
|
577
|
+
|
578
|
+
# Raised when a {HookContext} is unable to clean the environment after a run.
|
579
|
+
#
|
580
|
+
# source://overcommit//lib/overcommit/exceptions.rb#26
|
581
|
+
class Overcommit::Exceptions::HookCleanupFailed < ::Overcommit::Exceptions::Error; end
|
582
|
+
|
583
|
+
# Raised when a {HookRunner} could not be loaded.
|
584
|
+
#
|
585
|
+
# source://overcommit//lib/overcommit/exceptions.rb#35
|
586
|
+
class Overcommit::Exceptions::HookContextLoadError < ::Overcommit::Exceptions::Error; end
|
587
|
+
|
588
|
+
# Raised when a hook could not be loaded by a {HookRunner}.
|
589
|
+
#
|
590
|
+
# source://overcommit//lib/overcommit/exceptions.rb#32
|
591
|
+
class Overcommit::Exceptions::HookLoadError < ::Overcommit::Exceptions::Error; end
|
592
|
+
|
593
|
+
# Raised when a {HookContext} is unable to setup the environment before a run.
|
594
|
+
#
|
595
|
+
# source://overcommit//lib/overcommit/exceptions.rb#23
|
596
|
+
class Overcommit::Exceptions::HookSetupFailed < ::Overcommit::Exceptions::Error; end
|
597
|
+
|
598
|
+
# Raised when a pipe character is used in the `execute` helper, as this was
|
599
|
+
# likely used in error.
|
600
|
+
#
|
601
|
+
# source://overcommit//lib/overcommit/exceptions.rb#39
|
602
|
+
class Overcommit::Exceptions::InvalidCommandArgs < ::Overcommit::Exceptions::Error; end
|
603
|
+
|
604
|
+
# Raised when an installation target is not a valid git repository.
|
605
|
+
#
|
606
|
+
# source://overcommit//lib/overcommit/exceptions.rb#42
|
607
|
+
class Overcommit::Exceptions::InvalidGitRepo < ::Overcommit::Exceptions::Error; end
|
608
|
+
|
609
|
+
# Raised when a hook was defined incorrectly.
|
610
|
+
#
|
611
|
+
# source://overcommit//lib/overcommit/exceptions.rb#45
|
612
|
+
class Overcommit::Exceptions::InvalidHookDefinition < ::Overcommit::Exceptions::Error; end
|
613
|
+
|
614
|
+
# Raised when one or more hook plugin signatures have changed.
|
615
|
+
#
|
616
|
+
# source://overcommit//lib/overcommit/exceptions.rb#48
|
617
|
+
class Overcommit::Exceptions::InvalidHookSignature < ::Overcommit::Exceptions::Error; end
|
618
|
+
|
619
|
+
# Raised when there is a problem processing output into {Hook::Messages}s.
|
620
|
+
#
|
621
|
+
# source://overcommit//lib/overcommit/exceptions.rb#51
|
622
|
+
class Overcommit::Exceptions::MessageProcessingError < ::Overcommit::Exceptions::Error; end
|
623
|
+
|
624
|
+
# Raised when an installation target already contains non-Overcommit hooks.
|
625
|
+
#
|
626
|
+
# source://overcommit//lib/overcommit/exceptions.rb#54
|
627
|
+
class Overcommit::Exceptions::PreExistingHooks < ::Overcommit::Exceptions::Error; end
|
628
|
+
|
629
|
+
# source://overcommit//lib/overcommit/git_version.rb#13
|
630
|
+
Overcommit::GIT_VERSION = T.let(T.unsafe(nil), Overcommit::Utils::Version)
|
631
|
+
|
632
|
+
# Get configuration options from git
|
633
|
+
#
|
634
|
+
# source://overcommit//lib/overcommit/git_config.rb#7
|
635
|
+
module Overcommit::GitConfig
|
636
|
+
private
|
637
|
+
|
638
|
+
# source://overcommit//lib/overcommit/git_config.rb#10
|
639
|
+
def comment_character; end
|
640
|
+
|
641
|
+
# source://overcommit//lib/overcommit/git_config.rb#16
|
642
|
+
def hooks_path; end
|
643
|
+
|
644
|
+
class << self
|
645
|
+
# source://overcommit//lib/overcommit/git_config.rb#10
|
646
|
+
def comment_character; end
|
647
|
+
|
648
|
+
# source://overcommit//lib/overcommit/git_config.rb#16
|
649
|
+
def hooks_path; end
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
# Provide a set of utilities for certain interactions with `git`.
|
654
|
+
#
|
655
|
+
# source://overcommit//lib/overcommit/git_repo.rb#8
|
656
|
+
module Overcommit::GitRepo
|
657
|
+
private
|
658
|
+
|
659
|
+
# Returns the names of all files that are tracked by git.
|
660
|
+
#
|
661
|
+
# @return [Array<String>] list of absolute file paths
|
662
|
+
#
|
663
|
+
# source://overcommit//lib/overcommit/git_repo.rb#137
|
664
|
+
def all_files; end
|
665
|
+
|
666
|
+
# Returns the names of all branches containing the given commit.
|
667
|
+
#
|
668
|
+
# @param commit_ref [String] git tree ref that resolves to a commit
|
669
|
+
# @return [Array<String>] list of branches containing the given commit
|
670
|
+
#
|
671
|
+
# source://overcommit//lib/overcommit/git_repo.rb#274
|
672
|
+
def branches_containing_commit(commit_ref); end
|
673
|
+
|
674
|
+
# Returns the name of the currently checked out branch.
|
675
|
+
#
|
676
|
+
# @return [String]
|
677
|
+
#
|
678
|
+
# source://overcommit//lib/overcommit/git_repo.rb#283
|
679
|
+
def current_branch; end
|
680
|
+
|
681
|
+
# Extract the set of modified lines from a given file.
|
682
|
+
#
|
683
|
+
# @param file_path [String]
|
684
|
+
# @param options [Hash]
|
685
|
+
# @return [Set] line numbers that have been modified in file
|
686
|
+
#
|
687
|
+
# source://overcommit//lib/overcommit/git_repo.rb#68
|
688
|
+
def extract_modified_lines(file_path, options); end
|
689
|
+
|
690
|
+
# Returns whether the current git branch is empty (has no commits).
|
691
|
+
#
|
692
|
+
# @return [true, false]
|
693
|
+
#
|
694
|
+
# source://overcommit//lib/overcommit/git_repo.rb#146
|
695
|
+
def initial_commit?; end
|
696
|
+
|
697
|
+
# Returns the names of files in the given paths that are tracked by git.
|
698
|
+
#
|
699
|
+
# @option options
|
700
|
+
# @param paths [Array<String>] list of paths to check
|
701
|
+
# @return [Array<String>] list of absolute file paths
|
702
|
+
#
|
703
|
+
# source://overcommit//lib/overcommit/git_repo.rb#110
|
704
|
+
def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end
|
705
|
+
|
706
|
+
# Returns the names of all files that have been modified compared to HEAD.
|
707
|
+
#
|
708
|
+
# @param options [Hash]
|
709
|
+
# @return [Array<String>] list of absolute file paths
|
710
|
+
#
|
711
|
+
# source://overcommit//lib/overcommit/git_repo.rb#93
|
712
|
+
def modified_files(options); end
|
713
|
+
|
714
|
+
# Restore any relevant files that were present when repo was in the middle
|
715
|
+
# of a cherry-pick.
|
716
|
+
#
|
717
|
+
# source://overcommit//lib/overcommit/git_repo.rb#203
|
718
|
+
def restore_cherry_pick_state; end
|
719
|
+
|
720
|
+
# Restore any relevant files that were present when repo was in the middle
|
721
|
+
# of a merge.
|
722
|
+
#
|
723
|
+
# source://overcommit//lib/overcommit/git_repo.rb#183
|
724
|
+
def restore_merge_state; end
|
725
|
+
|
726
|
+
# Returns the submodules that have been staged for removal.
|
727
|
+
#
|
728
|
+
# `git` has an unexpected behavior where removing a submodule without
|
729
|
+
# committing (i.e. such that the submodule directory is removed and the
|
730
|
+
# changes to the index are staged) and then doing a hard reset results in
|
731
|
+
# the index being wiped but the empty directory of the once existent
|
732
|
+
# submodule being restored (but with no content).
|
733
|
+
#
|
734
|
+
# This prevents restoration of the stash of the submodule index changes,
|
735
|
+
# which breaks pre-commit hook restorations of the working index.
|
736
|
+
#
|
737
|
+
# Thus we expose this helper so the restoration code can manually delete the
|
738
|
+
# directory.
|
739
|
+
#
|
740
|
+
# @raise [Overcommit::Exceptions::GitSubmoduleError] when
|
741
|
+
#
|
742
|
+
# source://overcommit//lib/overcommit/git_repo.rb#231
|
743
|
+
def staged_submodule_removals; end
|
744
|
+
|
745
|
+
# Store any relevant files that are present when repo is in the middle of a
|
746
|
+
# cherry-pick.
|
747
|
+
#
|
748
|
+
# Restored via [#restore_cherry_pick_state].
|
749
|
+
#
|
750
|
+
# source://overcommit//lib/overcommit/git_repo.rb#171
|
751
|
+
def store_cherry_pick_state; end
|
752
|
+
|
753
|
+
# Store any relevant files that are present when repo is in the middle of a
|
754
|
+
# merge.
|
755
|
+
#
|
756
|
+
# Restored via [#restore_merge_state].
|
757
|
+
#
|
758
|
+
# source://overcommit//lib/overcommit/git_repo.rb#154
|
759
|
+
def store_merge_state; end
|
760
|
+
|
761
|
+
# Returns a list of SubmoduleStatus objects, one for each submodule in the
|
762
|
+
# parent repository.
|
763
|
+
#
|
764
|
+
# @option options
|
765
|
+
# @return [Array<SubmoduleStatus>]
|
766
|
+
#
|
767
|
+
# source://overcommit//lib/overcommit/git_repo.rb#53
|
768
|
+
def submodule_statuses(options = T.unsafe(nil)); end
|
769
|
+
|
770
|
+
# Returns the current set of registered submodules.
|
771
|
+
#
|
772
|
+
# @param options [Hash]
|
773
|
+
# @return [Array<Overcommit::GitRepo::Submodule>]
|
774
|
+
#
|
775
|
+
# source://overcommit//lib/overcommit/git_repo.rb#245
|
776
|
+
def submodules(options = T.unsafe(nil)); end
|
777
|
+
|
778
|
+
# Returns whether the specified file/path is tracked by this repository.
|
779
|
+
#
|
780
|
+
# @param path [String]
|
781
|
+
# @return [true, false]
|
782
|
+
#
|
783
|
+
# source://overcommit//lib/overcommit/git_repo.rb#130
|
784
|
+
def tracked?(path); end
|
785
|
+
|
786
|
+
class << self
|
787
|
+
# Returns the names of all files that are tracked by git.
|
788
|
+
#
|
789
|
+
# @return [Array<String>] list of absolute file paths
|
790
|
+
#
|
791
|
+
# source://overcommit//lib/overcommit/git_repo.rb#137
|
792
|
+
def all_files; end
|
793
|
+
|
794
|
+
# Returns the names of all branches containing the given commit.
|
795
|
+
#
|
796
|
+
# @param commit_ref [String] git tree ref that resolves to a commit
|
797
|
+
# @return [Array<String>] list of branches containing the given commit
|
798
|
+
#
|
799
|
+
# source://overcommit//lib/overcommit/git_repo.rb#274
|
800
|
+
def branches_containing_commit(commit_ref); end
|
801
|
+
|
802
|
+
# Returns the name of the currently checked out branch.
|
803
|
+
#
|
804
|
+
# @return [String]
|
805
|
+
#
|
806
|
+
# source://overcommit//lib/overcommit/git_repo.rb#283
|
807
|
+
def current_branch; end
|
808
|
+
|
809
|
+
# Extract the set of modified lines from a given file.
|
810
|
+
#
|
811
|
+
# @param file_path [String]
|
812
|
+
# @param options [Hash]
|
813
|
+
# @return [Set] line numbers that have been modified in file
|
814
|
+
#
|
815
|
+
# source://overcommit//lib/overcommit/git_repo.rb#68
|
816
|
+
def extract_modified_lines(file_path, options); end
|
817
|
+
|
818
|
+
# Returns whether the current git branch is empty (has no commits).
|
819
|
+
#
|
820
|
+
# @return [true, false]
|
821
|
+
#
|
822
|
+
# source://overcommit//lib/overcommit/git_repo.rb#146
|
823
|
+
def initial_commit?; end
|
824
|
+
|
825
|
+
# Returns the names of files in the given paths that are tracked by git.
|
826
|
+
#
|
827
|
+
# @option options
|
828
|
+
# @param paths [Array<String>] list of paths to check
|
829
|
+
# @param options [Hash] a customizable set of options
|
830
|
+
# @return [Array<String>] list of absolute file paths
|
831
|
+
#
|
832
|
+
# source://overcommit//lib/overcommit/git_repo.rb#110
|
833
|
+
def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end
|
834
|
+
|
835
|
+
# Returns the names of all files that have been modified compared to HEAD.
|
836
|
+
#
|
837
|
+
# @param options [Hash]
|
838
|
+
# @return [Array<String>] list of absolute file paths
|
839
|
+
#
|
840
|
+
# source://overcommit//lib/overcommit/git_repo.rb#93
|
841
|
+
def modified_files(options); end
|
842
|
+
|
843
|
+
# Restore any relevant files that were present when repo was in the middle
|
844
|
+
# of a cherry-pick.
|
845
|
+
#
|
846
|
+
# source://overcommit//lib/overcommit/git_repo.rb#203
|
847
|
+
def restore_cherry_pick_state; end
|
848
|
+
|
849
|
+
# Restore any relevant files that were present when repo was in the middle
|
850
|
+
# of a merge.
|
851
|
+
#
|
852
|
+
# source://overcommit//lib/overcommit/git_repo.rb#183
|
853
|
+
def restore_merge_state; end
|
854
|
+
|
855
|
+
# Returns the submodules that have been staged for removal.
|
856
|
+
#
|
857
|
+
# `git` has an unexpected behavior where removing a submodule without
|
858
|
+
# committing (i.e. such that the submodule directory is removed and the
|
859
|
+
# changes to the index are staged) and then doing a hard reset results in
|
860
|
+
# the index being wiped but the empty directory of the once existent
|
861
|
+
# submodule being restored (but with no content).
|
862
|
+
#
|
863
|
+
# This prevents restoration of the stash of the submodule index changes,
|
864
|
+
# which breaks pre-commit hook restorations of the working index.
|
865
|
+
#
|
866
|
+
# Thus we expose this helper so the restoration code can manually delete the
|
867
|
+
# directory.
|
868
|
+
#
|
869
|
+
# @raise [Overcommit::Exceptions::GitSubmoduleError] when
|
870
|
+
#
|
871
|
+
# source://overcommit//lib/overcommit/git_repo.rb#231
|
872
|
+
def staged_submodule_removals; end
|
873
|
+
|
874
|
+
# Store any relevant files that are present when repo is in the middle of a
|
875
|
+
# cherry-pick.
|
876
|
+
#
|
877
|
+
# Restored via [#restore_cherry_pick_state].
|
878
|
+
#
|
879
|
+
# source://overcommit//lib/overcommit/git_repo.rb#171
|
880
|
+
def store_cherry_pick_state; end
|
881
|
+
|
882
|
+
# Store any relevant files that are present when repo is in the middle of a
|
883
|
+
# merge.
|
884
|
+
#
|
885
|
+
# Restored via [#restore_merge_state].
|
886
|
+
#
|
887
|
+
# source://overcommit//lib/overcommit/git_repo.rb#154
|
888
|
+
def store_merge_state; end
|
889
|
+
|
890
|
+
# Returns a list of SubmoduleStatus objects, one for each submodule in the
|
891
|
+
# parent repository.
|
892
|
+
#
|
893
|
+
# @option options
|
894
|
+
# @param options [Hash] a customizable set of options
|
895
|
+
# @return [Array<SubmoduleStatus>]
|
896
|
+
#
|
897
|
+
# source://overcommit//lib/overcommit/git_repo.rb#53
|
898
|
+
def submodule_statuses(options = T.unsafe(nil)); end
|
899
|
+
|
900
|
+
# Returns the current set of registered submodules.
|
901
|
+
#
|
902
|
+
# @param options [Hash]
|
903
|
+
# @return [Array<Overcommit::GitRepo::Submodule>]
|
904
|
+
#
|
905
|
+
# source://overcommit//lib/overcommit/git_repo.rb#245
|
906
|
+
def submodules(options = T.unsafe(nil)); end
|
907
|
+
|
908
|
+
# Returns whether the specified file/path is tracked by this repository.
|
909
|
+
#
|
910
|
+
# @param path [String]
|
911
|
+
# @return [true, false]
|
912
|
+
#
|
913
|
+
# source://overcommit//lib/overcommit/git_repo.rb#130
|
914
|
+
def tracked?(path); end
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
# Regular expression used to extract diff ranges from hunks of diff output.
|
919
|
+
#
|
920
|
+
# source://overcommit//lib/overcommit/git_repo.rb#12
|
921
|
+
Overcommit::GitRepo::DIFF_HUNK_REGEX = T.let(T.unsafe(nil), Regexp)
|
922
|
+
|
923
|
+
# Regular expression used to extract information from lines of
|
924
|
+
# `git submodule status` output
|
925
|
+
#
|
926
|
+
# source://overcommit//lib/overcommit/git_repo.rb#21
|
927
|
+
Overcommit::GitRepo::SUBMODULE_STATUS_REGEX = T.let(T.unsafe(nil), Regexp)
|
928
|
+
|
929
|
+
# Contains information about a registered submodule.
|
930
|
+
#
|
931
|
+
# source://overcommit//lib/overcommit/git_repo.rb#214
|
932
|
+
class Overcommit::GitRepo::Submodule < ::Struct
|
933
|
+
# Returns the value of attribute path
|
934
|
+
#
|
935
|
+
# @return [Object] the current value of path
|
936
|
+
def path; end
|
937
|
+
|
938
|
+
# Sets the attribute path
|
939
|
+
#
|
940
|
+
# @param value [Object] the value to set the attribute path to.
|
941
|
+
# @return [Object] the newly set value
|
942
|
+
def path=(_); end
|
943
|
+
|
944
|
+
# Returns the value of attribute url
|
945
|
+
#
|
946
|
+
# @return [Object] the current value of url
|
947
|
+
def url; end
|
948
|
+
|
949
|
+
# Sets the attribute url
|
950
|
+
#
|
951
|
+
# @param value [Object] the value to set the attribute url to.
|
952
|
+
# @return [Object] the newly set value
|
953
|
+
def url=(_); end
|
954
|
+
|
955
|
+
class << self
|
956
|
+
def [](*_arg0); end
|
957
|
+
def inspect; end
|
958
|
+
def keyword_init?; end
|
959
|
+
def members; end
|
960
|
+
def new(*_arg0); end
|
961
|
+
end
|
962
|
+
end
|
963
|
+
|
964
|
+
# Struct encapsulating submodule information extracted from the
|
965
|
+
# output of `git submodule status`
|
966
|
+
#
|
967
|
+
# source://overcommit//lib/overcommit/git_repo.rb#29
|
968
|
+
class Overcommit::GitRepo::SubmoduleStatus < ::Struct
|
969
|
+
# Returns the value of attribute describe
|
970
|
+
#
|
971
|
+
# @return [Object] the current value of describe
|
972
|
+
def describe; end
|
973
|
+
|
974
|
+
# Sets the attribute describe
|
975
|
+
#
|
976
|
+
# @param value [Object] the value to set the attribute describe to.
|
977
|
+
# @return [Object] the newly set value
|
978
|
+
def describe=(_); end
|
979
|
+
|
980
|
+
# Returns whether the submodule reference has a merge conflict
|
981
|
+
#
|
982
|
+
# @return [Boolean]
|
983
|
+
#
|
984
|
+
# source://overcommit//lib/overcommit/git_repo.rb#43
|
985
|
+
def merge_conflict?; end
|
986
|
+
|
987
|
+
# Returns whether the submodule is out of date with the current
|
988
|
+
# index, i.e. its checked-out commit differs from that stored in
|
989
|
+
# the index of the parent repo
|
990
|
+
#
|
991
|
+
# @return [Boolean]
|
992
|
+
#
|
993
|
+
# source://overcommit//lib/overcommit/git_repo.rb#38
|
994
|
+
def outdated?; end
|
995
|
+
|
996
|
+
# Returns the value of attribute path
|
997
|
+
#
|
998
|
+
# @return [Object] the current value of path
|
999
|
+
def path; end
|
1000
|
+
|
1001
|
+
# Sets the attribute path
|
1002
|
+
#
|
1003
|
+
# @param value [Object] the value to set the attribute path to.
|
1004
|
+
# @return [Object] the newly set value
|
1005
|
+
def path=(_); end
|
1006
|
+
|
1007
|
+
# Returns the value of attribute prefix
|
1008
|
+
#
|
1009
|
+
# @return [Object] the current value of prefix
|
1010
|
+
def prefix; end
|
1011
|
+
|
1012
|
+
# Sets the attribute prefix
|
1013
|
+
#
|
1014
|
+
# @param value [Object] the value to set the attribute prefix to.
|
1015
|
+
# @return [Object] the newly set value
|
1016
|
+
def prefix=(_); end
|
1017
|
+
|
1018
|
+
# Returns the value of attribute sha1
|
1019
|
+
#
|
1020
|
+
# @return [Object] the current value of sha1
|
1021
|
+
def sha1; end
|
1022
|
+
|
1023
|
+
# Sets the attribute sha1
|
1024
|
+
#
|
1025
|
+
# @param value [Object] the value to set the attribute sha1 to.
|
1026
|
+
# @return [Object] the newly set value
|
1027
|
+
def sha1=(_); end
|
1028
|
+
|
1029
|
+
# Returns whether the submodule has not been initialized
|
1030
|
+
#
|
1031
|
+
# @return [Boolean]
|
1032
|
+
#
|
1033
|
+
# source://overcommit//lib/overcommit/git_repo.rb#31
|
1034
|
+
def uninitialized?; end
|
1035
|
+
|
1036
|
+
class << self
|
1037
|
+
def [](*_arg0); end
|
1038
|
+
def inspect; end
|
1039
|
+
def keyword_init?; end
|
1040
|
+
def members; end
|
1041
|
+
def new(*_arg0); end
|
1042
|
+
end
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
# source://overcommit//lib/overcommit/constants.rb#5
|
1046
|
+
Overcommit::HOME = T.let(T.unsafe(nil), String)
|
1047
|
+
|
1048
|
+
# source://overcommit//lib/overcommit/constants.rb#9
|
1049
|
+
Overcommit::HOOK_DIRECTORY = T.let(T.unsafe(nil), String)
|
1050
|
+
|
1051
|
+
# Container for top-level hook-related classes and constants.
|
1052
|
+
#
|
1053
|
+
# source://overcommit//lib/overcommit/hook/base.rb#7
|
1054
|
+
module Overcommit::Hook; end
|
1055
|
+
|
1056
|
+
# Functionality common to all hooks.
|
1057
|
+
#
|
1058
|
+
# source://overcommit//lib/overcommit/hook/base.rb#19
|
1059
|
+
class Overcommit::Hook::Base
|
1060
|
+
extend ::Forwardable
|
1061
|
+
|
1062
|
+
# @param config [Overcommit::Configuration]
|
1063
|
+
# @param context [Overcommit::HookContext]
|
1064
|
+
# @return [Base] a new instance of Base
|
1065
|
+
#
|
1066
|
+
# source://overcommit//lib/overcommit/hook/base.rb#27
|
1067
|
+
def initialize(config, context); end
|
1068
|
+
|
1069
|
+
# source://forwardable/1.3.2/forwardable.rb#229
|
1070
|
+
def all_files(*args, **_arg1, &block); end
|
1071
|
+
|
1072
|
+
# Gets a list of staged files that apply to this hook based on its
|
1073
|
+
# configured `include` and `exclude` lists.
|
1074
|
+
#
|
1075
|
+
# source://overcommit//lib/overcommit/hook/base.rb#165
|
1076
|
+
def applicable_files; end
|
1077
|
+
|
1078
|
+
# Return command to execute for this hook.
|
1079
|
+
#
|
1080
|
+
# This is intended to be configurable so hooks can prefix their commands
|
1081
|
+
# with `bundle exec` or similar. It will appends the command line flags
|
1082
|
+
# specified by the `flags` option after.
|
1083
|
+
#
|
1084
|
+
# Note that any files intended to be passed must be handled by the hook
|
1085
|
+
# itself.
|
1086
|
+
#
|
1087
|
+
# @return [Array<String>]
|
1088
|
+
#
|
1089
|
+
# source://overcommit//lib/overcommit/hook/base.rb#141
|
1090
|
+
def command; end
|
1091
|
+
|
1092
|
+
# Returns the value of attribute config.
|
1093
|
+
#
|
1094
|
+
# source://overcommit//lib/overcommit/hook/base.rb#23
|
1095
|
+
def config; end
|
1096
|
+
|
1097
|
+
# source://overcommit//lib/overcommit/hook/base.rb#58
|
1098
|
+
def description; end
|
1099
|
+
|
1100
|
+
# @return [Boolean]
|
1101
|
+
#
|
1102
|
+
# source://overcommit//lib/overcommit/hook/base.rb#78
|
1103
|
+
def enabled?; end
|
1104
|
+
|
1105
|
+
# @return [Boolean]
|
1106
|
+
#
|
1107
|
+
# source://overcommit//lib/overcommit/hook/base.rb#82
|
1108
|
+
def excluded?; end
|
1109
|
+
|
1110
|
+
# Execute a command in a separate process.
|
1111
|
+
#
|
1112
|
+
# If `splittable_args` is specified, ensures that those arguments are
|
1113
|
+
# concatenated onto the end of the `cmd` arguments, but split up so that the
|
1114
|
+
# operating system's maximum command length is not exceeded. This is useful
|
1115
|
+
# for splitting up long file lists.
|
1116
|
+
#
|
1117
|
+
# @option options
|
1118
|
+
# @option options
|
1119
|
+
# @param cmd [Array<String>] command arguments
|
1120
|
+
# @param options [Hash]
|
1121
|
+
# @return [#status, #stdout, #stderr] struct containing result of invocation
|
1122
|
+
#
|
1123
|
+
# source://overcommit//lib/overcommit/hook/base.rb#115
|
1124
|
+
def execute(cmd, options = T.unsafe(nil)); end
|
1125
|
+
|
1126
|
+
# source://overcommit//lib/overcommit/hook/base.rb#119
|
1127
|
+
def execute_in_background(cmd); end
|
1128
|
+
|
1129
|
+
# Return command line flags to be passed to the command.
|
1130
|
+
#
|
1131
|
+
# This excludes the list of files, as that must be handled by the hook
|
1132
|
+
# itself.
|
1133
|
+
#
|
1134
|
+
# The intention here is to provide flexibility for when a tool
|
1135
|
+
# removes/renames its flags. Rather than wait for Overcommit to update the
|
1136
|
+
# flags it uses, you can update your configuration to use the new flags
|
1137
|
+
# right away without being blocked.
|
1138
|
+
#
|
1139
|
+
# Also note that any flags containing dynamic content must be passed in the
|
1140
|
+
# hook's {#run} method.
|
1141
|
+
#
|
1142
|
+
# @return [Array<String>]
|
1143
|
+
#
|
1144
|
+
# source://overcommit//lib/overcommit/hook/base.rb#159
|
1145
|
+
def flags; end
|
1146
|
+
|
1147
|
+
# @return [Boolean]
|
1148
|
+
#
|
1149
|
+
# source://overcommit//lib/overcommit/hook/base.rb#97
|
1150
|
+
def in_path?(cmd); end
|
1151
|
+
|
1152
|
+
# Gets a list of all files that apply to this hook based on its
|
1153
|
+
# configured `include` and `exclude` lists.
|
1154
|
+
#
|
1155
|
+
# source://overcommit//lib/overcommit/hook/base.rb#171
|
1156
|
+
def included_files; end
|
1157
|
+
|
1158
|
+
# source://forwardable/1.3.2/forwardable.rb#229
|
1159
|
+
def modified_files(*args, **_arg1, &block); end
|
1160
|
+
|
1161
|
+
# source://overcommit//lib/overcommit/hook/base.rb#54
|
1162
|
+
def name; end
|
1163
|
+
|
1164
|
+
# @return [Boolean]
|
1165
|
+
#
|
1166
|
+
# source://overcommit//lib/overcommit/hook/base.rb#66
|
1167
|
+
def parallelize?; end
|
1168
|
+
|
1169
|
+
# source://overcommit//lib/overcommit/hook/base.rb#70
|
1170
|
+
def processors; end
|
1171
|
+
|
1172
|
+
# @return [Boolean]
|
1173
|
+
#
|
1174
|
+
# source://overcommit//lib/overcommit/hook/base.rb#74
|
1175
|
+
def quiet?; end
|
1176
|
+
|
1177
|
+
# @return [Boolean]
|
1178
|
+
#
|
1179
|
+
# source://overcommit//lib/overcommit/hook/base.rb#62
|
1180
|
+
def required?; end
|
1181
|
+
|
1182
|
+
# source://overcommit//lib/overcommit/hook/base.rb#123
|
1183
|
+
def required_executable; end
|
1184
|
+
|
1185
|
+
# source://overcommit//lib/overcommit/hook/base.rb#127
|
1186
|
+
def required_libraries; end
|
1187
|
+
|
1188
|
+
# Runs the hook.
|
1189
|
+
#
|
1190
|
+
# @raise [NotImplementedError]
|
1191
|
+
#
|
1192
|
+
# source://overcommit//lib/overcommit/hook/base.rb#33
|
1193
|
+
def run; end
|
1194
|
+
|
1195
|
+
# @return [Boolean]
|
1196
|
+
#
|
1197
|
+
# source://overcommit//lib/overcommit/hook/base.rb#91
|
1198
|
+
def run?; end
|
1199
|
+
|
1200
|
+
# Runs the hook and transforms the status returned based on the hook's
|
1201
|
+
# configuration.
|
1202
|
+
#
|
1203
|
+
# Poorly named because we already have a bunch of hooks in the wild that
|
1204
|
+
# implement `#run`, and we needed a wrapper step to transform the status
|
1205
|
+
# based on any custom configuration.
|
1206
|
+
#
|
1207
|
+
# source://overcommit//lib/overcommit/hook/base.rb#43
|
1208
|
+
def run_and_transform; end
|
1209
|
+
|
1210
|
+
# @return [Boolean]
|
1211
|
+
#
|
1212
|
+
# source://overcommit//lib/overcommit/hook/base.rb#86
|
1213
|
+
def skip?; end
|
1214
|
+
|
1215
|
+
private
|
1216
|
+
|
1217
|
+
# @return [Boolean]
|
1218
|
+
#
|
1219
|
+
# source://overcommit//lib/overcommit/hook/base.rb#181
|
1220
|
+
def applicable_file?(file); end
|
1221
|
+
|
1222
|
+
# If the hook defines a required executable, check if it's in the path and
|
1223
|
+
# display the install command if one exists.
|
1224
|
+
#
|
1225
|
+
# source://overcommit//lib/overcommit/hook/base.rb#210
|
1226
|
+
def check_for_executable; end
|
1227
|
+
|
1228
|
+
# If the hook defines required library paths that it wants to load, attempt
|
1229
|
+
# to load them.
|
1230
|
+
#
|
1231
|
+
# source://overcommit//lib/overcommit/hook/base.rb#227
|
1232
|
+
def check_for_libraries; end
|
1233
|
+
|
1234
|
+
# Check for any required executables or libraries.
|
1235
|
+
#
|
1236
|
+
# Returns output if any requirements are not met.
|
1237
|
+
#
|
1238
|
+
# source://overcommit//lib/overcommit/hook/base.rb#204
|
1239
|
+
def check_for_requirements; end
|
1240
|
+
|
1241
|
+
# source://overcommit//lib/overcommit/hook/base.rb#288
|
1242
|
+
def current_branch; end
|
1243
|
+
|
1244
|
+
# source://overcommit//lib/overcommit/hook/base.rb#284
|
1245
|
+
def exclude_branches; end
|
1246
|
+
|
1247
|
+
# source://overcommit//lib/overcommit/hook/base.rb#217
|
1248
|
+
def install_command_prompt; end
|
1249
|
+
|
1250
|
+
# Converts the hook's return value into a canonical form of a tuple
|
1251
|
+
# containing status (pass/warn/fail) and output.
|
1252
|
+
#
|
1253
|
+
# This is intended to support various shortcuts for writing hooks so that
|
1254
|
+
# hook authors don't need to work with {Overcommit::Hook::Message} objects
|
1255
|
+
# for simple pass/fail hooks. It also saves you from needing to manually
|
1256
|
+
# encode logic like "if there are errors, fail; if there are warnings, warn,
|
1257
|
+
# otherwise pass." by simply returning an array of
|
1258
|
+
# {Overcommit::Hook::Message} objects.
|
1259
|
+
#
|
1260
|
+
# @param hook_return_value [Symbol, Array<Symbol,String>, Array<Message>]
|
1261
|
+
# @return [Array<Symbol,String>] tuple of status and output
|
1262
|
+
#
|
1263
|
+
# source://overcommit//lib/overcommit/hook/base.rb#256
|
1264
|
+
def process_hook_return_value(hook_return_value); end
|
1265
|
+
|
1266
|
+
# source://overcommit//lib/overcommit/hook/base.rb#177
|
1267
|
+
def select_applicable(list); end
|
1268
|
+
|
1269
|
+
# Transforms the hook's status based on custom configuration.
|
1270
|
+
#
|
1271
|
+
# This allows users to change failures into warnings, or vice versa.
|
1272
|
+
#
|
1273
|
+
# source://overcommit//lib/overcommit/hook/base.rb#273
|
1274
|
+
def transform_status(status); end
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
# Possible types of messages.
|
1278
|
+
#
|
1279
|
+
# source://overcommit//lib/overcommit/hook/base.rb#16
|
1280
|
+
Overcommit::Hook::MESSAGE_TYPES = T.let(T.unsafe(nil), Array)
|
1281
|
+
|
1282
|
+
# Helper containing metadata about error/warning messages returned by hooks.
|
1283
|
+
#
|
1284
|
+
# source://overcommit//lib/overcommit/hook/base.rb#9
|
1285
|
+
class Overcommit::Hook::Message < ::Struct
|
1286
|
+
# Returns the value of attribute content
|
1287
|
+
#
|
1288
|
+
# @return [Object] the current value of content
|
1289
|
+
def content; end
|
1290
|
+
|
1291
|
+
# Sets the attribute content
|
1292
|
+
#
|
1293
|
+
# @param value [Object] the value to set the attribute content to.
|
1294
|
+
# @return [Object] the newly set value
|
1295
|
+
def content=(_); end
|
1296
|
+
|
1297
|
+
# Returns the value of attribute file
|
1298
|
+
#
|
1299
|
+
# @return [Object] the current value of file
|
1300
|
+
def file; end
|
1301
|
+
|
1302
|
+
# Sets the attribute file
|
1303
|
+
#
|
1304
|
+
# @param value [Object] the value to set the attribute file to.
|
1305
|
+
# @return [Object] the newly set value
|
1306
|
+
def file=(_); end
|
1307
|
+
|
1308
|
+
# Returns the value of attribute line
|
1309
|
+
#
|
1310
|
+
# @return [Object] the current value of line
|
1311
|
+
def line; end
|
1312
|
+
|
1313
|
+
# Sets the attribute line
|
1314
|
+
#
|
1315
|
+
# @param value [Object] the value to set the attribute line to.
|
1316
|
+
# @return [Object] the newly set value
|
1317
|
+
def line=(_); end
|
1318
|
+
|
1319
|
+
# source://overcommit//lib/overcommit/hook/base.rb#10
|
1320
|
+
def to_s; end
|
1321
|
+
|
1322
|
+
# Returns the value of attribute type
|
1323
|
+
#
|
1324
|
+
# @return [Object] the current value of type
|
1325
|
+
def type; end
|
1326
|
+
|
1327
|
+
# Sets the attribute type
|
1328
|
+
#
|
1329
|
+
# @param value [Object] the value to set the attribute type to.
|
1330
|
+
# @return [Object] the newly set value
|
1331
|
+
def type=(_); end
|
1332
|
+
|
1333
|
+
class << self
|
1334
|
+
def [](*_arg0); end
|
1335
|
+
def inspect; end
|
1336
|
+
def keyword_init?; end
|
1337
|
+
def members; end
|
1338
|
+
def new(*_arg0); end
|
1339
|
+
end
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
# Utility module which manages the creation of {HookContext}s.
|
1343
|
+
#
|
1344
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#3
|
1345
|
+
module Overcommit::HookContext
|
1346
|
+
class << self
|
1347
|
+
# source://overcommit//lib/overcommit/hook_context.rb#5
|
1348
|
+
def create(hook_type, config, args, input); end
|
1349
|
+
end
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
# Contains helpers related to the context with which a hook is being run.
|
1353
|
+
#
|
1354
|
+
# It acts as an adapter to the arguments passed to the hook, as well as
|
1355
|
+
# context-specific information such as staged files, providing a single source
|
1356
|
+
# of truth for this context.
|
1357
|
+
#
|
1358
|
+
# This is also important to house in a separate object so that any
|
1359
|
+
# calculations can be memoized across all hooks in a single object, which
|
1360
|
+
# helps with performance.
|
1361
|
+
#
|
1362
|
+
# @abstract
|
1363
|
+
#
|
1364
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#15
|
1365
|
+
class Overcommit::HookContext::Base
|
1366
|
+
# Creates a hook context from the given configuration and input options.
|
1367
|
+
#
|
1368
|
+
# @param config [Overcommit::Configuration]
|
1369
|
+
# @param args [Array<String>]
|
1370
|
+
# @param input [IO] standard input stream
|
1371
|
+
# @return [Base] a new instance of Base
|
1372
|
+
#
|
1373
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#21
|
1374
|
+
def initialize(config, args, input); end
|
1375
|
+
|
1376
|
+
# Returns the full list of files tracked by git
|
1377
|
+
#
|
1378
|
+
# @return [Array<String>]
|
1379
|
+
#
|
1380
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#87
|
1381
|
+
def all_files; end
|
1382
|
+
|
1383
|
+
# Resets the environment to an appropriate state.
|
1384
|
+
#
|
1385
|
+
# This is called after the hooks have been run by the [HookRunner].
|
1386
|
+
# Different hook types can perform different cleanup operations, which are
|
1387
|
+
# intended to "undo" the results of the call to {#setup_environment}.
|
1388
|
+
#
|
1389
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#70
|
1390
|
+
def cleanup_environment; end
|
1391
|
+
|
1392
|
+
# Executes a command as if it were a regular git hook, passing all
|
1393
|
+
# command-line arguments and the standard input stream.
|
1394
|
+
#
|
1395
|
+
# This is intended to be used by ad hoc hooks so developers can link up
|
1396
|
+
# their existing git hooks with Overcommit.
|
1397
|
+
#
|
1398
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#32
|
1399
|
+
def execute_hook(command); end
|
1400
|
+
|
1401
|
+
# Returns the camel-cased type of this hook (e.g. PreCommit)
|
1402
|
+
#
|
1403
|
+
# @return [String]
|
1404
|
+
#
|
1405
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#39
|
1406
|
+
def hook_class_name; end
|
1407
|
+
|
1408
|
+
# Returns the actual name of the hook script being run (e.g. pre-commit).
|
1409
|
+
#
|
1410
|
+
# @return [String]
|
1411
|
+
#
|
1412
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#53
|
1413
|
+
def hook_script_name; end
|
1414
|
+
|
1415
|
+
# Returns the snake-cased type of this hook (e.g. pre_commit)
|
1416
|
+
#
|
1417
|
+
# @return [String]
|
1418
|
+
#
|
1419
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#46
|
1420
|
+
def hook_type_name; end
|
1421
|
+
|
1422
|
+
# Returns an array of lines passed to the hook via the standard input
|
1423
|
+
# stream.
|
1424
|
+
#
|
1425
|
+
# @return [Array<String>]
|
1426
|
+
#
|
1427
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#103
|
1428
|
+
def input_lines; end
|
1429
|
+
|
1430
|
+
# Returns the contents of the entire standard input stream that were passed
|
1431
|
+
# to the hook.
|
1432
|
+
#
|
1433
|
+
# @return [String]
|
1434
|
+
#
|
1435
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#95
|
1436
|
+
def input_string; end
|
1437
|
+
|
1438
|
+
# Returns a list of files that have been modified.
|
1439
|
+
#
|
1440
|
+
# By default, this returns an empty list. Subclasses should implement if
|
1441
|
+
# there is a concept of files changing for the type of hook being run.
|
1442
|
+
#
|
1443
|
+
# @return [Array<String>]
|
1444
|
+
#
|
1445
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#80
|
1446
|
+
def modified_files; end
|
1447
|
+
|
1448
|
+
# Returns a message to display on failure.
|
1449
|
+
#
|
1450
|
+
# @return [String]
|
1451
|
+
#
|
1452
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#110
|
1453
|
+
def post_fail_message; end
|
1454
|
+
|
1455
|
+
# Initializes anything related to the environment.
|
1456
|
+
#
|
1457
|
+
# This is called before the hooks are run by the [HookRunner]. Different
|
1458
|
+
# hook types can perform different setup.
|
1459
|
+
#
|
1460
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#61
|
1461
|
+
def setup_environment; end
|
1462
|
+
|
1463
|
+
private
|
1464
|
+
|
1465
|
+
# Filter out directories. This could happen when changing a symlink to a
|
1466
|
+
# directory as part of an amendment, since the symlink will still appear as
|
1467
|
+
# a file, but the actual working tree will have a directory.
|
1468
|
+
#
|
1469
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#133
|
1470
|
+
def filter_directories(modified_files); end
|
1471
|
+
|
1472
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#116
|
1473
|
+
def filter_modified_files(modified_files); end
|
1474
|
+
|
1475
|
+
# Filter out non-existent files (unless it's a broken symlink, in which case
|
1476
|
+
# it's a file that points to a non-existent file). This could happen if a
|
1477
|
+
# file was renamed as part of an amendment, leading to the old file no
|
1478
|
+
# longer existing.
|
1479
|
+
#
|
1480
|
+
# source://overcommit//lib/overcommit/hook_context/base.rb#124
|
1481
|
+
def filter_nonexistent(modified_files); end
|
1482
|
+
end
|
1483
|
+
|
1484
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#3
|
1485
|
+
module Overcommit::HookLoader; end
|
1486
|
+
|
1487
|
+
# Responsible for loading hooks from a file.
|
1488
|
+
#
|
1489
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#5
|
1490
|
+
class Overcommit::HookLoader::Base
|
1491
|
+
# @param config [Overcommit::Configuration]
|
1492
|
+
# @param context [Overcommit::HookContext]
|
1493
|
+
# @param logger [Overcommit::Logger]
|
1494
|
+
# @return [Base] a new instance of Base
|
1495
|
+
#
|
1496
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#9
|
1497
|
+
def initialize(config, context, logger); end
|
1498
|
+
|
1499
|
+
# When implemented in subclasses, loads the hooks for which that subclass is
|
1500
|
+
# responsible.
|
1501
|
+
#
|
1502
|
+
# @raise [NotImplementedError]
|
1503
|
+
# @return [Array<Hook>]
|
1504
|
+
#
|
1505
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#19
|
1506
|
+
def load_hooks; end
|
1507
|
+
|
1508
|
+
private
|
1509
|
+
|
1510
|
+
# Load and return a {Hook} from a CamelCase hook name.
|
1511
|
+
#
|
1512
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#28
|
1513
|
+
def create_hook(hook_name); end
|
1514
|
+
|
1515
|
+
# Returns the value of attribute log.
|
1516
|
+
#
|
1517
|
+
# source://overcommit//lib/overcommit/hook_loader/base.rb#25
|
1518
|
+
def log; end
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
# Responsible for loading hooks that ship with Overcommit.
|
1522
|
+
#
|
1523
|
+
# source://overcommit//lib/overcommit/hook_loader/built_in_hook_loader.rb#5
|
1524
|
+
class Overcommit::HookLoader::BuiltInHookLoader < ::Overcommit::HookLoader::Base
|
1525
|
+
# source://overcommit//lib/overcommit/hook_loader/built_in_hook_loader.rb#6
|
1526
|
+
def load_hooks; end
|
1527
|
+
end
|
1528
|
+
|
1529
|
+
# Responsible for loading hooks that are specific to the repository Overcommit
|
1530
|
+
# is running in.
|
1531
|
+
#
|
1532
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#8
|
1533
|
+
class Overcommit::HookLoader::PluginHookLoader < ::Overcommit::HookLoader::Base
|
1534
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#9
|
1535
|
+
def load_hooks; end
|
1536
|
+
|
1537
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#24
|
1538
|
+
def update_signatures; end
|
1539
|
+
|
1540
|
+
private
|
1541
|
+
|
1542
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#46
|
1543
|
+
def ad_hoc_hook_names; end
|
1544
|
+
|
1545
|
+
# @raise [Overcommit::Exceptions::InvalidHookSignature]
|
1546
|
+
#
|
1547
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#56
|
1548
|
+
def check_for_modified_plugins; end
|
1549
|
+
|
1550
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#77
|
1551
|
+
def create_ad_hoc_hook(hook_name); end
|
1552
|
+
|
1553
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#50
|
1554
|
+
def modified_plugins; end
|
1555
|
+
|
1556
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#40
|
1557
|
+
def plugin_hook_names; end
|
1558
|
+
|
1559
|
+
# source://overcommit//lib/overcommit/hook_loader/plugin_hook_loader.rb#35
|
1560
|
+
def plugin_paths; end
|
1561
|
+
end
|
1562
|
+
|
1563
|
+
# Responsible for loading the hooks the repository has configured and running
|
1564
|
+
# them, collecting and displaying the results.
|
1565
|
+
#
|
1566
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#6
|
1567
|
+
class Overcommit::HookRunner
|
1568
|
+
# @param config [Overcommit::Configuration]
|
1569
|
+
# @param logger [Overcommit::Logger]
|
1570
|
+
# @param context [Overcommit::HookContext]
|
1571
|
+
# @param printer [Overcommit::Printer]
|
1572
|
+
# @return [HookRunner] a new instance of HookRunner
|
1573
|
+
#
|
1574
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#11
|
1575
|
+
def initialize(config, logger, context, printer); end
|
1576
|
+
|
1577
|
+
# Loads and runs the hooks registered for this {HookRunner}.
|
1578
|
+
#
|
1579
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#24
|
1580
|
+
def run; end
|
1581
|
+
|
1582
|
+
private
|
1583
|
+
|
1584
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#93
|
1585
|
+
def consume; end
|
1586
|
+
|
1587
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#199
|
1588
|
+
def load_hooks; end
|
1589
|
+
|
1590
|
+
# Returns the value of attribute log.
|
1591
|
+
#
|
1592
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#54
|
1593
|
+
def log; end
|
1594
|
+
|
1595
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#143
|
1596
|
+
def print_results; end
|
1597
|
+
|
1598
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#139
|
1599
|
+
def processors_for_hook(hook); end
|
1600
|
+
|
1601
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#128
|
1602
|
+
def release_slot(hook); end
|
1603
|
+
|
1604
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#155
|
1605
|
+
def run_hook(hook); end
|
1606
|
+
|
1607
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#56
|
1608
|
+
def run_hooks; end
|
1609
|
+
|
1610
|
+
# @return [Boolean]
|
1611
|
+
#
|
1612
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#183
|
1613
|
+
def should_skip?(hook); end
|
1614
|
+
|
1615
|
+
# source://overcommit//lib/overcommit/hook_runner.rb#102
|
1616
|
+
def wait_for_slot(hook); end
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
# Calculates, stores, and retrieves stored signatures of hook plugins.
|
1620
|
+
#
|
1621
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#5
|
1622
|
+
class Overcommit::HookSigner
|
1623
|
+
# @param hook_name [String] name of the hook
|
1624
|
+
# @param config [Overcommit::Configuration]
|
1625
|
+
# @param context [Overcommit::HookContext]
|
1626
|
+
# @return [HookSigner] a new instance of HookSigner
|
1627
|
+
#
|
1628
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#15
|
1629
|
+
def initialize(hook_name, config, context); end
|
1630
|
+
|
1631
|
+
# Returns the value of attribute hook_name.
|
1632
|
+
#
|
1633
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#6
|
1634
|
+
def hook_name; end
|
1635
|
+
|
1636
|
+
# Returns the path of the file that should be incorporated into this hooks
|
1637
|
+
# signature.
|
1638
|
+
#
|
1639
|
+
# @return [String]
|
1640
|
+
#
|
1641
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#25
|
1642
|
+
def hook_path; end
|
1643
|
+
|
1644
|
+
# @return [Boolean]
|
1645
|
+
#
|
1646
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#53
|
1647
|
+
def signable_file?(file); end
|
1648
|
+
|
1649
|
+
# Return whether the signature for this hook has changed since it was last
|
1650
|
+
# calculated.
|
1651
|
+
#
|
1652
|
+
# @return [true, false]
|
1653
|
+
#
|
1654
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#65
|
1655
|
+
def signature_changed?; end
|
1656
|
+
|
1657
|
+
# Update the current stored signature for this hook.
|
1658
|
+
#
|
1659
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#70
|
1660
|
+
def update_signature!; end
|
1661
|
+
|
1662
|
+
private
|
1663
|
+
|
1664
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#101
|
1665
|
+
def hook_contents; end
|
1666
|
+
|
1667
|
+
# Calculates a hash of a hook using a combination of its configuration and
|
1668
|
+
# file contents.
|
1669
|
+
#
|
1670
|
+
# This way, if either the plugin code changes or its configuration changes,
|
1671
|
+
# the hash will change and we can alert the user to this change.
|
1672
|
+
#
|
1673
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#88
|
1674
|
+
def signature; end
|
1675
|
+
|
1676
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#120
|
1677
|
+
def signature_config_key; end
|
1678
|
+
|
1679
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#105
|
1680
|
+
def stored_signature; end
|
1681
|
+
end
|
1682
|
+
|
1683
|
+
# We don't want to include the skip setting as it is set by Overcommit
|
1684
|
+
# itself
|
1685
|
+
#
|
1686
|
+
# source://overcommit//lib/overcommit/hook_signer.rb#10
|
1687
|
+
Overcommit::HookSigner::IGNORED_CONFIG_KEYS = T.let(T.unsafe(nil), Array)
|
1688
|
+
|
1689
|
+
# Manages the installation of Overcommit hooks in a git repository.
|
1690
|
+
#
|
1691
|
+
# source://overcommit//lib/overcommit/installer.rb#7
|
1692
|
+
class Overcommit::Installer
|
1693
|
+
# @return [Installer] a new instance of Installer
|
1694
|
+
#
|
1695
|
+
# source://overcommit//lib/overcommit/installer.rb#11
|
1696
|
+
def initialize(logger); end
|
1697
|
+
|
1698
|
+
# source://overcommit//lib/overcommit/installer.rb#15
|
1699
|
+
def run(target, options); end
|
1700
|
+
|
1701
|
+
private
|
1702
|
+
|
1703
|
+
# @return [Boolean]
|
1704
|
+
#
|
1705
|
+
# source://overcommit//lib/overcommit/installer.rb#125
|
1706
|
+
def can_replace_file?(file); end
|
1707
|
+
|
1708
|
+
# Returns the configuration for this repository.
|
1709
|
+
#
|
1710
|
+
# source://overcommit//lib/overcommit/installer.rb#190
|
1711
|
+
def config(options = T.unsafe(nil)); end
|
1712
|
+
|
1713
|
+
# source://overcommit//lib/overcommit/installer.rb#81
|
1714
|
+
def ensure_directory(path); end
|
1715
|
+
|
1716
|
+
# source://overcommit//lib/overcommit/installer.rb#69
|
1717
|
+
def hooks_path; end
|
1718
|
+
|
1719
|
+
# source://overcommit//lib/overcommit/installer.rb#32
|
1720
|
+
def install; end
|
1721
|
+
|
1722
|
+
# source://overcommit//lib/overcommit/installer.rb#110
|
1723
|
+
def install_hook_files; end
|
1724
|
+
|
1725
|
+
# source://overcommit//lib/overcommit/installer.rb#101
|
1726
|
+
def install_master_hook; end
|
1727
|
+
|
1728
|
+
# source://overcommit//lib/overcommit/installer.rb#173
|
1729
|
+
def install_starter_config; end
|
1730
|
+
|
1731
|
+
# Returns the value of attribute log.
|
1732
|
+
#
|
1733
|
+
# source://overcommit//lib/overcommit/installer.rb#30
|
1734
|
+
def log; end
|
1735
|
+
|
1736
|
+
# source://overcommit//lib/overcommit/installer.rb#77
|
1737
|
+
def master_hook_install_path; end
|
1738
|
+
|
1739
|
+
# source://overcommit//lib/overcommit/installer.rb#73
|
1740
|
+
def old_hooks_path; end
|
1741
|
+
|
1742
|
+
# @return [Boolean]
|
1743
|
+
#
|
1744
|
+
# source://overcommit//lib/overcommit/installer.rb#181
|
1745
|
+
def overcommit_hook?(file); end
|
1746
|
+
|
1747
|
+
# source://overcommit//lib/overcommit/installer.rb#131
|
1748
|
+
def preserve_old_hooks; end
|
1749
|
+
|
1750
|
+
# source://overcommit//lib/overcommit/installer.rb#147
|
1751
|
+
def restore_old_hooks; end
|
1752
|
+
|
1753
|
+
# source://overcommit//lib/overcommit/installer.rb#47
|
1754
|
+
def uninstall; end
|
1755
|
+
|
1756
|
+
# source://overcommit//lib/overcommit/installer.rb#163
|
1757
|
+
def uninstall_hook_files; end
|
1758
|
+
|
1759
|
+
# source://overcommit//lib/overcommit/installer.rb#106
|
1760
|
+
def uninstall_master_hook; end
|
1761
|
+
|
1762
|
+
# @return [true, false] whether the hooks were updated
|
1763
|
+
#
|
1764
|
+
# source://overcommit//lib/overcommit/installer.rb#58
|
1765
|
+
def update; end
|
1766
|
+
|
1767
|
+
# source://overcommit//lib/overcommit/installer.rb#85
|
1768
|
+
def validate_target; end
|
1769
|
+
end
|
1770
|
+
|
1771
|
+
# source://overcommit//lib/overcommit/installer.rb#9
|
1772
|
+
Overcommit::Installer::MASTER_HOOK = T.let(T.unsafe(nil), String)
|
1773
|
+
|
1774
|
+
# source://overcommit//lib/overcommit/installer.rb#8
|
1775
|
+
Overcommit::Installer::TEMPLATE_DIRECTORY = T.let(T.unsafe(nil), String)
|
1776
|
+
|
1777
|
+
# source://overcommit//lib/overcommit/constants.rb#7
|
1778
|
+
Overcommit::LOCAL_CONFIG_FILE_NAME = T.let(T.unsafe(nil), String)
|
1779
|
+
|
1780
|
+
# Encapsulates all communication to an output source.
|
1781
|
+
#
|
1782
|
+
# source://overcommit//lib/overcommit/logger.rb#5
|
1783
|
+
class Overcommit::Logger
|
1784
|
+
# Creates a logger that will write to the given output stream.
|
1785
|
+
#
|
1786
|
+
# @param out [IO]
|
1787
|
+
# @return [Logger] a new instance of Logger
|
1788
|
+
#
|
1789
|
+
# source://overcommit//lib/overcommit/logger.rb#14
|
1790
|
+
def initialize(out); end
|
1791
|
+
|
1792
|
+
# Write a line of output that is intended to be emphasized.
|
1793
|
+
#
|
1794
|
+
# source://overcommit//lib/overcommit/logger.rb#52
|
1795
|
+
def bold(*args); end
|
1796
|
+
|
1797
|
+
# Write a line of output indicating a problem or error which is emphasized
|
1798
|
+
# over a regular problem or error.
|
1799
|
+
#
|
1800
|
+
# source://overcommit//lib/overcommit/logger.rb#63
|
1801
|
+
def bold_error(*args); end
|
1802
|
+
|
1803
|
+
# Write a line of output indicating a potential cause for concern, but with
|
1804
|
+
# greater emphasize compared to other warnings.
|
1805
|
+
#
|
1806
|
+
# source://overcommit//lib/overcommit/logger.rb#80
|
1807
|
+
def bold_warning(*args); end
|
1808
|
+
|
1809
|
+
# Write a line of output if debug mode is enabled.
|
1810
|
+
#
|
1811
|
+
# source://overcommit//lib/overcommit/logger.rb#47
|
1812
|
+
def debug(*args); end
|
1813
|
+
|
1814
|
+
# Write a line of output indicating a problem or error.
|
1815
|
+
#
|
1816
|
+
# source://overcommit//lib/overcommit/logger.rb#57
|
1817
|
+
def error(*args); end
|
1818
|
+
|
1819
|
+
# Flushes the [IO] object for partial lines
|
1820
|
+
#
|
1821
|
+
# source://overcommit//lib/overcommit/logger.rb#35
|
1822
|
+
def flush; end
|
1823
|
+
|
1824
|
+
# Write a line of output.
|
1825
|
+
#
|
1826
|
+
# A newline character will always be appended.
|
1827
|
+
#
|
1828
|
+
# source://overcommit//lib/overcommit/logger.rb#42
|
1829
|
+
def log(*args); end
|
1830
|
+
|
1831
|
+
# Prints a newline character (alias for readability).
|
1832
|
+
#
|
1833
|
+
# source://overcommit//lib/overcommit/logger.rb#30
|
1834
|
+
def newline; end
|
1835
|
+
|
1836
|
+
# Write output without a trailing newline.
|
1837
|
+
#
|
1838
|
+
# source://overcommit//lib/overcommit/logger.rb#25
|
1839
|
+
def partial(*args); end
|
1840
|
+
|
1841
|
+
# Write a line of output indicating a successful or noteworthy event.
|
1842
|
+
#
|
1843
|
+
# source://overcommit//lib/overcommit/logger.rb#68
|
1844
|
+
def success(*args); end
|
1845
|
+
|
1846
|
+
# Write a line of output indicating a potential cause for concern, but not
|
1847
|
+
# an actual error.
|
1848
|
+
#
|
1849
|
+
# source://overcommit//lib/overcommit/logger.rb#74
|
1850
|
+
def warning(*args); end
|
1851
|
+
|
1852
|
+
private
|
1853
|
+
|
1854
|
+
# Outputs text wrapped in ANSI escape code necessary to produce a given
|
1855
|
+
# color/text display.
|
1856
|
+
#
|
1857
|
+
# @param code [String] ANSI escape code, e.g. '1;33' for "bold yellow"
|
1858
|
+
# @param str [String] string to wrap
|
1859
|
+
# @param partial [true, false] whether to omit a newline
|
1860
|
+
#
|
1861
|
+
# source://overcommit//lib/overcommit/logger.rb#92
|
1862
|
+
def color(code, str, partial = T.unsafe(nil)); end
|
1863
|
+
|
1864
|
+
class << self
|
1865
|
+
# Helper for creating a logger which outputs nothing.
|
1866
|
+
#
|
1867
|
+
# source://overcommit//lib/overcommit/logger.rb#7
|
1868
|
+
def silent; end
|
1869
|
+
end
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
# Utility class that encapsulates the handling of hook messages and whether
|
1873
|
+
# they affect lines the user has modified or not.
|
1874
|
+
#
|
1875
|
+
# This class exposes an endpoint that extracts an appropriate hook/status
|
1876
|
+
# output tuple from an array of {Overcommit::Hook::Message}s, respecting the
|
1877
|
+
# configuration settings for the given hook.
|
1878
|
+
#
|
1879
|
+
# source://overcommit//lib/overcommit/message_processor.rb#10
|
1880
|
+
class Overcommit::MessageProcessor
|
1881
|
+
# @param hook [Overcommit::Hook::Base]
|
1882
|
+
# @param unmodified_lines_setting [String] how to treat messages on
|
1883
|
+
# unmodified lines
|
1884
|
+
# @return [MessageProcessor] a new instance of MessageProcessor
|
1885
|
+
#
|
1886
|
+
# source://overcommit//lib/overcommit/message_processor.rb#21
|
1887
|
+
def initialize(hook, unmodified_lines_setting); end
|
1888
|
+
|
1889
|
+
# Returns a hook status/output tuple from the messages this processor was
|
1890
|
+
# initialized with.
|
1891
|
+
#
|
1892
|
+
# @return [Array<Symbol,String>]
|
1893
|
+
#
|
1894
|
+
# source://overcommit//lib/overcommit/message_processor.rb#30
|
1895
|
+
def hook_result(messages); end
|
1896
|
+
|
1897
|
+
private
|
1898
|
+
|
1899
|
+
# Returns status and output for messages assuming no special treatment of
|
1900
|
+
# messages occurring on unmodified lines.
|
1901
|
+
#
|
1902
|
+
# source://overcommit//lib/overcommit/message_processor.rb#101
|
1903
|
+
def basic_status_and_output(messages); end
|
1904
|
+
|
1905
|
+
# @return [Boolean]
|
1906
|
+
#
|
1907
|
+
# source://overcommit//lib/overcommit/message_processor.rb#95
|
1908
|
+
def can_upgrade_to_passing?(status, warning_messages); end
|
1909
|
+
|
1910
|
+
# @return [Boolean]
|
1911
|
+
#
|
1912
|
+
# source://overcommit//lib/overcommit/message_processor.rb#91
|
1913
|
+
def can_upgrade_to_warning?(status, error_messages); end
|
1914
|
+
|
1915
|
+
# source://overcommit//lib/overcommit/message_processor.rb#44
|
1916
|
+
def handle_modified_lines(messages, status); end
|
1917
|
+
|
1918
|
+
# @return [Boolean]
|
1919
|
+
#
|
1920
|
+
# source://overcommit//lib/overcommit/message_processor.rb#141
|
1921
|
+
def message_on_modified_line?(message); end
|
1922
|
+
|
1923
|
+
# source://overcommit//lib/overcommit/message_processor.rb#119
|
1924
|
+
def print_messages(messages, error_heading, warning_heading); end
|
1925
|
+
|
1926
|
+
# source://overcommit//lib/overcommit/message_processor.rb#134
|
1927
|
+
def remove_ignored_messages(messages); end
|
1928
|
+
|
1929
|
+
# source://overcommit//lib/overcommit/message_processor.rb#73
|
1930
|
+
def transform_status(status, messages_on_modified_lines); end
|
1931
|
+
end
|
1932
|
+
|
1933
|
+
# source://overcommit//lib/overcommit/message_processor.rb#15
|
1934
|
+
Overcommit::MessageProcessor::ERRORS_GENERIC_HEADER = T.let(T.unsafe(nil), String)
|
1935
|
+
|
1936
|
+
# source://overcommit//lib/overcommit/message_processor.rb#11
|
1937
|
+
Overcommit::MessageProcessor::ERRORS_MODIFIED_HEADER = T.let(T.unsafe(nil), String)
|
1938
|
+
|
1939
|
+
# source://overcommit//lib/overcommit/message_processor.rb#13
|
1940
|
+
Overcommit::MessageProcessor::ERRORS_UNMODIFIED_HEADER = T.let(T.unsafe(nil), String)
|
1941
|
+
|
1942
|
+
# source://overcommit//lib/overcommit/message_processor.rb#16
|
1943
|
+
Overcommit::MessageProcessor::WARNINGS_GENERIC_HEADER = T.let(T.unsafe(nil), String)
|
1944
|
+
|
1945
|
+
# source://overcommit//lib/overcommit/message_processor.rb#12
|
1946
|
+
Overcommit::MessageProcessor::WARNINGS_MODIFIED_HEADER = T.let(T.unsafe(nil), String)
|
1947
|
+
|
1948
|
+
# source://overcommit//lib/overcommit/message_processor.rb#14
|
1949
|
+
Overcommit::MessageProcessor::WARNINGS_UNMODIFIED_HEADER = T.let(T.unsafe(nil), String)
|
1950
|
+
|
1951
|
+
# Methods relating to the current operating system
|
1952
|
+
#
|
1953
|
+
# source://overcommit//lib/overcommit/os.rb#7
|
1954
|
+
module Overcommit::OS
|
1955
|
+
class << self
|
1956
|
+
# @return [Boolean]
|
1957
|
+
#
|
1958
|
+
# source://overcommit//lib/overcommit/os.rb#13
|
1959
|
+
def cygwin?; end
|
1960
|
+
|
1961
|
+
# @return [Boolean]
|
1962
|
+
#
|
1963
|
+
# source://overcommit//lib/overcommit/os.rb#25
|
1964
|
+
def linux?; end
|
1965
|
+
|
1966
|
+
# @return [Boolean]
|
1967
|
+
#
|
1968
|
+
# source://overcommit//lib/overcommit/os.rb#17
|
1969
|
+
def mac?; end
|
1970
|
+
|
1971
|
+
# @return [Boolean]
|
1972
|
+
#
|
1973
|
+
# source://overcommit//lib/overcommit/os.rb#21
|
1974
|
+
def unix?; end
|
1975
|
+
|
1976
|
+
# @return [Boolean]
|
1977
|
+
#
|
1978
|
+
# source://overcommit//lib/overcommit/os.rb#9
|
1979
|
+
def windows?; end
|
1980
|
+
|
1981
|
+
private
|
1982
|
+
|
1983
|
+
# source://overcommit//lib/overcommit/os.rb#31
|
1984
|
+
def host_os; end
|
1985
|
+
end
|
1986
|
+
end
|
1987
|
+
|
1988
|
+
# source://overcommit//lib/overcommit/os.rb#36
|
1989
|
+
Overcommit::OS::SEPARATOR = T.let(T.unsafe(nil), String)
|
1990
|
+
|
1991
|
+
# Provide a set of callbacks which can be executed as events occur during the
|
1992
|
+
# course of {HookRunner#run}.
|
1993
|
+
#
|
1994
|
+
# source://overcommit//lib/overcommit/printer.rb#8
|
1995
|
+
class Overcommit::Printer
|
1996
|
+
# @return [Printer] a new instance of Printer
|
1997
|
+
#
|
1998
|
+
# source://overcommit//lib/overcommit/printer.rb#11
|
1999
|
+
def initialize(config, logger, context); end
|
2000
|
+
|
2001
|
+
# Executed at the end of an individual hook run.
|
2002
|
+
#
|
2003
|
+
# source://overcommit//lib/overcommit/printer.rb#37
|
2004
|
+
def end_hook(hook, status, output); end
|
2005
|
+
|
2006
|
+
# source://overcommit//lib/overcommit/printer.rb#79
|
2007
|
+
def hook_run_failed(message); end
|
2008
|
+
|
2009
|
+
# source://overcommit//lib/overcommit/printer.rb#28
|
2010
|
+
def hook_skipped(hook); end
|
2011
|
+
|
2012
|
+
# source://overcommit//lib/overcommit/printer.rb#45
|
2013
|
+
def interrupt_triggered; end
|
2014
|
+
|
2015
|
+
# Returns the value of attribute log.
|
2016
|
+
#
|
2017
|
+
# source://overcommit//lib/overcommit/printer.rb#9
|
2018
|
+
def log; end
|
2019
|
+
|
2020
|
+
# source://overcommit//lib/overcommit/printer.rb#24
|
2021
|
+
def nothing_to_run; end
|
2022
|
+
|
2023
|
+
# source://overcommit//lib/overcommit/printer.rb#32
|
2024
|
+
def required_hook_not_skipped(hook); end
|
2025
|
+
|
2026
|
+
# Executed when one or more hooks by the end of the run.
|
2027
|
+
#
|
2028
|
+
# source://overcommit//lib/overcommit/printer.rb#57
|
2029
|
+
def run_failed; end
|
2030
|
+
|
2031
|
+
# Executed when a hook run was interrupted/cancelled by user.
|
2032
|
+
#
|
2033
|
+
# source://overcommit//lib/overcommit/printer.rb#50
|
2034
|
+
def run_interrupted; end
|
2035
|
+
|
2036
|
+
# Executed when no hooks failed by the end of the run.
|
2037
|
+
#
|
2038
|
+
# source://overcommit//lib/overcommit/printer.rb#71
|
2039
|
+
def run_succeeded; end
|
2040
|
+
|
2041
|
+
# Executed when no hooks failed by the end of the run, but some warned.
|
2042
|
+
#
|
2043
|
+
# source://overcommit//lib/overcommit/printer.rb#64
|
2044
|
+
def run_warned; end
|
2045
|
+
|
2046
|
+
# Executed at the very beginning of running the collection of hooks.
|
2047
|
+
#
|
2048
|
+
# source://overcommit//lib/overcommit/printer.rb#20
|
2049
|
+
def start_run; end
|
2050
|
+
|
2051
|
+
private
|
2052
|
+
|
2053
|
+
# source://overcommit//lib/overcommit/printer.rb#119
|
2054
|
+
def hook_script_name; end
|
2055
|
+
|
2056
|
+
# source://overcommit//lib/overcommit/printer.rb#87
|
2057
|
+
def print_header(hook); end
|
2058
|
+
|
2059
|
+
# source://overcommit//lib/overcommit/printer.rb#115
|
2060
|
+
def print_report(output, format = T.unsafe(nil)); end
|
2061
|
+
|
2062
|
+
# source://overcommit//lib/overcommit/printer.rb#95
|
2063
|
+
def print_result(hook, status, output); end
|
2064
|
+
|
2065
|
+
# Get all public methods that were defined on this class and wrap them with
|
2066
|
+
# synchronization locks so we ensure the output isn't interleaved amongst
|
2067
|
+
# the various threads.
|
2068
|
+
#
|
2069
|
+
# source://overcommit//lib/overcommit/printer.rb#126
|
2070
|
+
def synchronize_all_methods; end
|
2071
|
+
end
|
2072
|
+
|
2073
|
+
# source://overcommit//lib/overcommit/constants.rb#11
|
2074
|
+
Overcommit::REPO_URL = T.let(T.unsafe(nil), String)
|
2075
|
+
|
2076
|
+
# Manages execution of a child process, collecting the exit status and
|
2077
|
+
# standard out/error output.
|
2078
|
+
#
|
2079
|
+
# source://overcommit//lib/overcommit/subprocess.rb#10
|
2080
|
+
class Overcommit::Subprocess
|
2081
|
+
class << self
|
2082
|
+
# Spawns a new process using the given array of arguments (the first
|
2083
|
+
# element is the command).
|
2084
|
+
#
|
2085
|
+
# @option options
|
2086
|
+
# @param args [Array<String>]
|
2087
|
+
# @param options [Hash]
|
2088
|
+
# @return [Result]
|
2089
|
+
#
|
2090
|
+
# source://overcommit//lib/overcommit/subprocess.rb#30
|
2091
|
+
def spawn(args, options = T.unsafe(nil)); end
|
2092
|
+
|
2093
|
+
# Spawns a new process in the background using the given array of
|
2094
|
+
# arguments (the first element is the command).
|
2095
|
+
#
|
2096
|
+
# source://overcommit//lib/overcommit/subprocess.rb#60
|
2097
|
+
def spawn_detached(args); end
|
2098
|
+
|
2099
|
+
private
|
2100
|
+
|
2101
|
+
# @param process [ChildProcess]
|
2102
|
+
# @return [Array<IO>]
|
2103
|
+
#
|
2104
|
+
# source://overcommit//lib/overcommit/subprocess.rb#89
|
2105
|
+
def assign_output_streams(process); end
|
2106
|
+
|
2107
|
+
# Necessary to run commands in the cmd.exe context.
|
2108
|
+
# Args are joined to properly handle quotes and special characters.
|
2109
|
+
#
|
2110
|
+
# source://overcommit//lib/overcommit/subprocess.rb#75
|
2111
|
+
def win32_prepare_args(args); end
|
2112
|
+
end
|
2113
|
+
end
|
2114
|
+
|
2115
|
+
# Encapsulates the result of a process.
|
2116
|
+
#
|
2117
|
+
# @attr_reader status [Integer] exit status code returned by process
|
2118
|
+
# @attr_reader stdout [String] standard output stream output
|
2119
|
+
# @attr_reader stderr [String] standard error stream output
|
2120
|
+
#
|
2121
|
+
# source://overcommit//lib/overcommit/subprocess.rb#16
|
2122
|
+
class Overcommit::Subprocess::Result < ::Struct
|
2123
|
+
# exit status code returned by process
|
2124
|
+
#
|
2125
|
+
# @return [Integer] the current value of status
|
2126
|
+
def status; end
|
2127
|
+
|
2128
|
+
def status=(_); end
|
2129
|
+
|
2130
|
+
# standard error stream output
|
2131
|
+
#
|
2132
|
+
# @return [String] the current value of stderr
|
2133
|
+
def stderr; end
|
2134
|
+
|
2135
|
+
def stderr=(_); end
|
2136
|
+
|
2137
|
+
# standard output stream output
|
2138
|
+
#
|
2139
|
+
# @return [String] the current value of stdout
|
2140
|
+
def stdout; end
|
2141
|
+
|
2142
|
+
def stdout=(_); end
|
2143
|
+
|
2144
|
+
# @return [Boolean]
|
2145
|
+
#
|
2146
|
+
# source://overcommit//lib/overcommit/subprocess.rb#17
|
2147
|
+
def success?; end
|
2148
|
+
|
2149
|
+
class << self
|
2150
|
+
def [](*_arg0); end
|
2151
|
+
def inspect; end
|
2152
|
+
def keyword_init?; end
|
2153
|
+
def members; end
|
2154
|
+
def new(*_arg0); end
|
2155
|
+
end
|
2156
|
+
end
|
2157
|
+
|
2158
|
+
# Utility functions for general use.
|
2159
|
+
#
|
2160
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#6
|
2161
|
+
module Overcommit::Utils
|
2162
|
+
class << self
|
2163
|
+
# Returns whether a file is a broken symlink.
|
2164
|
+
#
|
2165
|
+
# @return [true, false]
|
2166
|
+
#
|
2167
|
+
# source://overcommit//lib/overcommit/utils.rb#268
|
2168
|
+
def broken_symlink?(file); end
|
2169
|
+
|
2170
|
+
# Converts a string containing underscores/hyphens/spaces into CamelCase.
|
2171
|
+
#
|
2172
|
+
# source://overcommit//lib/overcommit/utils.rb#97
|
2173
|
+
def camel_case(str); end
|
2174
|
+
|
2175
|
+
# Convert a glob pattern to an absolute path glob pattern rooted from the
|
2176
|
+
# repository root directory.
|
2177
|
+
#
|
2178
|
+
# @param glob [String]
|
2179
|
+
# @return [String]
|
2180
|
+
#
|
2181
|
+
# source://overcommit//lib/overcommit/utils.rb#279
|
2182
|
+
def convert_glob_to_absolute(glob); end
|
2183
|
+
|
2184
|
+
# Execute a command in a subprocess, capturing exit status and output from
|
2185
|
+
# both standard and error streams.
|
2186
|
+
#
|
2187
|
+
# This is intended to provide a centralized place to perform any checks or
|
2188
|
+
# filtering of the command before executing it.
|
2189
|
+
#
|
2190
|
+
# The `args` option provides a convenient way of splitting up long
|
2191
|
+
# argument lists which would otherwise exceed the maximum command line
|
2192
|
+
# length of the OS. It will break up the list into chunks and run the
|
2193
|
+
# command with the same prefix `initial_args`, finally combining the
|
2194
|
+
# output together at the end.
|
2195
|
+
#
|
2196
|
+
# This requires that the external command you are running can have its
|
2197
|
+
# work split up in this way and still produce the same resultant output
|
2198
|
+
# when outputs of the individual commands are concatenated back together.
|
2199
|
+
#
|
2200
|
+
# @option options
|
2201
|
+
# @param initial_args [Array<String>]
|
2202
|
+
# @param options [Hash]
|
2203
|
+
# @return [Overcommit::Subprocess::Result] status, stdout, and stderr
|
2204
|
+
#
|
2205
|
+
# source://overcommit//lib/overcommit/utils.rb#175
|
2206
|
+
def execute(initial_args, options = T.unsafe(nil)); end
|
2207
|
+
|
2208
|
+
# Execute a command in a subprocess, returning immediately.
|
2209
|
+
#
|
2210
|
+
# This provides a convenient way to execute long-running processes for
|
2211
|
+
# which we do not need to know the result.
|
2212
|
+
#
|
2213
|
+
# @param args [Array<String>]
|
2214
|
+
# @return [ChildProcess] detached process spawned in the background
|
2215
|
+
#
|
2216
|
+
# source://overcommit//lib/overcommit/utils.rb#204
|
2217
|
+
def execute_in_background(args); end
|
2218
|
+
|
2219
|
+
# Returns an absolute path to the .git directory for a repo.
|
2220
|
+
#
|
2221
|
+
# @return [String]
|
2222
|
+
#
|
2223
|
+
# source://overcommit//lib/overcommit/utils.rb#61
|
2224
|
+
def git_dir; end
|
2225
|
+
|
2226
|
+
# @param cmd [String]
|
2227
|
+
# @return [true, false] whether a command can be found given the current
|
2228
|
+
# environment path.
|
2229
|
+
#
|
2230
|
+
# source://overcommit//lib/overcommit/utils.rb#119
|
2231
|
+
def in_path?(cmd); end
|
2232
|
+
|
2233
|
+
# @return [Overcommit::Logger] logger with which to send debug output
|
2234
|
+
#
|
2235
|
+
# source://overcommit//lib/overcommit/utils.rb#32
|
2236
|
+
def log; end
|
2237
|
+
|
2238
|
+
# @return [Overcommit::Logger] logger with which to send debug output
|
2239
|
+
#
|
2240
|
+
# source://overcommit//lib/overcommit/utils.rb#32
|
2241
|
+
def log=(_arg0); end
|
2242
|
+
|
2243
|
+
# Return whether a pattern matches the given path.
|
2244
|
+
#
|
2245
|
+
# @param pattern [String]
|
2246
|
+
# @param path [String]
|
2247
|
+
# @return [Boolean]
|
2248
|
+
#
|
2249
|
+
# source://overcommit//lib/overcommit/utils.rb#287
|
2250
|
+
def matches_path?(pattern, path); end
|
2251
|
+
|
2252
|
+
# Return the parent command that triggered this hook run
|
2253
|
+
#
|
2254
|
+
# @return [String, nil] the command as a string, if a parent exists.
|
2255
|
+
#
|
2256
|
+
# source://overcommit//lib/overcommit/utils.rb#138
|
2257
|
+
def parent_command; end
|
2258
|
+
|
2259
|
+
# Return the number of processors used by the OS for process scheduling.
|
2260
|
+
#
|
2261
|
+
# @see https://github.com/grosser/parallel/blob/v1.6.1/lib/parallel/processor_count.rb#L17-L51
|
2262
|
+
#
|
2263
|
+
# source://overcommit//lib/overcommit/utils.rb#217
|
2264
|
+
def processor_count; end
|
2265
|
+
|
2266
|
+
# Returns an absolute path to the root of the repository.
|
2267
|
+
#
|
2268
|
+
# We do this ourselves rather than call `git rev-parse --show-toplevel` to
|
2269
|
+
# solve an issue where the .git directory might not actually be valid in
|
2270
|
+
# tests.
|
2271
|
+
#
|
2272
|
+
# @return [String]
|
2273
|
+
#
|
2274
|
+
# source://overcommit//lib/overcommit/utils.rb#45
|
2275
|
+
def repo_root; end
|
2276
|
+
|
2277
|
+
# source://overcommit//lib/overcommit/utils.rb#34
|
2278
|
+
def script_path(script); end
|
2279
|
+
|
2280
|
+
# Shamelessly stolen from:
|
2281
|
+
# stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby
|
2282
|
+
#
|
2283
|
+
# source://overcommit//lib/overcommit/utils.rb#88
|
2284
|
+
def snake_case(str); end
|
2285
|
+
|
2286
|
+
# Remove ANSI escape sequences from a string.
|
2287
|
+
#
|
2288
|
+
# This is useful for stripping colorized output from external tools.
|
2289
|
+
#
|
2290
|
+
# @param text [String]
|
2291
|
+
# @return [String]
|
2292
|
+
#
|
2293
|
+
# source://overcommit//lib/overcommit/utils.rb#82
|
2294
|
+
def strip_color_codes(text); end
|
2295
|
+
|
2296
|
+
# Returns a list of supported hook classes (PreCommit, CommitMsg, etc.)
|
2297
|
+
#
|
2298
|
+
# source://overcommit//lib/overcommit/utils.rb#110
|
2299
|
+
def supported_hook_type_classes; end
|
2300
|
+
|
2301
|
+
# Returns a list of supported hook types (pre-commit, commit-msg, etc.)
|
2302
|
+
#
|
2303
|
+
# source://overcommit//lib/overcommit/utils.rb#102
|
2304
|
+
def supported_hook_types; end
|
2305
|
+
|
2306
|
+
# Calls a block of code with a modified set of environment variables,
|
2307
|
+
# restoring them once the code has executed.
|
2308
|
+
#
|
2309
|
+
# source://overcommit//lib/overcommit/utils.rb#253
|
2310
|
+
def with_environment(env); end
|
2311
|
+
|
2312
|
+
private
|
2313
|
+
|
2314
|
+
# Log debug output.
|
2315
|
+
#
|
2316
|
+
# This is necessary since some specs indirectly call utility functions but
|
2317
|
+
# don't explicitly set the logger for the Utils class, so we do a quick
|
2318
|
+
# check here to see if it's set before we attempt to log.
|
2319
|
+
#
|
2320
|
+
# @param args [Array<String>]
|
2321
|
+
#
|
2322
|
+
# source://overcommit//lib/overcommit/utils.rb#304
|
2323
|
+
def debug(*args); end
|
2324
|
+
end
|
2325
|
+
end
|
2326
|
+
|
2327
|
+
# Utility functions for file IO.
|
2328
|
+
#
|
2329
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#8
|
2330
|
+
module Overcommit::Utils::FileUtils
|
2331
|
+
class << self
|
2332
|
+
# When the host OS is Windows, uses the `dir` command to check whether
|
2333
|
+
# `link_name` is an NTFS symbolic link. If so, it parses the target from
|
2334
|
+
# the command output. Otherwise raises an `ArgumentError`. Delegates to
|
2335
|
+
# `File.readlink` if the host OS is not Windows.
|
2336
|
+
#
|
2337
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#34
|
2338
|
+
def readlink(link_name); end
|
2339
|
+
|
2340
|
+
# When the host OS is Windows, uses the `mklink` command to create an
|
2341
|
+
# NTFS symbolic link from `new_name` to `old_name`. Otherwise delegates
|
2342
|
+
# to `File.symlink`
|
2343
|
+
#
|
2344
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#13
|
2345
|
+
def symlink(old_name, new_name); end
|
2346
|
+
|
2347
|
+
# When the host OS is Windows, uses the `dir` command to check whether
|
2348
|
+
# `file_name` is an NTFS symbolic link. Otherwise delegates to
|
2349
|
+
# `File.symlink`.
|
2350
|
+
#
|
2351
|
+
# @return [Boolean]
|
2352
|
+
#
|
2353
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#23
|
2354
|
+
def symlink?(file_name); end
|
2355
|
+
|
2356
|
+
private
|
2357
|
+
|
2358
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#50
|
2359
|
+
def win32_dir_cmd(file_name); end
|
2360
|
+
|
2361
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#62
|
2362
|
+
def win32_fix_pathsep(path); end
|
2363
|
+
|
2364
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#56
|
2365
|
+
def win32_mklink_cmd(old_name, new_name); end
|
2366
|
+
|
2367
|
+
# @return [Boolean]
|
2368
|
+
#
|
2369
|
+
# source://overcommit//lib/overcommit/utils/file_utils.rb#66
|
2370
|
+
def win32_symlink?(dir_output); end
|
2371
|
+
end
|
2372
|
+
end
|
2373
|
+
|
2374
|
+
# Helper class for doing quick constraint validations on version numbers.
|
2375
|
+
#
|
2376
|
+
# This allows us to execute code based on the git version.
|
2377
|
+
#
|
2378
|
+
# source://overcommit//lib/overcommit/utils.rb#17
|
2379
|
+
class Overcommit::Utils::Version < ::Gem::Version
|
2380
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2381
|
+
def !=(version); end
|
2382
|
+
|
2383
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2384
|
+
def <(version); end
|
2385
|
+
|
2386
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2387
|
+
def <=(version); end
|
2388
|
+
|
2389
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2390
|
+
def ==(version); end
|
2391
|
+
|
2392
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2393
|
+
def >(version); end
|
2394
|
+
|
2395
|
+
# source://overcommit//lib/overcommit/utils.rb#19
|
2396
|
+
def >=(version); end
|
2397
|
+
end
|
2398
|
+
|
2399
|
+
# source://overcommit//lib/overcommit/version.rb#5
|
2400
|
+
Overcommit::VERSION = T.let(T.unsafe(nil), String)
|