Closed sagittarian closed 1 year ago
This makes sense - thanks for submitting.
Gitlint doesn't do warnings today (except for deprecation warnings). If we introduce them, there should probably be a way to suppress specific warnings.
I'll fix this, but not sure yet which route I'll end up going...
Thanks!
So this also makes gitlint crash when passing anything in via stdin:
# Crashes
echo "foo" | gitlint
# Does not crash
echo "foo" | gitlint --staged
This is pretty bad. Working through some other things but will fix this soonish, probably without the warning since it would be unexpected for the warning to show up in this case.
edit: clarification that this only crashes when the user is using an ignore-by-author-name
rule
Fixed! I did end up adding a warning :) You can’t suppress it for now, maybe that’s something I’ll add in the future.
For (my own) reference: author-valid-email
has a similar issue, but the rule is already silently ignored in case commit.author_name
is not available. I think that’s ok (at least for now), since contrary to the ignore-by-author-name
rule, the author-valid-email
rule is enabled by default. Adding a warning now is likely just going to add a bunch of spam for users that are perfectly fine with the currently behavior.
If gitlint is run without
--staged
, then the author name is alwaysNone
and there is no guard for that situation in theignore-by-author-name
rule. Here is a setup to reproduce it:The fix should be very simple, just adding a
None
check to the offending line so it isif commit.author_name is not None and regex_method(commit.author_name):
, although maybe a warning should be printed since if gitlint is run without--staged
the ignore-by-author-name rule will never be able to indicate that the rule should be ignored.