mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-20 12:34:18 +02:00
Apply shellcheck
This commit is contained in:
parent
358f759166
commit
8fbcba1c38
11 changed files with 61 additions and 35 deletions
|
|
@ -19,6 +19,7 @@ do
|
|||
curr_workspace="$(echo "${event}"|jq -r ".outputs.${curr_output}.curr_workspace")"
|
||||
# Print the process names of the view on the current workspace. jq retrieves
|
||||
# their PID and ps is then used to retrieve the process names.
|
||||
# shellcheck disable=2046
|
||||
(echo -n "message ";ps -o comm=Command -p $(echo "${event}"|jq -r ".outputs.${curr_output}.workspaces[$((curr_workspace-1))].views[].pid")|tail +2|sed ':a; N; $!ba; s/\n/||/g') >&3
|
||||
break
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@ test('Build without warnings', find_program('test/build-w-o-warnings'), env : [
|
|||
test('Build without xwayland', find_program('test/build-w-o-xwayland'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
|
||||
test('Copyright and LICENSE', find_program('test/copyright-license'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings + fuzz_sources + fuzz_headers + fuzz_override_lib ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()), ''.join('MESONLICENSE=', meson.project_license())], suite: 'devel' )
|
||||
test('Clang-format (formatting check)', find_program('test/clang-format'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings + fuzz_sources + fuzz_headers + fuzz_override_lib ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
|
||||
test('Shellcheck (script linting)', find_program('test/shellcheck'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
|
||||
test('Arguments', find_program('test/arguments'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
|
||||
test('Environment Variables', find_program('test/environment-variables'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
|
||||
test('Scan-build (static analysis)', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release')
|
||||
|
|
|
|||
|
|
@ -24,23 +24,23 @@ RESULT=0
|
|||
[[ $(2>&1 ./cagebreak -c | head -1 ) = "./cagebreak: option requires an argument -- 'c'" ]] || RESULT=1
|
||||
[[ $(2>&1 ./cagebreak -c | tail -n +2 ) = "$helptext" ]] || RESULT=1
|
||||
## Check with config file
|
||||
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/-c-config $testdir
|
||||
sed -i "s|CONFIGPATH|$testdir\/result|g" $testdir/-c-config
|
||||
WLR_BACKENDS=headless ./cagebreak -c $testdir/-c-config
|
||||
[[ $(cat $testdir/result) = "SUCCESS" ]] || RESULT=1
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/-c-config" "${testdir}"
|
||||
sed -i "s|CONFIGPATH|${testdir}\/result|g" "${testdir}/-c-config"
|
||||
WLR_BACKENDS=headless ./cagebreak -c "${testdir}/-c-config"
|
||||
[[ $(cat "${testdir}/result") = "SUCCESS" ]] || RESULT=1
|
||||
|
||||
# check -e option
|
||||
## Check without socket
|
||||
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}"
|
||||
readonly oldsocket=$CAGEBREAK_SOCKET
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
|
||||
$(WLR_BACKENDS=headless ./cagebreak -c $testdir/config)
|
||||
[[ $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
|
||||
sed -i "s|CONFIGPATH|${testdir}\/socket|g" "${testdir}/config"
|
||||
(WLR_BACKENDS=headless ./cagebreak -c "${testdir}/config")
|
||||
[[ $(cat "${testdir}/socket") = "${oldsocket}" ]] || RESULT=1
|
||||
## Check with socket
|
||||
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
|
||||
$(WLR_BACKENDS=headless ./cagebreak -e -c $testdir/config)
|
||||
[[ ! $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}"
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" "${testdir}/config"
|
||||
(WLR_BACKENDS=headless ./cagebreak -e -c "${testdir}/config")
|
||||
[[ ! $(cat "${testdir}/socket") = "${oldsocket}" ]] || RESULT=1
|
||||
|
||||
# check -h option
|
||||
[[ $(./cagebreak -h) = "$helptext" ]] || RESULT=1
|
||||
|
|
@ -52,4 +52,4 @@ $(WLR_BACKENDS=headless ./cagebreak -e -c $testdir/config)
|
|||
# check -v option
|
||||
[[ $(./cagebreak -v) = "Cagebreak version $1" ]] || RESULT=1
|
||||
|
||||
exit $RESULT
|
||||
exit "${RESULT}"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
RESULT=0
|
||||
|
||||
cd $MESONCURRENTCONFIGDIR
|
||||
# shellcheck disable=SC2164
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
echo "Build standard release build"
|
||||
rm -rf test/test-w-o-warnings
|
||||
meson setup test/test-w-o-warnings -Dxwayland=true -Dman-pages=true --buildtype=release --fatal-meson-warnings || RESULT=1
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
RESULT=0
|
||||
|
||||
cd $MESONCURRENTCONFIGDIR
|
||||
# shellcheck disable=2164
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
echo "Build without xwayland"
|
||||
rm -rf test/test-w-o-xwayland
|
||||
meson setup test/test-w-o-xwayland -Dxwayland=false -Dman-pages=false --buildtype=release --fatal-meson-warnings || RESULT=1
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
readonly declared_deps="${@}"
|
||||
readonly declared_deps="${*}"
|
||||
readonly deps="${declared_deps}"
|
||||
|
||||
RESULT=0
|
||||
|
|
@ -14,7 +14,7 @@ echo "${MESONCURRENTCONFIGDIR}"
|
|||
for file in ${deps}
|
||||
do
|
||||
echo "${file}"
|
||||
if $(clang-format -Werror --dry-run "${MESONCURRENTCONFIGDIR}/${file}")
|
||||
if (clang-format -Werror --dry-run "${MESONCURRENTCONFIGDIR}/${file}")
|
||||
then
|
||||
echo " [x] clang-format"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
#! /bin/sh
|
||||
#! /bin/bash
|
||||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
readonly declared_deps="${@}"
|
||||
readonly declared_deps="${*}"
|
||||
readonly hardcoded_deps="meson_options.txt meson.build"
|
||||
# shellcheck disable=2155,2164,2046
|
||||
readonly test_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep test/)
|
||||
# shellcheck disable=2155,2164,2046
|
||||
readonly examples_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep examples/)
|
||||
# shellcheck disable=2155,2164,2046
|
||||
readonly example_scripts_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep example_scripts/)
|
||||
readonly deps="${declared_deps} ${hardcoded_deps} ${test_deps} ${examples_deps} ${example_scripts_deps}"
|
||||
# shellcheck disable=2046,2155
|
||||
readonly curryear=$(date +%Y)
|
||||
|
||||
RESULT=0
|
||||
|
|
@ -15,14 +19,14 @@ RESULT=0
|
|||
for file in ${deps}
|
||||
do
|
||||
echo "${file}"
|
||||
if $(grep -q "Copyright.*${curryear}, project-repo and the cagebreak contributors" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
if (grep -q "Copyright.*${curryear}, project-repo and the cagebreak contributors" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
then
|
||||
echo " [x] Copyright Notice"
|
||||
else
|
||||
RESULT=1
|
||||
echo " [ ] Copyright Notice"
|
||||
fi
|
||||
if $(grep -q "SPDX-License-Identifier: MIT" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
if (grep -q "SPDX-License-Identifier: MIT" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
then
|
||||
echo " [x] SPDX-License-Identifier"
|
||||
else
|
||||
|
|
@ -33,10 +37,12 @@ done
|
|||
|
||||
[[ "${MESONLICENSE}" = "MIT" ]] || RESULT=1
|
||||
|
||||
# shellcheck disable=2164
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
|
||||
[[ $(cat LICENSE) = $(cat README.md | tail -$(wc -l LICENSE)) ]] || RESULT=1
|
||||
# shellcheck disable=2046,2002
|
||||
[[ $(cat LICENSE) = $( cat README.md | tail -$(wc -l LICENSE)) ]] || RESULT=1
|
||||
|
||||
[[ "Copyright (c) 2020-${curryear} The Cagebreak authors" = $(cat LICENSE | head -1) ]] || RESULT=1
|
||||
[[ "Copyright (c) 2020-${curryear} The Cagebreak authors" = $( head -1 LICENSE) ]] || RESULT=1
|
||||
|
||||
exit "${RESULT}"
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@ RESULT=0
|
|||
|
||||
# CAGEBREAK_SOCKET (duplicate of arguments test)
|
||||
## Check without socket
|
||||
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}"
|
||||
readonly oldsocket=$CAGEBREAK_SOCKET
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
|
||||
$(WLR_BACKENDS=headless ./cagebreak -c $testdir/config)
|
||||
[[ $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" "${testdir}/config"
|
||||
(WLR_BACKENDS=headless ./cagebreak -c "${testdir}/config")
|
||||
[[ $(cat "${testdir}/socket") = "${oldsocket}" ]] || RESULT=1
|
||||
## Check with socket
|
||||
cp $MESONCURRENTCONFIGDIR/test/testing-configurations/config $testdir
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" $testdir/config
|
||||
$(WLR_BACKENDS=headless ./cagebreak -e -c $testdir/config)
|
||||
[[ ! $(cat $testdir/socket) = $oldsocket ]] || RESULT=1
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/config" "${testdir}"
|
||||
sed -i "s|CONFIGPATH|$testdir\/socket|g" "${testdir}/config"
|
||||
(WLR_BACKENDS=headless ./cagebreak -e -c "${testdir}/config")
|
||||
[[ ! $(cat "${testdir}/socket") = "${oldsocket}" ]] || RESULT=1
|
||||
|
||||
# XDG_CONFIG_HOME
|
||||
cp "${MESONCURRENTCONFIGDIR}/test/testing-configurations/env-var-config" "${testdir}/cagebreak/config"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
testdir=$(mktemp -d)
|
||||
|
||||
RESULT=0
|
||||
|
||||
# shellcheck disable=2164
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
|
||||
# Check that no TODO statements remain in the release directory
|
||||
|
|
@ -13,8 +12,8 @@ if ! grep -Rq "TODO" .
|
|||
then
|
||||
echo "[x] TODO"
|
||||
else
|
||||
echo "[ ] TODO"
|
||||
RESULT=1
|
||||
echo "[ ] TODO"
|
||||
fi
|
||||
|
||||
# Check that Cagebreak does not falsely claim to be POSIX compliant
|
||||
|
|
@ -22,8 +21,8 @@ if ! grep -Rq "_POSIX_C_SOURCE" .
|
|||
then
|
||||
echo "[x] _POSIX_C_SOURCE"
|
||||
else
|
||||
echo "[ ] _POSIX_C_SOURCE"
|
||||
RESULT=1
|
||||
echo "[ ] _POSIX_C_SOURCE"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
RESULT=0
|
||||
|
||||
# shellcheck disable=2164
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
rm -rf test/test-scan-build
|
||||
meson setup test/test-scan-build -Dxwayland=true -Dman-pages=true --buildtype=release || RESULT=1
|
||||
|
|
|
|||
16
test/shellcheck
Normal file
16
test/shellcheck
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
RESULT=0
|
||||
|
||||
set -x
|
||||
# shellcheck disable=2164
|
||||
cd "${MESONCURRENTCONFIGDIR}/test"
|
||||
# shellcheck disable=2046
|
||||
shellcheck --source-path=../example_scripts/ $(ls -Itesting-configurations) || RESULT=1
|
||||
|
||||
cd "${MESONCURRENTCONFIGDIR}/example_scripts/" || RESULT=1
|
||||
shellcheck ./*
|
||||
|
||||
exit "${RESULT}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue