mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 11:31:15 -03:00
fixes for cppcheck lint warnings
Refine the linting behavior. Fix several of the, mostly trivial, lint errors.
This commit is contained in:
@@ -57,8 +57,14 @@ if set -q c_files[1]
|
||||
echo ========================================
|
||||
echo Running cppcheck
|
||||
echo ========================================
|
||||
# The stderr to stdout redirection is because cppcheck, incorrectly
|
||||
# IMHO, writes its diagnostic messages to stderr. Anyone running
|
||||
# this who wants to capture its output will expect those messages to be
|
||||
# written to stdout.
|
||||
cppcheck -q --verbose --std=posix --std=c11 --language=c++ \
|
||||
--inline-suppr --enable=$cppchecks $cppcheck_args $c_files
|
||||
--template "[{file}:{line}]: {severity} ({id}): {message}" \
|
||||
--suppress=missingIncludeSystem \
|
||||
--inline-suppr --enable=$cppchecks $cppcheck_args $c_files 2>&1
|
||||
end
|
||||
|
||||
if type -q oclint
|
||||
@@ -66,6 +72,10 @@ if set -q c_files[1]
|
||||
echo ========================================
|
||||
echo Running oclint
|
||||
echo ========================================
|
||||
# The stderr to stdout redirection is because oclint, incorrectly
|
||||
# writes its final summary counts of the errors detected to stderr.
|
||||
# Anyone running this who wants to capture its output will expect those
|
||||
# messages to be written to stdout.
|
||||
if test (uname -s) = "Darwin"
|
||||
if not test -f compile_commands.json
|
||||
xcodebuild > xcodebuild.log
|
||||
@@ -73,19 +83,19 @@ if set -q c_files[1]
|
||||
end
|
||||
if test $all = yes
|
||||
oclint-json-compilation-database -e '/pcre2-10.20/' \
|
||||
-- -enable-global-analysis
|
||||
-- -enable-global-analysis 2>&1
|
||||
else
|
||||
set i_files
|
||||
for f in $c_files
|
||||
set i_files $i_files -i $f
|
||||
end
|
||||
echo oclint-json-compilation-database -e '/pcre2-10.20/' $i_files
|
||||
oclint-json-compilation-database -e '/pcre2-10.20/' $i_files
|
||||
oclint-json-compilation-database -e '/pcre2-10.20/' $i_files 2>&1
|
||||
end
|
||||
else
|
||||
# Presumably we're on Linux or other platform not requiring special
|
||||
# handling for oclint to work.
|
||||
oclint $c_files -- $argv
|
||||
oclint $c_files -- $argv 2>&1
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user