/ tools / cmake / run_cmake_lint.sh
run_cmake_lint.sh
 1  #!/usr/bin/env bash
 2  #
 3  # Run cmakelint on all cmake files in IDF_PATH (except third party)
 4  #
 5  # cmakelint: https://github.com/richq/cmake-lint
 6  #
 7  # NOTE: This script makes use of features in (currently unreleased)
 8  # cmakelint >1.4. Install directly from github as follows:
 9  #
10  # pip install https://github.com/richq/cmake-lint/archive/058c6c0ed2536.zip
11  #
12  
13  if [ -z "${IDF_PATH}" ]; then
14      echo "IDF_PATH variable needs to be set"
15      exit 3
16  fi
17  
18  cd "$IDF_PATH"
19  
20  # Only list the "main" IDF repo, don't check any files in submodules (which may contain
21  # third party CMakeLists.txt)
22   git ls-tree --full-tree --name-only -r HEAD | grep -v "/third_party/" | grep "^CMakeLists.txt$\|\.cmake$" \
23      | xargs cmakelint --linelength=120 --spaces=4
24  
25