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

[PiranhaJava] Deleting statements containing specific Mockito API patterns #155

Merged
merged 1 commit into from
Dec 2, 2021

Conversation

ketkarameya
Copy link
Contributor

@CLAassistant
Copy link

CLAassistant commented Dec 1, 2021

CLA assistant check
All committers have signed the CLA.

@ketkarameya ketkarameya changed the title Feature/specific use cases 104 Deleting statements containing specific Mockito API patterns Dec 1, 2021
" when(experimentation.isToggleDisabled(\"STALE_FLAG\")).thenReturn(false);",
" when(experimentation.isToggleEnabled(\"STALE_FLAG\")).thenThrow(new RuntimeException());",
" when(experimentation.isToggleDisabled(\"STALE_FLAG\")).thenCallRealMethod();",
" when(experimentation.isToggleEnabled(\"STALE_FLAG\")).then(ans);",
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also add a non stale flag in the mix?

if (enclosingNode(MOCKITO_UNNECESSARY_MOCKING_PATTERN).matches(tree, state)) {
StatementTree stmt = ASTHelpers.findEnclosingNode(state.getPath(), StatementTree.class);
if (stmt != null) {
return buildDescription(stmt).addFix(SuggestedFix.delete(stmt)).build();
Copy link
Contributor

Choose a reason for hiding this comment

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

can the changes happen in updateCode? If not, maybe update the startPos and endPos here?

@ketkarameya ketkarameya force-pushed the feature/specific-use-cases-104 branch from 90e2577 to 079f33d Compare December 2, 2021 02:20
Fixed the Swift CI issue

Addressed the issues mentioned in the PR and offline

Added support for then* pattern

Added delete statement logic for specific patterns menntioned in issue uber#104
@ketkarameya ketkarameya force-pushed the feature/specific-use-cases-104 branch from 079f33d to 4ac47a7 Compare December 2, 2021 02:30
Copy link
Contributor

@mkr-plse mkr-plse left a comment

Choose a reason for hiding this comment

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

lgtm. thanks for the PR.

@mkr-plse mkr-plse changed the title Deleting statements containing specific Mockito API patterns [PiranhaJava] Deleting statements containing specific Mockito API patterns Dec 2, 2021
@mkr-plse mkr-plse merged commit 1308205 into uber:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants