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

Fix #676 Handle @SuppressWarnings on each method for CountInLoop #677

Conversation

kylekatarnls
Copy link
Member

No description provided.

@kylekatarnls kylekatarnls added this to the 2.8.0 milestone Oct 8, 2019
@kylekatarnls
Copy link
Member Author

Hi guys, this fixes #676. It focuses on CountInLoopExpression but some other rules surely have the same problem. So I created a method we can reuse on other rules and we should take a look around to check which rules need it.

Using this method has a drawback: it check only methods code of a class. In the specific case of CountInLoopExpression this is not an issue because, as of now, it is not possible to use count() or any function call inside a class but outside methods (in property initialization for example).

But for other rules we may need to check this way each method (to see if there is @supressWarnings) then check properties initialization or any code inside the class that would not checked by applying the rule on each method node-by-node.

@tvbeek
Copy link
Member

tvbeek commented Oct 8, 2019

@kylekatarnls I did a first check, can you add test for this? After that I will check the rest of it.

Thanks for your PR.

@kylekatarnls
Copy link
Member Author

Done.

Copy link
Member

@tvbeek tvbeek left a comment

Choose a reason for hiding this comment

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

Thanks

@tvbeek tvbeek merged commit 018d30f into phpmd:master Oct 8, 2019
@kylekatarnls kylekatarnls deleted the feature/issue-676-fix-count-in-loop-method-suppress branch October 8, 2019 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants