mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-10-31 06:29:20 +08:00 
			
		
		
		
	Allow disable=all to disable all warnings (fixes #2323)
				
					
				
			This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| ## Git (0.8.0) | ||||
| ### Added | ||||
| - `disable=all` now conveniently disables all warnings | ||||
| - `external-sources=true` directive can be added to .shellcheckrc to make | ||||
|   shellcheck behave as if `-x` was specified. | ||||
| - SC2286-SC2288: Warn when command name ends in a symbol like `/.)'"` | ||||
|   | ||||
| @@ -237,6 +237,7 @@ Valid keys are: | ||||
|     The command can be a simple command like `echo foo`, or a compound command | ||||
|     like a function definition, subshell block or loop. A range can be | ||||
|     be specified with a dash, e.g. `disable=SC3000-SC4000` to exclude 3xxx. | ||||
|     All warnings can be disabled with `disable=all`. | ||||
|  | ||||
| **enable** | ||||
| :   Enable an optional check by name, as listed with **--list-optional**. | ||||
|   | ||||
| @@ -306,6 +306,13 @@ prop_canDisableShebangWarning = null $ result | ||||
|         csScript = "#shellcheck disable=SC2148\nfoo" | ||||
|     } | ||||
|  | ||||
| prop_canDisableAllWarnings = result == [2086] | ||||
|   where | ||||
|     result = checkWithSpec [] emptyCheckSpec { | ||||
|         csFilename = "file.sh", | ||||
|         csScript = "#!/bin/sh\necho $1\n#shellcheck disable=all\necho `echo $1`" | ||||
|     } | ||||
|  | ||||
| prop_canDisableParseErrors = null $ result | ||||
|   where | ||||
|     result = checkWithSpec [] emptyCheckSpec { | ||||
|   | ||||
| @@ -984,6 +984,7 @@ prop_readAnnotation4 = isWarning readAnnotation "# shellcheck cats=dogs disable= | ||||
| prop_readAnnotation5 = isOk readAnnotation "# shellcheck disable=SC2002 # All cats are precious\n" | ||||
| prop_readAnnotation6 = isOk readAnnotation "# shellcheck disable=SC1234 # shellcheck foo=bar\n" | ||||
| prop_readAnnotation7 = isOk readAnnotation "# shellcheck disable=SC1000,SC2000-SC3000,SC1001\n" | ||||
| prop_readAnnotation8 = isOk readAnnotation "# shellcheck disable=all\n" | ||||
| readAnnotation = called "shellcheck directive" $ do | ||||
|     try readAnnotationPrefix | ||||
|     many1 linewhitespace | ||||
| @@ -1004,8 +1005,12 @@ readAnnotationWithoutPrefix sandboxed = do | ||||
|         key <- many1 (letter <|> char '-') | ||||
|         char '=' <|> fail "Expected '=' after directive key" | ||||
|         annotations <- case key of | ||||
|             "disable" -> readRange `sepBy` char ',' | ||||
|             "disable" -> readElement `sepBy` char ',' | ||||
|               where | ||||
|                 readElement = readRange <|> readAll | ||||
|                 readAll = do | ||||
|                     string "all" | ||||
|                     return $ DisableComment 0 1000000 | ||||
|                 readRange = do | ||||
|                     from <- readCode | ||||
|                     to <- choice [ char '-' *> readCode, return $ from+1 ] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user