Updated SC2114 (markdown)

koalaman
2017-05-28 14:39:13 -07:00
parent 10a0217ab0
commit 7bcc65178a

@@ -1,4 +1,4 @@
## Warning: deletes a system directory. Use 'rm --' to disable this message. ## Warning: deletes a system directory.
### Problematic code: ### Problematic code:
@@ -20,10 +20,11 @@ Due to an accidental space, it deleted `/usr` instead of just the particular dir
### Exceptions: ### Exceptions:
In cases of chroot, initramfs and similar, it's reasonable to delete otherwise important directories. Due to this, Shellcheck will not warn if the command contains `--`: If you do intend to delete a system directory, such as when working in a chroot or initramfs, you can disable this message with a directive:
```sh ```sh
rm -rf -- /usr # shellcheck disable=SC2114
rm -rf /usr
``` ```
This is an arbitrary convention to allow deleting such directories without having to use a [[directive]] to silence the warning. Previous versions of shellcheck, up to and including 0.4.6, would ignore `rm` statements containing a `--` (an arbitrary convention). This is no longer the case.