Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to allow for no files #270

Merged
merged 3 commits into from
Aug 18, 2022
Merged

Conversation

leighhalliday
Copy link

We use erb-lint in a pre-commit hook and in our CI. Sometimes files have changed (ie. in git diff) which are excluded from our erb-lint checks. This causes an error of no files found... to be output, which doesn't allow the commit to take place.

We have workarounds in place:

git diff HEAD^ --name-only --diff-filter=d -m **/*.erb | xargs --no-run-if-empty bundle exec erblint 2> error_output || [ "$(cat error_output)" == "no files found..." ]

And:

PAGER=cat git diff --diff-filter=d --name-only --cached -- "*.erb" | xargs bundle exec erblint 2> /tmp/erblint; (( erblint_status = $? ))

# No files found are treated as an error, let's treat it as success
if [[ "$(cat /tmp/erblint)" == "no files found..." ]]; then
  erblint_status=0
fi

But having a --allow-no-files option would let us treat this as a successful check without additional logic for this scenario.

@rafaelfranca rafaelfranca merged commit 13517f3 into Shopify:main Aug 18, 2022
@shopify-shipit shopify-shipit bot temporarily deployed to production August 18, 2022 22:15 Inactive
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.

2 participants