Skip to content

Commit

Permalink
shellcheck.sh
Browse files Browse the repository at this point in the history
Call from source directory without configuring (contrib/CI/shellcheck.sh <path>)
Call from build directory (make shellcheck)

Closes #28
  • Loading branch information
calccrypto committed Sep 26, 2023
1 parent d520634 commit ac5bada
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
- name: Install ShellCheck
run: sudo apt -y install shellcheck
- name: Run ShellCheck
run: shellcheck -s bash -e SC1091 $(find -name "*.sh" | sort)
run: contrib/CI/shellcheck.sh .
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ add_subdirectory(src)
enable_testing()
add_subdirectory(tests)

# set up extra files
add_subdirectory(contrib)

# optionally build docs
find_package(Doxygen COMPONENTS dot)
if (DOXYGEN_FOUND)
Expand Down
7 changes: 7 additions & 0 deletions contrib/CI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# enable make shellcheck
find_program(SHELLCHECK shellcheck)
if (SHELLCHECK)
message(STATUS "Shellcheck found. Run 'make shellcheck' to check for shell script issues")
configure_file(shellcheck.sh shellcheck.sh COPYONLY)
add_custom_target(shellcheck "${CMAKE_CURRENT_BINARY_DIR}/shellcheck.sh" "${CMAKE_BINARY_DIR}")
endif()
6 changes: 6 additions & 0 deletions contrib/CI/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

# shellcheck disable=SC2046
shellcheck -s bash -e SC1091 $(find "$@" -name "*.sh" | sort)
1 change: 1 addition & 0 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(CI)

0 comments on commit ac5bada

Please sign in to comment.