diff --git a/ci/CMakeLists.txt b/ci/CMakeLists.txt index e009a043b..01b7c6982 100644 --- a/ci/CMakeLists.txt +++ b/ci/CMakeLists.txt @@ -39,7 +39,8 @@ if(NOT WIN32) --suppress=noOperatorEq --suppress=ignoredReturnValue --suppress=unknownMacro --suppress=unmatchedSuppression --suppress=unusedScopedObject --suppress=unusedFunction - --suppress=shadowArgument --suppress=shadowVariable ${SRCS} + --suppress=shadowFunction --suppress=shadowArgument + --suppress=functionStatic --suppress=shadowVariable ${SRCS} COMMENT "cppcheck" VERBATIM ) diff --git a/src/del/dirctrl.cpp b/src/del/dirctrl.cpp index bf8da8f47..66930c439 100644 --- a/src/del/dirctrl.cpp +++ b/src/del/dirctrl.cpp @@ -71,10 +71,10 @@ wex::del::dirctrl::dirctrl(frame* frame, const data::window& data) data::dir::type_t().set(data::dir::FILES)); }, ID_EDIT_OPEN}, - {[=, this](wxCommandEvent& event) + {[=, this](const wxCommandEvent& event) { on_selected_paths( - [=, this](const std::vector p) + [=, this](const std::vector& p) { build(path_lexer(p[0])); }); @@ -114,7 +114,7 @@ wex::del::dirctrl::dirctrl(frame* frame, const data::window& data) [=, this](wxTreeEvent& event) { on_selected_paths( - [=, this](const std::vector p) + [=, this](const std::vector& p) { if (const auto& fn(p[0]); !fn.file_exists() && fn.dir_exists()) { @@ -140,10 +140,10 @@ wex::del::dirctrl::dirctrl(frame* frame, const data::window& data) Bind( wxEVT_TREE_ITEM_MENU, - [=, this](wxTreeEvent& event) + [=, this](const wxTreeEvent& event) { on_selected_paths( - [=, this](const std::vector p) + [=, this](const std::vector& p) { const wex::path_lexer filename(p[0]); @@ -199,10 +199,10 @@ wex::del::dirctrl::dirctrl(frame* frame, const data::window& data) Bind( wxEVT_TREE_SEL_CHANGED, - [=, this](wxTreeEvent& event) + [=, this](const wxTreeEvent& event) { on_selected_paths( - [=, this](const std::vector p) + [=, this](const std::vector& p) { log::status() << p[0]; }); diff --git a/src/ex/global-env.cpp b/src/ex/global-env.cpp index a05ce3966..fe83a747d 100644 --- a/src/ex/global-env.cpp +++ b/src/ex/global-env.cpp @@ -201,7 +201,7 @@ bool wex::global_env::process(addressrange_mark& am, const block_lines& block) m_ex->command_parsed_data().text().ends_with('$') ? 1 : 0)); - bool skip = false; + bool skipped = false; while (m_lines_skip.contains(line) && line < m_ex->get_stc()->get_line_count()) @@ -211,11 +211,11 @@ bool wex::global_env::process(addressrange_mark& am, const block_lines& block) return false; } - skip = true; + skipped = true; line++; } - if (skip) + if (skipped) { return true; } diff --git a/src/lsp/diagnostics.cpp b/src/lsp/diagnostics.cpp index c709a030a..caa6c9bd7 100644 --- a/src/lsp/diagnostics.cpp +++ b/src/lsp/diagnostics.cpp @@ -5,6 +5,9 @@ // Copyright: (c) 2026 Anton van Wezenbeek //////////////////////////////////////////////////////////////////////////////// +#include +#include + #include namespace wex @@ -53,13 +56,13 @@ diagnostics_t diagnostics::get_line(const std::string& uri, int line) const std::vector result; const auto& diags = get(uri); - for (const auto& diag : diags) - { - if (diag.range.start.line == line || diag.range.end.line == line) + std::ranges::copy_if( + diags, + std::back_inserter(result), + [line](const diagnostic_item& diag) { - result.push_back(diag); - } - } + return diag.range.start.line == line || diag.range.end.line == line; + }); return result; } @@ -67,6 +70,7 @@ diagnostics_t diagnostics::get_line(const std::string& uri, int line) const std::vector diagnostics::get_uris() const { std::vector uris; + uris.reserve(m_diagnostics.size()); for (const auto& pair : m_diagnostics) {