koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.45k stars 1.78k forks source link

[Feature] Generate Warning for Multiple Traps on the Same Signal #2920

Open fxierh opened 9 months ago

fxierh commented 9 months ago

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/usr/bin/env bash

cleanup() {
    echo "foo"
}

cleanup2() { 
    echo "bar"
}

echo "start"
trap cleanup EXIT
trap cleanup2 EXIT

Here's what shellcheck currently says:

$ shellcheck myscript
No issues detected!

Here's what I wanted or expected to see:

A warning.