diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 40fdba1..154169e 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -13,296 +13,210 @@ # # A module to create custom targets to lint source files using clang-tidy # -# The function swift_setup_clang_tidy will create several targets which will -# use clang-tidy to lint source files. 2 types of targets will be created, one -# for linting all listed source files and the other for linting only those which -# differ from the master branch. The list of file to lint can be created in 2 -# ways which are explained below. +# Call swift_create_clang_tidy_targets at the end of the top level CMakeLists.txt to create targets for running clang-tidy # -# The created targets have the names +# clang-tidy version 6 must be available on the system for this module to work properly. If an appropriate clang-tidy can't be found no targets will be created and a warning will +# be logged # -# - clang-tidy-all-${PROJECT_NAME} - lints all files -# - clang-tidy-diff-${PROJECT_NAME} - lints only changed files +# swift_create_clang_tidy_targets will only have an effect for top level projects. If called within a subproject it will return without taking any action # -# In addition if the current project is at the top level of the working tree 2 more -# targets will be created +# For every compilable target defined within the calling repository two targets will be created. # -# - clang-tidy-all -# - clang-tidy-diff +# The first target 'clang-tidy-${target}' will invoke clang-tidy for all source files which make up the given target. It will export fixes to a file called 'fixes-${target}.yaml' +# in the top level project source directory. # -# which behave in exactly the same way as the namespaced targets. +# The second target 'clang-tidy-${target}-check' will run clang-tidy as the target described above and then return an error code if any warning/errors were generated # -# The parameter SCRIPT can be passed to specify a custom linting script. If given -# the create targets will call this script directly. The script will be passed -# a single argument of 'all' or 'diff' according to the target +# In addition there are two other targets created which lint multiple targets at the same time # -# clang-tidy-all - will run `