Skip to content

MINOR; Use underscore for variable initialization in BrokerServer #12471

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

Merged

Conversation

mdedetrich
Copy link
Contributor

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)

@divijvaidya
Copy link
Member

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?

@mdedetrich
Copy link
Contributor Author

mdedetrich commented Aug 2, 2022

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).

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.
@mdedetrich mdedetrich force-pushed the brokerserver-underscore-initialization branch from c14683a to f57893d Compare August 3, 2022 19:40
Copy link
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup. LGTM

@mimaison mimaison merged commit 2ff4c0a into apache:trunk Aug 18, 2022
@mdedetrich mdedetrich deleted the brokerserver-underscore-initialization branch August 18, 2022 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants