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

Shellcheck's source directive for SC1090 should support either $HOME or ~tilde-expansion #2914

Closed
1 of 2 tasks
ELLIOTTCABLE opened this issue Jan 30, 2024 · 2 comments
Closed
1 of 2 tasks

Comments

@ELLIOTTCABLE
Copy link

For bugs

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

mise_plugin_path="$HOME/.zsh/modules/wintermi/zsh-mise/zsh-mise.plugin.zsh"
if [ -f "$mise_plugin_path" ]; then
   # shellcheck source=~/.zsh/modules/wintermi/zsh-mise/zsh-mise.plugin.zsh
   . "$mise_plugin_path"

   debug_path_dump 'after zsh-mise.plugin.zsh'
fi

Here's what shellcheck currently says:

In Dotfiles/shenv line 267:
      . "$mise_plugin_path"
        ^-----------------^ SC1090 (warning): ShellCheck can't follow non-constant source. Use a directive to specify location.

This is related to #507, but smaller in scope: instead of supporting analysis of such paths in the source, I'd like to at least see them handled in explicit source directives, such as the above.

At the moment, if I use a tilde in the directive (source=~/.zsh/modules/wintermi/zsh-mise/zsh-mise.plugin.zsh), I get SC1090, as if it didn't try to resolve it at all; and if I use an environment-variable (source=$HOME/.zsh/modules/wintermi/zsh-mise/zsh-mise.plugin.zsh), I get told it can't be found:

In Dotfiles/shenv line 267:
      . "$mise_plugin_path"
        ^-----------------^ SC1091 (info): Not following: $HOME/.zsh/modules/wintermi/zsh-mise/zsh-mise.plugin.zsh: openBinaryFile: does not exist (No such file or directory)
@brother
Copy link
Collaborator

brother commented Jan 30, 2024

See also #2710

@ELLIOTTCABLE
Copy link
Author

Oh my god, and I even commented on it last fall. jfc. Closing, it's a duplicate.

@ELLIOTTCABLE ELLIOTTCABLE closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
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

2 participants