From 3344c478ee44993f4bd8b246f20776982a19a77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Mon, 28 Aug 2023 19:14:35 +0200 Subject: [PATCH] Fix clang-tidy and add :AP cmd --- clang/.clang-tidy | 3 +-- nvim/lua/teaching.lua | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/clang/.clang-tidy b/clang/.clang-tidy index ee1d88a..6f9e73a 100644 --- a/clang/.clang-tidy +++ b/clang/.clang-tidy @@ -17,8 +17,7 @@ Checks: "*, -cppcoreguidelines-narrowing-conversions -cppcoreguidelines-avoid-magic-numbers --Wsign-compare - -readability-uppercase-literal-suffix -" + -readability-uppercase-literal-suffix" WarningsAsErrors: '' HeaderFilterRegex: '' FormatStyle: none diff --git a/nvim/lua/teaching.lua b/nvim/lua/teaching.lua index e012057..d0a54b0 100644 --- a/nvim/lua/teaching.lua +++ b/nvim/lua/teaching.lua @@ -5,9 +5,19 @@ local function ends_with(path, extension) end local function should_load(path) - if string.find(path, "build") or string.find(path, "sfml") then - return false - elseif ends_with(path, ".h") or ends_with(path, ".cpp") or ends_with(path, ".cpp") or ends_with(path, ".cpp") then + local ignore = { + [1] = "rapidjson", + [2] = "json.hpp", + [3] = "build", + [4] = "third-party", + [5] = "sfml", + } + for _, pattern in ipairs(ignore) do + if string.find(path, pattern, 0, true) then + return false + end + end + if ends_with(path, ".h") or ends_with(path, ".cpp") or ends_with(path, ".cpp") or ends_with(path, ".cpp") then return true end end @@ -29,4 +39,6 @@ function teaching.load() vim.api.nvim_set_current_dir(cwd) end +vim.api.nvim_create_user_command("AP", teaching.load, {}) + return teaching