diff --git a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikChecksCodeActionProvider.java b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikChecksCodeActionProvider.java index 6db033f6..24b3b2b2 100644 --- a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikChecksCodeActionProvider.java +++ b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikChecksCodeActionProvider.java @@ -55,7 +55,9 @@ private boolean isCheckEnabled(final MagikFile magikFile, final Class checkCl final Path configPath = MagikSettings.INSTANCE.getChecksOverrideSettingsPath() != null ? MagikSettings.INSTANCE.getChecksOverrideSettingsPath() : ConfigurationLocator.locateConfiguration(searchPath); - final Configuration config = new Configuration(configPath); + final Configuration config = configPath != null + ? new Configuration(configPath) + : new Configuration(); final List allChecks = MagikLint.getAllChecks(config); for (final MagikCheckHolder checkHolder : allChecks) { if (checkHolder.getCheckClass().equals(checkClass)) { diff --git a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikTypedChecksCodeActionProvider.java b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikTypedChecksCodeActionProvider.java index c10aaeca..ced80da0 100644 --- a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikTypedChecksCodeActionProvider.java +++ b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/codeactions/MagikTypedChecksCodeActionProvider.java @@ -55,7 +55,9 @@ private boolean isCheckEnabled(final MagikFile magikFile, final Class checkCl final Path configPath = MagikSettings.INSTANCE.getChecksOverrideSettingsPath() != null ? MagikSettings.INSTANCE.getChecksOverrideSettingsPath() : ConfigurationLocator.locateConfiguration(searchPath); - final Configuration config = new Configuration(configPath); + final Configuration config = configPath != null + ? new Configuration(configPath) + : new Configuration(); final List allChecks = MagikLint.getAllChecks(config); for (final MagikCheckHolder checkHolder : allChecks) { if (checkHolder.getCheckClass().equals(checkClass)) { diff --git a/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/ConfigurationLocator.java b/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/ConfigurationLocator.java index e3338e7e..cc9c4ff3 100644 --- a/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/ConfigurationLocator.java +++ b/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/ConfigurationLocator.java @@ -57,6 +57,7 @@ public static void resetCache() { * @param searchPath Path to start looking from, a directory. * @return Return the path to the configuration to use. */ + @CheckForNull public static Path locateConfiguration(final Path searchPath) { LOGGER.trace("Search path: {}", searchPath.toAbsolutePath());