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

Eclipse-CS does not refresh Checkstyle's External Resource list #465

Open
rnveach opened this issue Feb 3, 2023 · 2 comments
Open

Eclipse-CS does not refresh Checkstyle's External Resource list #465

rnveach opened this issue Feb 3, 2023 · 2 comments

Comments

@rnveach
Copy link
Member

rnveach commented Feb 3, 2023

While working on #454 ,

I noticed when I changed the regular expression header file and did a clean build to re-run Checkstyle, Eclipse-CS kept using the old header file not matter what I did to try to get it to see the new one.

Checkstyle did not recognize the new header file changes until I re-saved the Configuration file, even though it had no more changes at that point.

It seems to me Eclipse-CS is caching something in memory to avoid having Checkstyle recreate the config in memory for each run and is causing issues when it doesn't see something as changed.

Checkstyle's External Resource Info: https://checkstyle.org/writingchecks.html#Declare_check.27s_external_resource_locations

@rnveach
Copy link
Member Author

rnveach commented Feb 3, 2023

The issue is the way Eclipse-CS runs Checkstyle.

Auditor is basically the Checkstyle runner and the Checker instance it creates is cached throughout the life of multiple Checker runs until it is deemed out of date. It doesn't take into account external resources.

Checker assumes the instance is always re-created on a run, so Modules are never set to reload files they have loaded after the first time. There is no check for an external resource has changed. There is just loading and destroying.
Header Check Example: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java#L194-L197

For fixing this, it seems the only way may be to remove the cache on Checker in Eclipse-CS.

I doubt Checkstyle will want to build a reloading lifestyle that it currently doesn't support and also technically can't use in it's own run lifecycle. While checker manages the external resources from the configuration and modules, it only does so to pass that information to the internal cache it manages when it is enabled.

Maybe Eclipse-CS could make use of Checkstyle's caching module and use that to trigger a reset, but this isn't supported by RootModule's in general (which Eclipse-CS also doesn't support) and even if it was, it only supports giving a file string and does not provide any feedback that Eclipse-CS could really use.

@Bananeweizen
Copy link
Collaborator

use ctrl-3, purge... to get rid of the eclipsecs cache.

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

No branches or pull requests

2 participants