Skip to content

shellcheck doesn't warn that scripts can fail due to set -e #3444

@filipopo

Description

@filipopo

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

#!/bin/bash
set -e

rosker() {
  local name="${1:-filip}"
  shift
  echo "$name"
}

Here's what shellcheck currently says:

No issues detected!

Here's what I wanted or expected to see:

A warning that if no arguments are passed to this function that shift will crash and a recommendation to change it to something like shift || true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions