Closed TurinTuramba closed 9 years ago
Dear Roland,
Thanks for your feedback. Indeed BinaryExpressionTrees are not handled yet, I'll create an issue to fix this.
Back to your question, the goal of the plugin is to annotate the source in order to inform developers of code smells and make them able to discuss these smells during code reviews / sprint plannings. This information is not needed nor wanted at runtime, nor in compiled classes (no other issue raised by SQ is compiled into your project's bytecode).
Therefor and as documented, the annotation's retention type that was chosen is SOURCE. As the plugin is meant to be simple, and the annotation is meant to document the code, I see no good reason to change this approach.
Kind regards,
Michel
The bug you reported is now fixed (see #15) and will be released with milestone 1.0.3.
Added the following test cases :
public static final String CONSTANT1 = "Anti-";
public static final String CONSTANT2 = "pattern";
public static final String CONSTANT3 = "Anti-pattern";
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = "Anti-pattern", type = WTFType.ANTI_PATTERN)
public void method() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = "Anti-" + "pattern", type = WTFType.ANTI_PATTERN)
public void method2() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = "Anti" + "-" + "pattern", type = WTFType.ANTI_PATTERN)
public void method2() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = CONSTANT1 + "pattern", type = WTFType.ANTI_PATTERN)
public void method4() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = "Anti-" + CONSTANT2, type = WTFType.ANTI_PATTERN)
public void method3() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = CONSTANT1 + CONSTANT2, type = WTFType.ANTI_PATTERN)
public void method5() {
}
// Noncompliant @+1 {{Anti-pattern}}
@WTF(minutes = 10, reason = CONSTANT3, type = WTFType.ANTI_PATTERN)
public void method6() {
}
Regards,
Michel
Hi Michel,
Thanks for Your fast answer. Your are absolutely right I missed the RetentionPolicy.SOURCE and expected the CLASS policy.
And again thank you for this fix.
Do You have an estimation of the release date for the upcoming v.1.0.3?
Regards Roland
Hi Roland,
You're welcome. I released 1.0.3 last night so you can start using it right after having read this email :-)
Best Regards,
Michel
Le 16 sept. 2015 à 08:38, TurinTuramba notifications@github.com a écrit :
Hi Michel,
Thanks for Your fast answer. Your are absolutely right I missed the RetentionPolicy.SOURCE and expected the CLASS policy.
And again thank you for this fix.
Do You have an estimation of the release date for the upcoming v.1.0.3?
Regards Roland
— Reply to this email directly or view it on GitHub.
Closing issue.
Hi,
after a total not working plugin in Sonar. I investigated my setup in deepth and regconized that !WTF plugin investigates the source files and not the class files (because of the annotations I expected this). The problem in my case was a concatenation for the
message
field, e.g.this resulted in a class cast exception in
WTFCheck
I am wondering why You decided to analyse the source code rather than the class files, because the informations about the annotations will be compiled to the class file and could be examined there.
Just an idea.
Regards Roland