-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
New quick fix options to disable the rule for the line, file or the project #116
Comments
We can't just move a directive to the first line of a file, if there is a shebang present (which has to be the first line, nay, the first characters of that file!). In my case, even if I don't have a shebang as the first line, I have a directive to indicate the style of the script: shellcheck shell=bashI believe that a directive like that also has to be on the first line (and a shebang makes for not needing this directive. Next, there are corporate directives on where to put licensing information, for a lot of the bigger companies. This accounts for the next few lines (typically a comment). These lines can also hold revision control information... (for older revision control systems)... Let's think about a more intuitive way, and maybe a way that works for more customer scenarios? |
Right, I said exactly what koalaman said in the ShellCheck documentation:
I believe we should simply find what is the first command in the file, and put the directives one line before it. :) That should cover all the cases while remaining KISS, right? |
If this is what you mean:
Maybe... What about:
The latter seems to be safer and more comprehensive than the first? |
That was not what I meant... when koalaman said "command" I believe he meant anything except "comments". Does not matter which is the number of the line, the first command can be in the final of the file for example. Regarding:
Yes, it's the same thing that I'm thinking, I believe, which is: find_first_command_in_the_file(); // this implies skipping all the comments
insert_new_directive_one_line_above_it() |
E.g.: #!/bin/bash
# Copyright Felipe
# Dummy line
# Another comment
# Usage: hello-world
echo "hello-world" would become: #!/bin/bash
# Copyright Felipe
# Dummy line
# Another comment
# Usage: hello-world
# shellcheck disable=SC2035
echo "hello-world" More calls would result in: #!/bin/bash
# Copyright Felipe
# Dummy line
# Another comment
# Usage: hello-world
# shellcheck disable=SC2035
# shellcheck disable=SC2034
echo "hello-world" (preferably) |
I would like to have at least the line-based action. It is really a pain to add the comment. |
+1 My use case: I always forget the syntax, even though it's as simple as So I must visit this site to find it. But I forget which repo it's in. So I must search for it... Luckily I remember "google.com", so it's not so bad. 😆 |
Now you have snippets by the way: #1190 |
I agree. To be honest, even if it generated a hard coded comment like @felipecrs Are there downsides to extracting |
No downsides, but it's probably not necessary. PRs are welcome regardless of being only for the line or not. |
Ah, my mistake. I assumed you wanted a PR to implement all three. |
Example, from vscode-groovy-lint:
Disable for the line
Includes a statement in the previous line, such as
# shellcheck disable=SC2035
. Reference.Disable for the entire file
Includes a ShellCheck directive statement before the first command in the file.
Disable for the project
Adds the ShellCheck directive statement to the
.shellcheckrc
file (and create the file if it does not exist).The text was updated successfully, but these errors were encountered: