Skip to content

Improve pre-commit failure UI #1407

Open
@ctcjab

Description

@ctcjab

Is your feature request related to a problem? Please describe.

We make extensive use of pre-commit hooks to help the jupyterlab-git users we support catch newly-introduced errors at development time, when they're cheapest to fix. When a commit fails due to a failing pre-commit hook, the jupyterlab-git UI adds friction to the development experience in the following ways:

  1. the reason for the commit failure is buried behind an additional button click (and for some reason it also shows a spinner continuing to spin, which makes it seem like something is still happening, even though at this point it's just waiting for the user to click "Show" or close):
Image
  1. After you click "Show", it's very hard to read the error output because line breaks are removed and a non-monospace font is used:
Image
  1. When a pre-commit hook failed because it made changes to a staged file (e.g. a code formatter), jupyterlab-git currently does not make this obvious.

Describe the solution you'd like

  1. Combine the two dialogs into a single dialog, to save the user from having to perform the unnecessary extra click to see what went wrong
  2. Wrap the error output in a <pre> element so that line breaks are preserved and it's rendered in a monospace font, i.e. it's easier for humans to read:
Image
  1. After a commit failure, jupyterlab-git should check if any of the staged files now have new unstaged changes, to detect when a pre-commit hook has made changes to a staged file, inform the user when this has happened, and offer to show a diff of the new changes.

Additional context

  • Python package version: 0.51.1

  • Extension version: 0.51.1

  • Git version: 2.43.0

  • Operating System and its version: Ubuntu 24.04.1 LTS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions