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
Fix some static analysis findings #2594
Comments
Turns out the preview links I posted earlier aren't as stable as I had hoped; I'll see about updating those. Here's how I created those links:
|
Welcome back, @timtebeek! Although these are minor wins and not overly important for the inner workings of Axon Framework, I am very much into aligning the code base with standards. So, any of the pointers you've shared are free game to pick up if you want. But, as always, any form of contribution to Axon Framework is very much appreciated! |
As also mentioned here; there's also a recipe to consistently apply the Apache license header. |
@CodeDrivenMitch I had another quick look at running recipes for Axon, as we discussed, and figured these two might be worth applying since they ensure logging statements start with a constant rather than String format or concatenation: https://app.moderne.io/results/0NzdYUZ5d type: specs.openrewrite.org/v1beta/recipe
name: com.github.timtebeek
displayName: Parameterized logging
description: With constant log messages
recipeList:
- org.openrewrite.java.logging.slf4j.ParameterizedLogging
- org.openrewrite.java.logging.slf4j.Slf4jLogShouldBeConstant In terms of changes you'd get something like the following The only thing I'm not sure about is how strict you all are on having those line breaks on the logged messages. Personally I feel having a constant String would be better, also when folks search for messages through Google, but it's a matter of taste and up to you. |
The use of |
That's at least something to apply through that
Only after compilation does that string concatenation become a constant, provided there's no variables in there. By only using constants you stop the pattern of string concatenation for logging statements, which here might have been fine, but you don't want to have to check every instance where that occurs. |
Awesome, I learned something new today! Thanks for the eye-opener, @timtebeek. |
Hi! It's me again with some more automated fixes. Rather than directly open several pull requests and potentially overwhelm you with review work, I'd thought this time around give you the option to check off what is and isn't welcome as a contribution, to hopefully make it a bit self served. Feel free to commit or create PRs for the trivial stuff yourself through the provided
previewrecipe links; I'm just hoping to be helpful looking at the current Sonar findings.Enhancement Description
Code cleanup:
Fix Common static analysis issues:
Apply (some of the) SLF4J best practices:
Spring Boot 2.x best practices:
The above changes should all just work; if not it's a bug and I'd very much like to hear about it!
The text was updated successfully, but these errors were encountered: