mirror of
https://github.com/curl/curl.git
synced 2026-08-25 05:53:31 +03:00
cmake: replace cmakelint with cmake-lint from cmakelang, fix issues
This linter detects formatting and naming issues with minimal amount of noise. It seems to be an improvement over the existing linter which was only detecting line width overruns. Also: fix to exclude `CurlTests.c` from linter. Ref: https://cmake-format.readthedocs.io/en/latest/cmake-lint.html Ref: https://github.com/cheshirekow/cmake_format Closes #17576
This commit is contained in:
parent
56d5982312
commit
b761eb5add
12 changed files with 72 additions and 39 deletions
|
|
@ -6,7 +6,7 @@
|
|||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Dan Fandrich, <dan@coneharvesters.com>, et al.
|
||||
# Copyright (C) Dan Fandrich, <dan@coneharvesters.com>, Viktor Szakats, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
|
|
@ -23,12 +23,16 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
# https://cmake-format.readthedocs.io/en/latest/cmake-lint.html
|
||||
# https://cmake-format.readthedocs.io/en/latest/lint-usage.html
|
||||
# https://github.com/cheshirekow/cmake_format/blob/master/cmakelang/configuration.py
|
||||
|
||||
# Run cmakelint on the curl source code. It will check all files given on the
|
||||
# command-line, or else all relevant files in git, or if not in a git
|
||||
# repository, all files starting in the tree rooted in the current directory.
|
||||
#
|
||||
# cmakelint can be installed from PyPi with the command "python3 -m pip install
|
||||
# cmakelint".
|
||||
# cmake-lint can be installed from PyPi with the command "python3 -m pip
|
||||
# install cmakelang".
|
||||
#
|
||||
# The xargs invocation is portable, but does not preserve spaces in file names.
|
||||
# If such a file is ever added, then this can be portably fixed by switching to
|
||||
|
|
@ -43,8 +47,29 @@
|
|||
# strip off the leading ./ to make the grep regexes work properly
|
||||
find . -type f | sed 's@^\./@@'
|
||||
fi
|
||||
} | grep -E '(^CMake|/CMake|\.cmake$)' | grep -v -E '(\.h\.cmake|\.in)$' \
|
||||
} | grep -E '(^CMake|/CMake|\.cmake$)' | grep -v -E '(\.h\.cmake|\.in|\.c)$' \
|
||||
| xargs \
|
||||
cmakelint \
|
||||
--spaces=2 --linelength=132 \
|
||||
--filter=-whitespace/indent,-convention/filename,-package/stdargs,-readability/wonkycase
|
||||
cmake-lint \
|
||||
--suppress-decorations \
|
||||
--disable \
|
||||
--line-width 132 \
|
||||
--tab-size 2 \
|
||||
--use-tabchars false \
|
||||
--disabled-codes C0113 \
|
||||
--function-pattern 'curl_[0-9a-z_]+' \
|
||||
--macro-pattern '(curl_[0-9a-z_]+|check_include_file_concat_curl)' \
|
||||
--global-var-pattern '[A-Z][0-9A-Z_]+' \
|
||||
--internal-var-pattern '_[a-z][0-9a-z_]+' \
|
||||
--local-var-pattern '_[a-z][0-9a-z_]+' \
|
||||
--private-var-pattern '_[0-9a-z_]+' \
|
||||
--public-var-pattern '([A-Z][0-9A-Z_]+|[A-Z][A-Za-z0-9]+_FOUND|[a-z]+_SOURCES|prefix|exec_prefix|includedir|libdir|ssize_t|_FILE_OFFSET_BITS)' \
|
||||
--argument-var-pattern '_[a-z][0-9a-z_]+' \
|
||||
--keyword-pattern '[A-Z][0-9A-Z_]+' \
|
||||
--max-conditionals-custom-parser 2 \
|
||||
--min-statement-spacing 1 \
|
||||
--max-statement-spacing 2 \
|
||||
--max-returns 6 \
|
||||
--max-branches 12 \
|
||||
--max-arguments 5 \
|
||||
--max-localvars 15 \
|
||||
--max-statements 50
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue