Updating log levels analyzer to only analyze exercise default methods#177
Conversation
sanderploegsma
left a comment
There was a problem hiding this comment.
I think solving the linked issue needs a different design. The culprit here is this snippet:
if (!node.getNameAsString().equals(REFORMAT) && doesNotCallMethods(node, EXPECTED_METHODS)) {
output.addComment(new UseSubstringMethod(node.getNameAsString()));
return;
}I think we need to tune this conditional statement to only check the methods we want, instead of 'every method except reformat'.
| if (!METHODS_TO_ANALYZE.contains(node.getNameAsString())) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Note that this bypasses all checks on helper methods. I'm not sure that is a good idea to do by default. For example, consider a solution that contains hard-coded test case data in a helper method instead of one of the main methods, I think you want to catch those right?
There was a problem hiding this comment.
I kinda think is an overkill to analyzer helper method as well, mainly because they can be a sort of test to validate the other methods of their code or something like that, in the example of the user that opened this issue you can see that the actual result method wasn't use in any other part of the code but it was triggering a comment
closes #176
@sanderploegsma I guess this could be a great addition to all the analyzers, what do you think? Because triggering comments of helper methods seems pointless