Skip to content
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

Updating log levels analyzer to only analyze exercise default methods #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manumafe98
Copy link
Contributor

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

@manumafe98 manumafe98 added the x:size/small Small amount of work label May 23, 2024
@manumafe98 manumafe98 self-assigned this May 23, 2024
@manumafe98 manumafe98 requested a review from a team as a code owner May 23, 2024 00:26
Copy link
Contributor

@sanderploegsma sanderploegsma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'.

Comment on lines +47 to +49
if (!METHODS_TO_ANALYZE.contains(node.getNameAsString())) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/small Small amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

there is no need to use substring in the result method in this code, kindly review
3 participants