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

Disallow static import of BugCheckerRefasctoringTestHelper.TestMode#TEXT_MATCH #862

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

rickie
Copy link
Member

@rickie rickie commented Oct 26, 2023

I remembered we wanted to fix this one some time ago.

However, it does a non 100% optimal fix for this specific case as it rewrites it to:

BugCheckerRefactoringTestHelper.TestMode.TEXT_MATCH

Which can be easily fixed by removing the qualifier, but I'd say flagging this is an improvement for now.
Didn't add a test as we already extensively test the members in the identification test.

Suggested commit message:

Disallow static import of `BugCheckerRefasctoringTestHelper.TestMode#TEXT_MATCH` (#862)

@github-actions
Copy link

  • Surviving mutants in this change: 1
  • Killed mutants in this change: 0
class surviving killed
🧟tech.picnic.errorprone.refaster.test.RefasterRuleCollection 1 0

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202 Stephan202 force-pushed the rossendrijver/nonstaticimport_textmatch branch from d1b7d45 to 50d6342 Compare October 29, 2023 16:25
Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

Rebased and added a commit. Suggested commit message:

Disallow static import of `BugCheckerRefasctoringTestHelper.TestMode` members (#862)

@@ -78,6 +78,7 @@ public final class NonStaticImport extends BugChecker implements CompilationUnit
static final ImmutableSetMultimap<String, String> NON_STATIC_IMPORT_CANDIDATE_MEMBERS =
ImmutableSetMultimap.<String, String>builder()
.put("com.google.common.base.Predicates", "contains")
.put("com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode", "TEXT_MATCH")
Copy link
Member

Choose a reason for hiding this comment

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

It's not like we do want to statically import AST_MATCH, so I suppose we can extend NON_STATIC_IMPORT_CANDIDATE_TYPES instead.

@github-actions
Copy link

  • Surviving mutants in this change: 1
  • Killed mutants in this change: 0
class surviving killed
🧟tech.picnic.errorprone.refaster.test.RefasterRuleCollection 1 0

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie added this to the 0.15.0 milestone Oct 30, 2023
@rickie rickie force-pushed the rossendrijver/nonstaticimport_textmatch branch from 50d6342 to f2a09ed Compare October 30, 2023 09:37
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@github-actions
Copy link

  • Surviving mutants in this change: 1
  • Killed mutants in this change: 0
class surviving killed
🧟tech.picnic.errorprone.refaster.test.RefasterRuleCollection 1 0

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie merged commit 4ce9f92 into master Oct 30, 2023
17 checks passed
@rickie rickie deleted the rossendrijver/nonstaticimport_textmatch branch October 30, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants