Skip to content

Commit

Permalink
💚 (analysis): Fix clang-tidy version selection
Browse files Browse the repository at this point in the history
- use latest first
- test for 15 then 14 then fallback to local system
- print version selected
  • Loading branch information
ladislas committed Oct 27, 2022
1 parent 60cbe65 commit dc16322
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/run-clang-tidy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@ def log_debug(message)
log_debug "Find clang-tidy"
$CLANG_TIDY_EXEC = ""

if system("which clang-tidy > /dev/null")
$CLANG_TIDY_EXEC = "clang-tidy"
if system("which clang-tidy-15 > /dev/null")
$CLANG_TIDY_EXEC = "clang-tidy-15"
elsif system("which clang-tidy-14 > /dev/null")
$CLANG_TIDY_EXEC = "clang-tidy-14"
elsif system("which clang-tidy-13 > /dev/null")
$CLANG_TIDY_EXEC = "clang-tidy-13"
elsif system("which /opt/homebrew/opt/llvm/bin/clang-tidy > /dev/null")
$CLANG_TIDY_EXEC = "/opt/homebrew/opt/llvm/bin/clang-tidy"
elsif system("which /usr/local/opt/llvm/bin/clang-tidy > /dev/null")
$CLANG_TIDY_EXEC = "/usr/local/opt/llvm/bin/clang-tidy"
else
abort("No suitable version of clang-tidy found...")
end

puts "Clang-tidy found at: #{$CLANG_TIDY_EXEC}"
puts `#{$CLANG_TIDY_EXEC} --version`
puts

puts "Standard headers search dirs:"
puts $tmp_search_dirs.map { |d| " #{d}" }.join("\n")
Expand Down

0 comments on commit dc16322

Please sign in to comment.