Pre-commit script should only run yarn validator if relevant files have been modified #6959

Closed
opened 2025-12-29 19:47:11 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Sep 9, 2022).

Originally assigned to: @arthanson on GitHub.

Proposed Changes

Modify the pre-commit script so that the call to yarn validate (below) is only made if relevant files have been modified.

385a0f979e/scripts/git-hooks/pre-commit (L43-L47)

This should be doable by check for references to netbox/project-static/ in the git diff.

Justification

This check is only necessary if static files have been modified. Omitting where not needed reduces the execution time of the pre-commit script by several seconds.

Originally created by @jeremystretch on GitHub (Sep 9, 2022). Originally assigned to: @arthanson on GitHub. ### Proposed Changes Modify the [pre-commit script](https://github.com/netbox-community/netbox/blob/develop/scripts/git-hooks/pre-commit) so that the call to `yarn validate` (below) is only made if relevant files have been modified. https://github.com/netbox-community/netbox/blob/385a0f979ec460023d3d7f8e9003ddc373fb5ac3/scripts/git-hooks/pre-commit#L43-L47 This should be doable by check for references to `netbox/project-static/` in the git diff. ### Justification This check is only necessary if static files have been modified. Omitting where not needed reduces the execution time of the pre-commit script by several seconds.
adam added the type: housekeeping label 2025-12-29 19:47:11 +01:00
adam closed this issue 2025-12-29 19:47:11 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6959