apache / apache/maven-checkstyle-plugin

[MCHECKSTYLE-372] Missing cache file invalidation when suppressionsLocation file is modified

Open
#284 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
97
Forks
67
Avg merge
14h 50m
Merged PRs (30d)
6

Description

**[Robin Karlsson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=snago)** opened **[MCHECKSTYLE-372](https://issues.apache.org/jira/browse/MCHECKSTYLE-372?redirect=false)** and commented

I came across some buggy behavior with suppressions file and the cache file.

Steps to reproduce:
1. Have code with violations.
2. Run checkstyle:check.
3. Add a suppressions file (with suppressionsLocation) that suppress the violations.
4. Re-run checkstyle:check. Violations are suppressed as expected.
5. Modify suppressions file so that the violations are no longer suppressed.
6. Re-run checkstyle:check. No violations, even though they shouldn't be suppressed.

Work-arounds:
* Disable the use of cache file.
* Include the suppressions file from the config file instead of with suppressionsLocation in the plugin config.

Is this a known issue?
Is this by design?
For performance reasons you might not want to wipe the cache file when the suppression file is modified (but AFAICT that's what Checkstyle does when a suppressions file is included via the config).

On the other hand, this bit me because I modified a regexp in the suppression file so that it accidentally no longer suppressed what it was supposed to suppress.
Since I didn't get any violations I thought it still worked. But when the cache file got reset the violations came back.

---

**Affects:** 3.0.0

1 votes, 2 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with checkstyle:check, a suppressionsLocation file, and the cache enabled. Trace how the plugin detects inputs and invalidates its cache when the suppression file changes; done means changing the suppression rules causes violations to be reported again without disabling the cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
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.