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

SC1090 does not recognize ~ as a single expansion #3022

Open
2 tasks done
sparr opened this issue Jul 16, 2024 · 0 comments
Open
2 tasks done

SC1090 does not recognize ~ as a single expansion #3022

sparr opened this issue Jul 16, 2024 · 0 comments

Comments

@sparr
Copy link

sparr commented Jul 16, 2024

For bugs

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

#!/bin/bash
. "${HOME}"/foo.sh
. ~/foo.sh

Here's what shellcheck currently says:

[Line 2:](javascript:setPosition(2, 3))
. "${HOME}"/foo.sh
  ^-- [SC1091](https://www.shellcheck.net/wiki/SC1091) (info): Not following: ./foo.sh was not specified as input (see shellcheck -x).
 
[Line 3:](javascript:setPosition(3, 3))
. ~/foo.sh
  ^-- [SC1090](https://www.shellcheck.net/wiki/SC1090) (warning): ShellCheck can't follow non-constant source. Use a directive to specify location.

Here's what I wanted or expected to see:

Line 3 should recognize ~ as [approximately] equivalent to $HOME and pass SC1090 with the "strip a single expansion followed by a slash" exception described on the wiki, instead behaving like Line 2 and triggering SC1091 (or, if run with shellcheck -x, succeeding as Line 2 would)

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