From f6c6b6c55f36d9b39cbbc764e9b10268be33e086 Mon Sep 17 00:00:00 2001 From: Alessio Izzo Date: Mon, 26 Feb 2024 16:04:02 +0100 Subject: [PATCH] improvements/fixes after code review --- .gitignore | 1 - pre_commit/commands/run.py | 8 ++------ tests/commands/run_test.py | 6 ------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 12790fcc..c2021816 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ /.tox /dist .vscode/ -.idea diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 3c356dbe..62e19b7c 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -372,12 +372,8 @@ def run( ): return 0 # prevent pushing staged files not committed (#2486) - if ( - args.hook_stage == 'pre-push' and git.get_staged_files() - ): - logger.error( - 'Staged files found. Please commit before pushing', - ) + if args.hook_stage == 'pre-push' and git.get_staged_files(): + logger.error('Staged files found. Please commit before pushing') return 1 # Expose prepare_commit_message_source / commit_object_name # as environment variables for the hooks diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index de65e45a..924340b7 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -364,12 +364,6 @@ def test_show_diff_on_failure( 1, False, ), - ( - {'hook': 'nope', 'hook_stage': 'pre-push'}, - (b'[ERROR] Staged files found. Please commit before pushing\n',), - 1, - True, - ), ( {'all_files': True, 'verbose': True}, (b'foo.py',),