My implementation of CommitValidationListener is annotated with @Listen and works fine in cases where CommitValidationMessages with isError=true are returned
$ git push origin HEAD:refs/for/master
...
remote: Resolving deltas: 100% (2/2)
remote: Processing changes: refs: 1, done
remote: error: commit 7fffc41: Line is too long ...
remote: commit 7fffc41: test ok
When I repair the long line
$ git push origin HEAD:refs/for/master
...
remote: Resolving deltas: 100% (2/2)
remote: Processing changes: new: 1, done
remote:
remote: New Changes:
remote: https://.../#/c/..../+/112367 A valid change
remote:
The line "remote: commit 7fffc41: test ok" was not shown
We use gerrit 2.15.15
On Wed, Nov 13, 2019 at 4:31 AM Loki <sto...@gmail.com> wrote:
Hi *,I try to send non errors to committers by implementing com.google.gerrit.server.git.validators.CommitValidationListener#onCommitReceived method.So I tried to fill the returning list with message like thisnew CommitValidationMessage("Your message is longer then 7000 chars, this will become an error next week", false)but the message is not shown. This could be useful to inform committers about e.g. external analysis results known from e.g. github likenew CommitValidationMessage("This project references the dependency to com.some.vulnerable:artifact:1.2.3 - CVE-2022-10234", false)Can you help me, how to implement onCommitReceived and send non errors to an user?From what I can see in the code snippets above, that should work, but without surrounding context it's difficult to say for sure. You could have a look at the CommitMessageLengthValidation class in the commit-message-length-validator plugin; this is doing the same thing and you could compare the implementations.One thing you might have forgotten to do is bind your implementation class to the CommitValidationListener interface. In the plugin I mentioned above it's done with the @Listen annotation but you can also do an explicit binding if your plugin has a module class.If it's still not working, please also mention which gerrit version you're using so that we can double check it.
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.