Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into refactor/type_tr…
Browse files Browse the repository at this point in the history
…aits
  • Loading branch information
SteveBronder committed Sep 3, 2019
2 parents e17d59c + 02ea81d commit d146a0d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ lib/boost_*/stage/
lib/boost_*/tools/build/*
!lib/boost_*/tools/build/src*
lib/boost_*/user-config.jam

# clang-tidy output
.clang-fixes.log
23 changes: 23 additions & 0 deletions make/clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See full list of checks here
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
tidy_base_checks=*perf*,*modernize*,*misc*,*google*,*readability*,*optin*
modern_excludes=,-modernize-replace-random-shuffle,-modernize-use-override,-modernize-concat-nested-namespaces,-modernize-avoid-c-arrays
readability_excludes=,-readability-magic-numbers,-readability-convert-member-functions-to-static,-readability-inconsistent-declaration-parameter-name,-readability-function-size,-readability-named-parameter,-readability-container-size-empty,-readability-implicit-bool-conversion,-readability-else-after-return,-readability-container-size-empty
misc_excludes=,-misc-non-private-member-variables-in-classes,-misc-unused-parameters,-misc-unused-using-decls,-misc-definitions-in-headers,-misc-unconventional-assign-operator
google_excludes=,-google-runtime-references,-google-global-names-in-headers,-google-build-using-namespace,-google-runtime-int
things_we_should_look_at=,-google-readability-casting,-google-explicit-constructor,-modernize-use-using,-modernize-pass-by-value,-readability-implicit-bool-conversion,-readability-const-return-type,-readability-avoid-const-params-in-decls,-modernize-return-braced-init-list,-modernize-use-using
tidy_checks?= $(tidy_base_checks) $(modern_excludes) $(readability_excludes) $(misc_excludes) $(google_excludes) $(things_we_should_look_at)
files?= *
folder?= ./test/unit/*
.PHONY: clang-tidy
clang-tidy:
find $(folder) -path './test/unit/*' -wholename '*$(files).cpp' -type f | xargs -I {} clang-tidy "{}" \
-checks='$(tidy_checks)' -format-style='file' -header-filter='./stan/*' \
-- $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) $(INC_GTEST) $(CXXFLAGS_GTEST) $(CPPFLAGS)

.PHONY: clang-tidy-fix
clang-tidy-fix:
find $(folder) -path './test/unit/*' -wholename '*$(files).cpp' -type f | xargs -I {} clang-tidy "{}" \
-checks='$(tidy_checks)' -format-style='file' -header-filter='./stan/*' \
-fix -export-fixes="./.clang-fixes.log" \
-- $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) $(INC_GTEST) $(CXXFLAGS_GTEST) $(CPPFLAGS)
2 changes: 1 addition & 1 deletion make/test-math-dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##
##
# Function to search code for warnings.
#
# After all the warnings are found, use
Expand Down
17 changes: 17 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include make/dependencies # rules for generating dependencies
include make/libraries
include make/tests
include make/cpplint
include make/clang-tidy

.PHONY: help
help:
Expand Down Expand Up @@ -56,6 +57,22 @@ help:
@echo ' To set the version of python 2, set the PYTHON2 variable:'
@echo ' PYTHON2 = $(PYTHON2)'
@echo ''
@echo ' Clang Tidy'
@echo ' - clang-tidy : runs the clang-tidy makefile over the test suite.'
@echo ' Options:'
@echo ' files: (Optional) regex for file names to include in the check'
@echo ' Default runs all the tests in unit'
@echo ' tidy_checks: (Optional) A set of checks'
@echo ' Default runs a hand picked selection of tests'
@echo ''
@echo ' Example: This runs clang-tidy over all the multiply tests in prim'
@echo ''
@echo ' make clang-tidy files=*prim*multiply*'
@echo ''
@echo ' - clang-tidy-fix : same as above but runs with the -fix flag.'
@echo ' For automated fixes, outputs a yaml named'
@echo ' .clang-fixes.yml'
@echo ''
@echo 'Documentation:'
@echo ' Doxygen'
@echo ' - doxygen : runs doxygen on source files. requires doxygen.'
Expand Down

0 comments on commit d146a0d

Please sign in to comment.