Skip to content

SC2154/check-unassigned-uppercase does not report error for $1,... #3080

@kkmuffme

Description

@kkmuffme

For bugs

For new checks and feature suggestions

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

#!/bin/bash
if [[ -n "$4" ]]
then
    echo "$5"
fi

Here's what shellcheck currently says:

No error

Here's what I wanted or expected to see:

5 is referenced but not assigned

The global variables $1, $2,... (not $0) should be checked like any other uppercase variable when check-unassigned-uppercase is used.
The numbers are easily fatfingered and this is an easy mistake to make when restructuring code too.

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