This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new b888012bdd Add more prominent message explaining what to do when 
static checks fail (#31813)
b888012bdd is described below

commit b888012bdd9a6a755cf6851fd214794bf293a4ff
Author: Jarek Potiuk <[email protected]>
AuthorDate: Fri Jun 9 11:49:22 2023 +0200

    Add more prominent message explaining what to do when static checks fail 
(#31813)
    
    Pre-commit prints a useful message when static check changes
    
    ```
    Update ER 
diagram..................................................................Passed
    pre-commit hook(s) made changes.
    If you are seeing this message in CI, reproduce locally with: `pre-commit 
run --all-files`.
    To run `pre-commit` as part of git workflow, use `pre-commit install`.
    All changes made by hooks:
    ```
    
    But it is not highglighted in any way in the CI output and it might
    be missed when users are not familiar with pre-commit.
    
    We  repeat the message and add more detailed instructions what to do
    (Including helpful `breeze static-checks --only-my-changes` commamnd
    that helps to run static checks faster. We do it also in the way that
    will be more prominently displayed at the end of the output and
    highlighted. We can point the user to follow those instructions if they
    ask rather than explain them to look at CONTRIBUTING guide.
---
 .../src/airflow_breeze/commands/developer_commands.py    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/dev/breeze/src/airflow_breeze/commands/developer_commands.py 
b/dev/breeze/src/airflow_breeze/commands/developer_commands.py
index 54761f8ef6..59428b42da 100644
--- a/dev/breeze/src/airflow_breeze/commands/developer_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/developer_commands.py
@@ -533,7 +533,21 @@ def static_checks(
     )
     if static_checks_result.returncode != 0:
         if os.environ.get("CI"):
-            get_console().print("[error]There were errors during pre-commit 
check. They should be fixed[/]")
+            get_console().print("\n[error]This error means that you have to 
fix the issues listed above:[/]")
+            get_console().print("\n[info]Some of the problems might be fixed 
automatically via pre-commit[/]")
+            get_console().print(
+                "\n[info]You can run it locally with: `pre-commit run 
--all-files` "
+                "but it might take quite some time.[/]"
+            )
+            get_console().print(
+                "\n[info]If you use breeze you can also run it faster via: "
+                "`breeze static-checks --only-my-changes` but it might produce 
slightly "
+                "different results.[/]"
+            )
+            get_console().print(
+                "\n[info]To run `pre-commit` as part of git workflow, use "
+                "`pre-commit install`. This will make pre-commit run as you 
commit changes[/]\n"
+            )
     sys.exit(static_checks_result.returncode)
 
 

Reply via email to