-
Notifications
You must be signed in to change notification settings - Fork 158
Description
Problem description
The following methods inside PsiFileValidator#isScannable always call PluginConfigurationManager#getCurrent():
checkstyle-idea/src/main/java/org/infernus/idea/checkstyle/checker/PsiFileValidator.java
Lines 37 to 39 in 34562bc
| && isInSource(psiFile, pluginConfig, overrideConfigLocation) | |
| && isValidFileType(psiFile, pluginConfig) | |
| && isScannableIfTest(psiFile, pluginConfig) |
The call to PluginConfigurationManager#getCurrent() always causes the complete configuration to be populated:
checkstyle-idea/src/main/java/org/infernus/idea/checkstyle/config/PluginConfigurationManager.java
Lines 42 to 46 in 538dc0f
| public PluginConfiguration getCurrent() { | |
| final PluginConfigurationBuilder defaultConfig = PluginConfigurationBuilder.defaultConfiguration(project); | |
| return projectConfigurationState() | |
| .populate(defaultConfig) | |
| .build(); |
Currently this only causes a noteworthy performance impact when (bulk) scanning a lot of files, however it's still noteable.
I was not able to find any valid explanation for the current behavior. According to git blame the code was last touched in 2015.
Proposed solution
Hand over the PluginConfiguration instead of the PluginConfigurationManager and only get the configuration once