Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a few alerts that were raised on LGTM.com. These are the ones where I could quickly tell what the right thing to do was.
There are quite a lot of other interesting alerts there and the majority that I looked through seem to be correct. You may want to ignore the "array index out of bounds" alerts though as most of those seem wrong. In a few other cases the alert looked corrected but the code didn't seem to be used anywhere so I wasn't sure what to do. Probably with your knowledge you'd be able to tell what's going on quite quickly.
About the alert in
IncompleteItem
, the map has keys of typeItemCaract
but we were looking up something of typeNumericType
so it would always be false. I'm assuming this is a mistake and we should be checking if theItemCaract
has been seen before. It's a shame thatMap.containsKey
doesn't use generic types otherwise this would be caught at compilation time.In
SuggestEngineResult.sameString
I think it would have returned true for any pair of non-null strings or if either string was non-null. I'm assuming that this isn't what was intended. I found this because it said that on thea.equals(b)
line,a
would always be null, which is the case because it would always have returned ifa
was non-null. It's a shame we can't use the Java 7Objects.equals
but if I understand the pom file correctly this project builds using Java 5.In
HumanDuration
, thems
variable was passed toString.format
but in all cases the format string did not have enough formatting arguments to make use of it. Assuming that it is outputting the correct human readable string already then the thing to do I think would be to stop passing thems
variable.For full disclosure, I do work on the team that makes LGTM.com, so I'm using my powers there to raise the point that the "array index out of bounds" alert has quite a lot of false positives. Do let me know if you have any questions at all.