pre-commit/tests/commands
Claude c064dd83df
Cap hook output at terminal width to prevent wrapping
Previously, _compute_cols() would calculate the ideal column width based
on hook names and message lengths, with a minimum of 80 columns. However,
it didn't consider the actual terminal width, causing the "Passed/Failed"
status to wrap to the next line on narrower terminals.

This change:
- Adds terminal width detection using shutil.get_terminal_size()
- Caps the column width at the terminal width to prevent wrapping
- Maintains the minimum of 80 columns when terminal is wide enough
- Falls back to 80 columns if terminal size cannot be determined

The algorithm now ensures output always fits within the terminal width,
similar to how pytest handles its output formatting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Kamil Monicz <kamil@monicz.dev>
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:28:22 +00:00
..
__init__.py Move commands into their own files. 2014-06-13 19:52:14 -07:00
autoupdate_test.py perform autoupdate without Store contention 2023-04-29 15:32:20 -04:00
clean_test.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
gc_test.py perform autoupdate without Store contention 2023-04-29 15:32:20 -04:00
hook_impl_test.py Add pre-rebase hook support 2023-03-11 15:17:42 -05:00
init_templatedir_test.py Change cmd_output_bs retcode arg to a boolean check 2022-10-30 14:49:42 -05:00
install_uninstall_test.py python 3.9+: use removeprefix 2023-12-09 16:04:25 -05:00
migrate_config_test.py fix migrate-config for purelib yaml 2024-10-08 11:46:48 -04:00
run_test.py Cap hook output at terminal width to prevent wrapping 2025-10-28 13:28:22 +00:00
sample_config_test.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
try_repo_test.py Improve hook duration timing 2023-10-13 16:40:30 +01:00
validate_config_test.py remove pre-commit-validate-config and pre-commit-validate-manifest 2022-12-27 13:05:30 -05:00
validate_manifest_test.py remove pre-commit-validate-config and pre-commit-validate-manifest 2022-12-27 13:05:30 -05:00