-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
For bugs
- Rule Id: SC2154/check-unassigned-uppercase
- My shellcheck version: 0.10.0
- The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
- I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit
For new checks and feature suggestions
- https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
- I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
if [[ -n "$4" ]]
then
echo "$5"
fiHere'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
Labels
No labels