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
PackageObjectFactory can't instantiate AuditListeners #4742
Comments
@romani Upon adding and recognizing listeners, I am getting the following test errors:
So I have the following questions/confirmations:
|
short names are only for human in config file, there are too much names.
hmm, they could, but users do not need listeners and do not need customization of them.
I do not know a use case when it make sense. For now it is not required. Output format is a business of caller (plugin, CLI, .....) |
We can't because these listeners don't have a default constructor, so they fail to instantiate. I missed this before. |
Listener is not a Module ...... such update is not ok.... I removing "approved" label for now to make it clear what we are going to do. |
it might be used in config file only due to |
if we allow AuditListeners to be in config, so it mean that user is allowed to define output by config.
If we allow AuditListeners to be in config, we should allow NO OUTPUT mode in our CLI to let user control all by config. Am I make sense ? |
Just because it is a listener, doesn't mean it will only be used for output. If it was used for output alone, then adding multiple probably wouldn't make sense.
|
This makes sense if listener wants to control output fully. Only one of my listeners does this, but it has no negative effects working with the normal output listeners. |
changes to CLI and AuditListener review is moved to #4956 . |
So this is now approved again? |
fix is merged |
I am trying to upgrade my project and custom jars from Checkstyle 7.5.1 to 8.0 and I am getting an error that one of my custom
AuditListeners
can't be instantiated by name alone even though it's package is listed in thecheckstyle_packages.xml
file.The issue is the new code in
PackageObjectFactory
isn't looking forAuditListeners
.isCheckstyleModule
is looking for everything else exceptAuditListeners
.It needs to be expanded to scan for them in 3rd party packages.
ModuleReflectionUtils
requires aisAuditListener
method as part ofisCheckstyleModule
.I wrote a custom listener and expanded what communications it receives to gather and print metrics on it's execution time and number of times areas were called to produce reports and examine slow down areas, like modules and javadoc. You have seen these reports before. FileSets and Checks cannot receive the detailed information that a listener can as it is the most global thing we have in Checkstyle.
This is my branch: https://github.com/rnveach/checkstyle/commits/more_audits
I also have a private listener which is basically an implementation of #3242 , where on auditFinished it examines the list of defined suppressions and prints violations on any that were not used.
I have to use a listener as it is the only customizable area that is called at the end once all other modules, filters, and such are done.
Listener can be defined in the configuration.
The text was updated successfully, but these errors were encountered: