mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 19:19:06 +08:00
cmake add nuttx shellcheck helper
This commit is contained in:
parent
096c41b041
commit
52e1b59e60
@ -144,3 +144,22 @@ add_custom_command(OUTPUT nsh_romfsimg.c
|
||||
add_library(romfs STATIC nsh_romfsimg.c)
|
||||
add_dependencies(romfs prebuild_targets)
|
||||
set_target_properties(romfs PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
|
||||
# shellcheck
|
||||
find_program(SHELLCHECK_PATH shellcheck)
|
||||
|
||||
if(SHELLCHECK_PATH)
|
||||
# TODO: fix SC2039, SC2086, SC2166
|
||||
add_custom_target(shellcheck
|
||||
COMMAND ${SHELLCHECK_PATH} --shell=sh
|
||||
--exclude=SC2121 # SC2121: To assign a variable, use just 'var=value'
|
||||
--exclude=SC2086 # SC2086: Double quote to prevent globbing and word splitting.
|
||||
--exclude=SC2039 # SC2039: In POSIX sh, == in place of = is undefined.
|
||||
--exclude=SC2166 # SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
|
||||
init.d/*
|
||||
DEPENDS ${romfs_gen_root_dir}/init.d/rc.autostart
|
||||
WORKING_DIRECTORY ${romfs_gen_root_dir}
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -40,7 +40,8 @@ if [ "$PX4_SIM_MODEL" = "shell" ]; then
|
||||
set RUN_MINIMAL_SHELL yes
|
||||
else
|
||||
# Find the matching Autostart ID (file name has the form: [0-9]+_${PX4_SIM_MODEL})
|
||||
# shellcheck disable=SC2012 #(the file names don't contain spaces)
|
||||
# TODO: unify with rc.autostart generation
|
||||
# shellcheck disable=SC2012
|
||||
REQUESTED_AUTOSTART=$(ls "$SCRIPT_DIR" | sed -n 's/^\([0-9][0-9]*\)_'${PX4_SIM_MODEL}'$/\1/p')
|
||||
if [ -z "$REQUESTED_AUTOSTART" ]; then
|
||||
echo "Error: Unknown model '$PX4_SIM_MODEL'"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user