You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When npx is available on the path, the hook scripts will never use the Swift runner.
This can be a problem if a developer has an incorrectly configured Node environment and is trying to commit to a Swift project configured with the SPM plugin.
Lefthook version
1.6.4
Steps to reproduce
Set up a project with a Package.swift file and the Swift lefthook-plugin.
Ensure that lefthook is not available through any of the fallbacks that come before npx.
Ensure that an executable called npx is available in your path. (For testing purposes, can do alias npx=false.)
Install a pre-commit hook.
Attempt to commit.
Expected results
The commit should complete successfully using the Swift Lefthook plugin.
Actual results
npx is used to try to run Lefthook.
Possible Solution
Re-order the fallbacks so the Swift test comes before the check for the npx command.
Logs / Screenshots
Not much to show here, since Lefthook never actually runs. What one of our engineers ran into, though, was that their broken Node environment resulted in this error when trying to commit to our Swift repo with Lefthook enabled.
The text was updated successfully, but these errors were encountered:
🔧 Summary
When
npx
is available on the path, the hook scripts will never use the Swift runner.This can be a problem if a developer has an incorrectly configured Node environment and is trying to commit to a Swift project configured with the SPM plugin.
Lefthook version
1.6.4
Steps to reproduce
Package.swift
file and the Swift lefthook-plugin.lefthook
is not available through any of the fallbacks that come beforenpx
.npx
is available in your path. (For testing purposes, can doalias npx=false
.)Expected results
The commit should complete successfully using the Swift Lefthook plugin.
Actual results
npx
is used to try to run Lefthook.Possible Solution
Re-order the fallbacks so the Swift test comes before the check for the
npx
command.Logs / Screenshots
Not much to show here, since Lefthook never actually runs. What one of our engineers ran into, though, was that their broken Node environment resulted in this error when trying to commit to our Swift repo with Lefthook enabled.
The text was updated successfully, but these errors were encountered: