kafka
kafka copied to clipboard
MINOR; Use underscore for variable initialization in BrokerServer
In Scala its standard practice to use _ whenever you are initializing variables. In regards to implementation, for object references _ initialization maps to null so there is no chance in behaviour.
Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
Thank you for the review. Looks good. One question though (which does not have to be addressed part of this PR), do we have a linter for scala that can enforce such best practices?
Yes there is, its called scalafix, would just have to integrate it into gradle. There is also scalafmt which works on the context free grammar linting fixes, I noticed there is a configuration for this already in Kafka but for some reason Gradle build doesn't use it (or at least it doesn't fail if there is a formatting error).