checkstyle-idea icon indicating copy to clipboard operation
checkstyle-idea copied to clipboard

cache configuration

Open BorzdeG opened this issue 12 years ago • 13 comments

If you specify the use of a configuration with HTTP resource, the plug-in checking each time trying to pick up the file from the network. More logical to caching plugin to periodically check for updates for at least two reasons:

  1. The configuration file is not updated as often
  2. The configuration file may not be available at this time (eg IDE installed on the laptop and the developer is off-line)

BorzdeG avatar Jun 03 '13 06:06 BorzdeG

It is cached, but only for 30s :-) The reason for this is that it was an experimental feature added for someone - very little thought went into it. So it's pretty naive.

A better implementation would use caching, and fallback when the HTTP service wasn't available. It'd also be good to check for 304s and skip where required.

I'll be honest though, not high on my priorities at present.

jshiell avatar Jun 03 '13 17:06 jshiell

@jshiell We have shared checkstyle config situated in separate github project. To not manually fetch and pull changes (in case they are) - was configured http link. Sometimes there are errors in idea's event log: SocketTimeoutException: Couldn't read URL: https://raw.github.com/...checkStyle.xml: connect timed out But it's not problem. Problem is that, after a year of using such config, under USER_HOME/.IntellijIdeaX/system/tmp was found about 1,500,000 files (looking like checkStyle{20digits}.xml).

stepanovdg avatar Oct 09 '15 08:10 stepanovdg

The JVM is notoriously bad at deleting temp files. They should all be flagged for deletion on JVM shutdown, but that often doesn't work. I'll double check it in any case.

It seems odd that IDEA is redirecting the temporary directory, as otherwise the OS would ensure you wouldn't get into this state. Again, I'll double check this, but I'm pretty sure I'm using the JVM's tools for creating temp files.

jshiell avatar Oct 09 '15 08:10 jshiell

Issue for me as well.

pavel-sakun avatar Oct 09 '15 09:10 pavel-sakun

What OS(s) do you use? I don't seem to have any left over files at present (emphasis on at present - could be OS, could just be luck, I'm on OS X 10.11).

jshiell avatar Oct 09 '15 17:10 jshiell

Looking further, it seems that the HTTP path relies entirely on File.deleteOnExit() to clean up. Given how unreliable it is, I'll have a think about how this can be improved.

jshiell avatar Oct 09 '15 17:10 jshiell

I've made a change so the HTTP fetch is now done in memory, rather than using a temp file. It's had next to no testing though, as I'd tied up this evening, hence it's only a test build. But if you could please give it a try and report back your results, I'd be most grateful. Thanks.

https://dl.dropboxusercontent.com/u/5423904/checkstyle-idea-4.20.1.zip

jshiell avatar Oct 09 '15 17:10 jshiell

I have tried but plugin version is not compatible with my idea version )). May be Pavel will be more lucky.

stepanovdg avatar Oct 14 '15 10:10 stepanovdg

Have same version and moreover I stick to Java6 because of https://bulenkov.com/2013/09/12/font-rendering-apple-jdk-6-vs-oracle-jdk-1-7-0_40/

pavel-sakun avatar Oct 14 '15 11:10 pavel-sakun

I'm afraid bug fixes will only be done to head, which does need IDEA 14.x and JDK 8. IDEA publish their own JDK for use on OS X to fix the font rendering issue. I believe there are still edge cases, but I've been using that for some time with no problems.

In any case, I'll give my fix some further testing and push it out.

jshiell avatar Oct 14 '15 12:10 jshiell

Updated to 4.20.1, thank you

pavel-sakun avatar Nov 09 '15 10:11 pavel-sakun

Seems to be working fine, no issues found so far.

pavel-sakun avatar Nov 12 '15 16:11 pavel-sakun

Superb, thanks for the update!

jshiell avatar Nov 12 '15 17:11 jshiell