Skip to content

Commit ab02ebe

Browse files
committed
fix: improve checkstyle and maven configuration checks
1 parent 0398e69 commit ab02ebe

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

after/ftplugin/java.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ end
6262

6363
-- see mfussenegger/dotfiles
6464
local checkstyle_config = vim.fs.joinpath(vim.uv.cwd(), "checkstyle.xml")
65-
local has_checkstyle = vim.uv.fs_stat(checkstyle_config) and vim.fn.executable("checkstyle")
65+
local has_checkstyle = vim.fn.filereadable(checkstyle_config) == 1
66+
local checkstyle_bin = vim.fn.executable("checkstyle") == 1
6667
local is_main = vim.api.nvim_buf_get_name(0):find("src/main/java") ~= nil
67-
if has_checkstyle and is_main then
68+
if has_checkstyle and checkstyle_bin and is_main then
6869
local bufnr = vim.api.nvim_get_current_buf()
6970
require("lint.linters.checkstyle").config_file = checkstyle_config
7071
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {

lua/kide/tools/maven.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local function maven_settings()
1010
local maven_home = vim.env["MAVEN_HOME"]
1111
if maven_home then
1212
local settings_xml = vim.fs.joinpath(maven_home, "conf", "settings.xml")
13-
if vim.fn.filereadable(settings_xml) then
13+
if vim.fn.filereadable(settings_xml) == 1 then
1414
return settings_xml
1515
end
1616
end

0 commit comments

Comments
 (0)