1*6236dae4SAndroid Build Coastguard Worker#!/bin/sh 2*6236dae4SAndroid Build Coastguard Worker#*************************************************************************** 3*6236dae4SAndroid Build Coastguard Worker# _ _ ____ _ 4*6236dae4SAndroid Build Coastguard Worker# Project ___| | | | _ \| | 5*6236dae4SAndroid Build Coastguard Worker# / __| | | | |_) | | 6*6236dae4SAndroid Build Coastguard Worker# | (__| |_| | _ <| |___ 7*6236dae4SAndroid Build Coastguard Worker# \___|\___/|_| \_\_____| 8*6236dae4SAndroid Build Coastguard Worker# 9*6236dae4SAndroid Build Coastguard Worker# Copyright (C) Dan Fandrich, <[email protected]>, et al. 10*6236dae4SAndroid Build Coastguard Worker# 11*6236dae4SAndroid Build Coastguard Worker# This software is licensed as described in the file COPYING, which 12*6236dae4SAndroid Build Coastguard Worker# you should have received as part of this distribution. The terms 13*6236dae4SAndroid Build Coastguard Worker# are also available at https://curl.se/docs/copyright.html. 14*6236dae4SAndroid Build Coastguard Worker# 15*6236dae4SAndroid Build Coastguard Worker# You may opt to use, copy, modify, merge, publish, distribute and/or sell 16*6236dae4SAndroid Build Coastguard Worker# copies of the Software, and permit persons to whom the Software is 17*6236dae4SAndroid Build Coastguard Worker# furnished to do so, under the terms of the COPYING file. 18*6236dae4SAndroid Build Coastguard Worker# 19*6236dae4SAndroid Build Coastguard Worker# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20*6236dae4SAndroid Build Coastguard Worker# KIND, either express or implied. 21*6236dae4SAndroid Build Coastguard Worker# 22*6236dae4SAndroid Build Coastguard Worker# SPDX-License-Identifier: curl 23*6236dae4SAndroid Build Coastguard Worker# 24*6236dae4SAndroid Build Coastguard Worker########################################################################### 25*6236dae4SAndroid Build Coastguard Worker 26*6236dae4SAndroid Build Coastguard Worker# Run cmakelint on the curl source code. It will check all files given on the 27*6236dae4SAndroid Build Coastguard Worker# command-line, or else all relevant files in git, or if not in a git 28*6236dae4SAndroid Build Coastguard Worker# repository, all files starting in the tree rooted in the current directory. 29*6236dae4SAndroid Build Coastguard Worker# 30*6236dae4SAndroid Build Coastguard Worker# cmakelint can be installed from PyPi with the command "python3 -m pip install 31*6236dae4SAndroid Build Coastguard Worker# cmakelint". 32*6236dae4SAndroid Build Coastguard Worker# 33*6236dae4SAndroid Build Coastguard Worker# The xargs invocation is portable, but does not preserve spaces in file names. 34*6236dae4SAndroid Build Coastguard Worker# If such a file is ever added, then this can be portably fixed by switching to 35*6236dae4SAndroid Build Coastguard Worker# "xargs -I{}" and appending {} to the end of the xargs arguments (which will 36*6236dae4SAndroid Build Coastguard Worker# call cmakelint once per file) or by using the GNU extension "xargs -d'\n'". 37*6236dae4SAndroid Build Coastguard Worker{ 38*6236dae4SAndroid Build Coastguard Worker if [ -n "$1" ]; then 39*6236dae4SAndroid Build Coastguard Worker for A in "$@"; do printf "%s\n" "$A"; done 40*6236dae4SAndroid Build Coastguard Worker elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then 41*6236dae4SAndroid Build Coastguard Worker git ls-files 42*6236dae4SAndroid Build Coastguard Worker else 43*6236dae4SAndroid Build Coastguard Worker # strip off the leading ./ to make the grep regexes work properly 44*6236dae4SAndroid Build Coastguard Worker find . -type f | sed 's@^\./@@' 45*6236dae4SAndroid Build Coastguard Worker fi 46*6236dae4SAndroid Build Coastguard Worker} | grep -E '(/CMake|\.cmake$)' | grep -v -E '(\.h\.cmake|\.in)$' \ 47*6236dae4SAndroid Build Coastguard Worker | xargs \ 48*6236dae4SAndroid Build Coastguard Worker cmakelint \ 49*6236dae4SAndroid Build Coastguard Worker --spaces=2 --linelength=132 \ 50*6236dae4SAndroid Build Coastguard Worker --filter=-whitespace/indent,-convention/filename,-package/stdargs 51