From 7bcc65178a380d390515911ae75979ccef98caef Mon Sep 17 00:00:00 2001 From: koalaman Date: Sun, 28 May 2017 14:39:13 -0700 Subject: [PATCH] Updated SC2114 (markdown) --- SC2114.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SC2114.md b/SC2114.md index 6c501fa..4e1c49e 100644 --- a/SC2114.md +++ b/SC2114.md @@ -1,4 +1,4 @@ -## Warning: deletes a system directory. Use 'rm --' to disable this message. +## Warning: deletes a system directory. ### Problematic code: @@ -20,10 +20,11 @@ Due to an accidental space, it deleted `/usr` instead of just the particular dir ### 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 -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. \ No newline at end of file