checkstyle / checkstyle/checkstyle

Implement test support method(s) for passing multiple files to single filter instance

Open
#12,747 6 comments 0 reactions 0 assignees View on GitHub
approved
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
22h 23m
Merged PRs (30d)
232

Description

## What
We need a support method for testing **two or more** files on a **single filter instance**. There is something similar for testing a two files on a single check:
https://github.com/checkstyle/checkstyle/blob/e662258faf13c3abf343563c4daeb7edec96bc9d/src/test/java/com/puppycrawl/tools/checkstyle/AbstractModuleTestSupport.java#L240-L265

---
## Why
The request comes while working on https://github.com/checkstyle/checkstyle/pull/12151

The new filter stores file name and suppressions in the file to be more efficient. The problem is that there are numerous `pitest` mutations in this optimization because we cannot pass two files to this filter.

Similar caching behavior is implemented in `SuppressWithNearbyCommentFilter` and there is a suppressed `pitest` mutation there that can be killed with such a feature.
https://github.com/checkstyle/checkstyle/blob/e662258faf13c3abf343563c4daeb7edec96bc9d/config/pitest-suppressions/pitest-filters-suppressions.xml#L192-L199

Contributor guide

Open the contributing guide

Research direction

Start with the two-file support method in src/test/java/com/puppycrawl/tools/checkstyle/AbstractModuleTestSupport.java referenced by the issue. Then inspect the filter tests and the suppressed pitest mutations in config/pitest-suppressions/pitest-filters-suppressions.xml, including SuppressWithNearbyCommentFilter. Done means tests can pass two or more files to one filter instance and the relevant mutations are no longer suppressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.