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

SC2119 / SC2120 false positives? #2926

Open
2 tasks done
dubo-dubon-duponey opened this issue Feb 18, 2024 · 0 comments
Open
2 tasks done

SC2119 / SC2120 false positives? #2926

dubo-dubon-duponey opened this issue Feb 18, 2024 · 0 comments

Comments

@dubo-dubon-duponey
Copy link

dubo-dubon-duponey commented Feb 18, 2024

For bugs

  • Rule Id (if any, e.g. SC1000): SC2119 / SC2120
  • My shellcheck version (shellcheck --version or "online"): online and 0.9.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

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

#!/usr/bin/env bash

foo(){
        local input="${1:-/dev/stdin}"
        cat "$input"
}


foo <<<"blah"

Here's what shellcheck currently says:

In test.sh line 3:
foo(){
^-- SC2120 (warning): foo references arguments, but none are ever passed.


In test.sh line 9:
foo <<<"blah"
^-----------^ SC2119 (info): Use foo "$@" if function's $1 should mean script's $1.

For more information:
  https://www.shellcheck.net/wiki/SC2120 -- foo references arguments, but non...
  https://www.shellcheck.net/wiki/SC2119 -- Use foo "$@" if function's $1 sho...

Here's what I wanted or expected to see:

It should say nothing about SC2120. An argument is being passed (a file descriptor), so, this one feels factually wrong to me.

SC2119, I am not quite sure what it would mean here, so, same thing, I would expect it to not say anything.

Apologies in advance if I am missing something here.

Thanks a lot!

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