tushartushar / DesigniteJava

Detects smells and computes metrics of Java code
https://www.designite-tools.com/products-dj
Apache License 2.0
172 stars 64 forks source link

Detection of HasComplexIfStatement smell should identify all possible smells in a method #40

Closed AntonisGkortzis closed 6 years ago

AntonisGkortzis commented 6 years ago

https://github.com/tushartushar/DesigniteJava/blob/72a8fd7c6cbd1b3d73934f9137240d1b92bf5809/src/Designite/smells/implementationSmells/ImplementationSmellDetector.java#L74

The current implementation stops the smell identification after identifying the 1st smell in a method. https://github.com/tushartushar/DesigniteJava/blob/72a8fd7c6cbd1b3d73934f9137240d1b92bf5809/src/Designite/smells/implementationSmells/ImplementationSmellDetector.java#L93

Thodoras commented 6 years ago

Hi Antonis!

Would you like to elaborate with a more specific example of this bug? I mean something like: "I expected to identify this $conditional$ as a smell but I could not" or vice versa?

Edit: Or the problem is that as soon as it finds the first bugged conditional it returns with a smell when it should store somehow all the conditionals with this smell in a method?

AntonisGkortzis commented 6 years ago

Hey man!

It's the 2nd case.

The detection works fine but it stops right after detecting the first complex if statement. As you said, it should somehow store how many instances of this smell it identified in the method and it should create a number of smells accordingly.

Thodoras commented 6 years ago

So let me get this straight, it should store an integer that depicts how many times this smell was raised or something more detailed?

AntonisGkortzis commented 6 years ago

I think that for now we are ok just with an integer. And when this integer is returned to the detectComplexConditional then there we should generate the number of smells that correspond to this integer.

Thodoras commented 6 years ago

I could have it done by afternoon or are you working on it?

AntonisGkortzis commented 6 years ago

No, I'm working on the Long Statement. I will commit and push in a while.