Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SiarheiFedartsou
Copy link
Member

Please don't force-push once you received the first review.

Issue

I just want to experiment how easy it would be to start running clang-tidy against the whole code base on each CI run. I did something like this in OSRM already - it was successful, let's see how it will go...

Tasklist

  • Add tests
  • Add #fixes with the issue number that this PR addresses
  • Update the docs with any new request parameters or changes to behavior described
  • Update the changelog
  • If you made changes to the lua files, update the taginfo too
  • If you made changes to a translation file, update transifex too

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@nilsnolde
Copy link
Member

what's the difference to

- name: Run clang-tidy
run: scripts/clang-tidy-only-diff.sh $(nproc)
other than moving into cmake?

CMakeLists.txt Outdated
Comment on lines 237 to 245
if (ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(FATAL_ERROR "ENABLE_CLANG_TIDY is ON but clang-tidy is not found!")
else()
message(STATUS "Found clang-tidy at ${CLANG_TIDY_COMMAND}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};--warnings-as-errors=*")
endif()
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running clang-tidy on full codebase on every PR is horribly slow. I would keep approach via scripts/clang-tidy-only-diff.sh. Still, it is a good idea to run it on all codebase every year or every release...

Comment on lines 48 to 51
using watch_function_t = std::function<void(boost::property_tree::ptree,
std::unordered_set<valhalla::baldr::GraphId>,
std::shared_ptr<state_t>,
std::function<bool(size_t)>)>;
using watch_function_t = std::function<void(const boost::property_tree::ptree&,
const std::unordered_set<valhalla::baldr::GraphId>&,
const std::shared_ptr<state_t>&,
const std::function<bool(size_t)>&)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it is better not to pass references to the separate thread because of possible lifetime issues

@SiarheiFedartsou
Copy link
Member Author

what's the difference to

- name: Run clang-tidy
run: scripts/clang-tidy-only-diff.sh $(nproc)
other than moving into cmake?

Well, at least it allows running clang-tidy against the whole codebase when we need it(may be indeed running it on each CI is not a good idea as @kinkard mentioned though)... but in general I'd want to at least use this opportunity to enable more checks...

nilsnolde
nilsnolde previously approved these changes Nov 1, 2025
const std::string old_to_new_file = "old_nodes_to_new_nodes.bin";

uint64_t get_pbf_checksum(std::vector<std::string> paths, const std::string& tile_dir) {
uint64_t get_pbf_checksum(std::vector<std::string> paths, const std::string& /*tile_dir*/) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, this could be entirely removed, it's only called once. feel free to ignore

cxx_add_warning_flags(${library})
endif()

if(ENABLE_CLANG_TIDY AND NOT MODULE_DISABLE_CLANG_TIDY)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nilsnolde
Copy link
Member

oops, not ready yet 😅

@SiarheiFedartsou
Copy link
Member Author

oops, not ready yet 😅

Yes, I am slowly working on it when having some spare time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants