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

The dollar sign used to indicate a variable is incorrectly flagged as a prompt in a code block #92

Open
giuliazanchi opened this issue Feb 3, 2025 · 3 comments

Comments

@giuliazanchi
Copy link
Contributor

A $ sign preceded by " might often indicate a variable rather than a command prompt.

For example:

export PATH="$PATH:/home/user/snap/multipass/common/bin"
@SecondSkoll
Copy link
Contributor

Can you provide an example of where this was incorrectly flagged? Current regex ^[ \t]*[$%] should only flag $ when it's the first character in a line with the exception of spaces and tabs.

@giuliazanchi
Copy link
Contributor Author

@SecondSkoll make vale returns two warnings on this page: https://github.com/giuliazanchi/multipass/blob/migrate-docs-to-rtd/docs/how-to-guides/manage-instances/use-instance-command-aliases.md

110:7   warning  Avoid using prompts in code     Canonical.015-No-prompts-in-comments 
                  blocks: $                                                            
126:14  warning  Avoid using prompts in code     Canonical.015-No-prompts-in-comments 
                  blocks: $                                                            

@SecondSkoll
Copy link
Contributor

Hmm, it's not respecting the start of line syntax (^). Strange. Looks like it's some upstream issue.

Try the following syntax, and see what you think:

- '\n([ \t]*|[^\n~]~\]?)(\$|%)'

Run Vale, then change it in your repository, if the Vale config files exist they won't be overwritten again.

The only issue with this solution is that it points at the line above an instance rather than the occurrence itself. It's probably the best we can do for now.

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