Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positives on SC3028 #3156

Open
aep-sunlife opened this issue Mar 10, 2025 · 0 comments
Open

False positives on SC3028 #3156

aep-sunlife opened this issue Mar 10, 2025 · 0 comments

Comments

@aep-sunlife
Copy link

Hi,

I am using POSIX safe code in my shell scripts, but ShellCheck insists on presenting some spurious warnings.

if [ "${HOSTNAME:-}" = 'beavis' ]; then
    export JAVA_HOME="/opt/jenkins/java/jdk-${JAVA_VERSION}"
fi
In scripts/provision-jenkins.sh line 1:
if [ "${HOSTNAME:-}" = 'beavis' ]; then
      ^-----------^ SC3028 (warning): In POSIX sh, HOSTNAME is undefined.

ShellCheck should recognize that we're not hard depending on the existence of the HOSTNAME environment variable, but in fact falling back on POSIX's default value syntax. So no warning should emit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant