Skip to content

Issue #14019: Resolve pitest suppressions for XMLLogger fileMessages.…#16314

Merged
romani merged 1 commit into
checkstyle:masterfrom
zyadahmed:XMLLOggerFileTesting
Feb 18, 2025
Merged

Issue #14019: Resolve pitest suppressions for XMLLogger fileMessages.…#16314
romani merged 1 commit into
checkstyle:masterfrom
zyadahmed:XMLLOggerFileTesting

Conversation

@zyadahmed

Copy link
Copy Markdown
Contributor

#14019
Mutation fileMessages.remove(fileName);
The test casetestFileRemovalFromLoggerensures that calling fileFinished multiple times does not duplicate file entries in the log. If a violation is logged only once, it means the file was already removed in a previous call, triggering fileMessages.remove.

image

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's try:

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java Outdated
@zyadahmed zyadahmed requested a review from romani February 17, 2025 16:41

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

items:

Comment thread src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java Outdated
Comment thread src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java Outdated

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need pitest removal.

items:

@@ -0,0 +1,10 @@
<?xml version="1.0"?>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we do not need this file, config should be loaded from src/test/resources/com/puppycrawl/tools/checkstyle/xmllogger/InputXMLLogger.java , please look at methods verifyXXxxxxxxxx

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pitest removal in this way or any real execution still exists. I think we should remove the line as it has no effect .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please do removal, it is best effect of pitest, it helps to find dead code and not requireed code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we do not need this file, config should be loaded from src/test/resources/com/puppycrawl/tools/checkstyle/xmllogger/InputXMLLogger.java , please look at methods verifyXXxxxxxxxx

But if we have multiple files and only one config used in all of them, why can't we use the best way to separate the config, as it reflects the real use case of Checkstyle?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

please do removal, it is best effect of pitest, it helps to find dead code and not requireed code

so you mean remove FileMessages.remove() from xmllogger right ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

with pr #16345 and change in order of fileMessage.remove the mutation is killed
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please push code, I still see old version of code without update in logger or pitest removal

@zyadahmed zyadahmed requested a review from romani February 18, 2025 15:45
@zyadahmed

Copy link
Copy Markdown
Contributor Author

pitest removal was already done in #16345, so I didn't change anything.
Regarding the logger, I made the change as you requested by moving it to inlineConf instead of a separate XML file, Do you mean something different? I don’t understand.

@romani

romani commented Feb 18, 2025

Copy link
Copy Markdown
Member

OMG, so concurrent updates, ok, let's merge without update for pitest.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot.

Please help with other pitest survival, to make sure you fully understand how it works

@zyadahmed

Copy link
Copy Markdown
Contributor Author

Thanks a lot.

Please help with other pitest survival, to make sure you fully understand how it works

Yes, I will start working on the next one to understand checkstyle more. Thank you very much for your help!

Hariom-kr added a commit to Hariom-kr/checkstyle that referenced this pull request Oct 7, 2025
Hariom-kr added a commit to Hariom-kr/checkstyle that referenced this pull request Oct 7, 2025
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.

2 participants