MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _compute_cols

Function _compute_cols

pre_commit/commands/run.py:238–250  ·  view source on GitHub ↗

Compute the number of columns to display hook messages. The widest that will be displayed is in the no files skipped case: Hook name...(no files to check) Skipped

(hooks: Sequence[Hook])

Source from the content-addressed store, hash-verified

236
237
238def _compute_cols(hooks: Sequence[Hook]) -> int:
239 """Compute the number of columns to display hook messages. The widest
240 that will be displayed is in the no files skipped case:
241
242 Hook name...(no files to check) Skipped
243 """
244 if hooks:
245 name_len = max(_len_cjk(hook.name) for hook in hooks)
246 else:
247 name_len = 0
248
249 cols = name_len + 3 + len(NO_FILES) + 1 + len(SKIPPED)
250 return max(cols, 80)
251
252
253def _all_filenames(args: argparse.Namespace) -> Iterable[str]:

Callers 2

test_compute_colsFunction · 0.90
_run_hooksFunction · 0.85

Calls 1

_len_cjkFunction · 0.85

Tested by 1

test_compute_colsFunction · 0.72