policy-bot
policy-bot copied to clipboard
feat: no_changed_files predicate
Summary
Adds a new no_changed_files predicate that allows you to ensure that the rule is not applied if a file matching an entry in no_changed_files.paths is present.
This is a negation of the changed_files predicate, and the implementation logic reflects that.
Closes #754 Related #755
Thanks for your interest in palantir/policy-bot, @erikburt! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.
Thanks for implementing this. I think it looks good, but I need to think a bit more about:
- If the expected behavior is exactly the negation of
changed_filesor if there should be some difference (particularly for ignored files) - If the value/condition phrases are correct for the UI
I'll try to get back to you on those points in the next few days.
Thank you for the review! Sorry for the delay, was caught up with some deadlines.
I've changed the phrases around using some of your suggestions. To get around the weird double negatives I added a "SkipPhrase" to the predicate result which is universally "do not" except for the NoChangedFiles predicate where it is empty.
I've also tried to simplify the logic where possible. I do think it's probably best to reuse the ChangedFiles predicate to ensure this is a direct negation. If you would like me to duplicate and reverse the logic, I can do that as well.
Let me know what you think.