Skip to content

Conversation

@GG-HH
Copy link
Collaborator

@GG-HH GG-HH commented Nov 14, 2025

Fixes #1143

Context

Trying to fix error #1143

What has been done

In case the git hooks path is the husky path, add the ggshield command in the husky configuration file

Validation

See issue

PR check list

  • As much as possible, the changes include tests (unit and/or functional)
  • If the changes affect the end user (new feature, behavior change, bug fix) then the PR has a changelog entry (see doc/dev/getting-started.md). If the changes do not affect the end user, then the skip-changelog label has been added to the PR.

@GG-HH GG-HH requested a review from a team as a code owner November 14, 2025 17:49
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 68.75000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.91%. Comparing base (edac2af) to head (4cfbc12).

Files with missing lines Patch % Lines
ggshield/cmd/install.py 68.75% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1150      +/-   ##
==========================================
- Coverage   91.97%   91.91%   -0.06%     
==========================================
  Files         144      144              
  Lines        6202     6218      +16     
==========================================
+ Hits         5704     5715      +11     
- Misses        498      503       +5     
Flag Coverage Δ
unittests 91.91% <68.75%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GG-HH GG-HH self-assigned this Nov 14, 2025
@GG-HH GG-HH changed the title draft: feat(install): allow to install hook locally with husky feat(install): allow to install hook locally with husky Nov 17, 2025
return hooks_path


def get_local_hooks_path() -> Optional[Path]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having both get_local_hook_dir_path() and get_local_hooks_path() is confusing. Maybe name this one get_hooks_path_from_local_git_config() (a bit long, but unambiguous)?

from tests.repository import Repository


def test_install_local_detects_husky(tmp_path: Path) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect a functional test to use Husky for real. Is it doable?

I think if you replace the use of run_ggshield() with a call to install_local() then this code can become a unit test for install_local().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ggshield install isn't working with Husky

4 participants