mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1055 (markdown)
30
SC1055.md
Normal file
30
SC1055.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
## You need at least one command here. Use 'true;' as a no-op.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
submitbug() {
|
||||||
|
# TODO: Implement me
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
submitbug() {
|
||||||
|
# TODO: Implement me
|
||||||
|
true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
ShellCheck found an empty code block. This could be an empty function as shown, a loop with an empty body, or similar.
|
||||||
|
|
||||||
|
Sh/bash does not allow empty code blocks. Insert at least one command. If you don't want the block to do anything, `true` (aka `:`) is a good no-op.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
* [StackOverflow: Why cannot I define an empty function in shell?](https://stackoverflow.com/questions/39307615/why-cannot-i-define-an-empty-function-in-shell)
|
Reference in New Issue
Block a user