mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-11-04 18:28:23 +08:00 
			
		
		
		
	Remove more unnecessary uses of fromJust
This commit is contained in:
		@@ -1996,18 +1996,18 @@ checkQuotesInLiterals params t =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    readF _ expr name = do
 | 
					    readF _ expr name = do
 | 
				
			||||||
        assignment <- getQuotes name
 | 
					        assignment <- getQuotes name
 | 
				
			||||||
        return
 | 
					        return $ case assignment of
 | 
				
			||||||
          (if isJust assignment
 | 
					          Just j
 | 
				
			||||||
              && not (isParamTo parents "eval" expr)
 | 
					              | not (isParamTo parents "eval" expr)
 | 
				
			||||||
              && not (isQuoteFree parents expr)
 | 
					              && not (isQuoteFree parents expr)
 | 
				
			||||||
              && not (squashesQuotes expr)
 | 
					              && not (squashesQuotes expr)
 | 
				
			||||||
              then [
 | 
					              -> [
 | 
				
			||||||
                  makeComment WarningC (fromJust assignment) 2089 $
 | 
					                  makeComment WarningC j 2089 $
 | 
				
			||||||
                      "Quotes/backslashes will be treated literally. " ++ suggestion,
 | 
					                      "Quotes/backslashes will be treated literally. " ++ suggestion,
 | 
				
			||||||
                  makeComment WarningC (getId expr) 2090
 | 
					                  makeComment WarningC (getId expr) 2090
 | 
				
			||||||
                      "Quotes/backslashes in this variable will not be respected."
 | 
					                      "Quotes/backslashes in this variable will not be respected."
 | 
				
			||||||
                ]
 | 
					                ]
 | 
				
			||||||
              else [])
 | 
					          _ -> []
 | 
				
			||||||
    suggestion =
 | 
					    suggestion =
 | 
				
			||||||
        if supportsArrays (shellType params)
 | 
					        if supportsArrays (shellType params)
 | 
				
			||||||
        then "Use an array."
 | 
					        then "Use an array."
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2056,7 +2056,7 @@ readSimpleCommand = called "simple command" $ do
 | 
				
			|||||||
            firstArgument <- ignoreProblemsOf . optionMaybe . try . lookAhead $ readCmdWord
 | 
					            firstArgument <- ignoreProblemsOf . optionMaybe . try . lookAhead $ readCmdWord
 | 
				
			||||||
            suffix <- option [] $ getParser readCmdSuffix
 | 
					            suffix <- option [] $ getParser readCmdSuffix
 | 
				
			||||||
                    -- If `export` or other modifier commands are called with `builtin` we have to look at the first argument
 | 
					                    -- If `export` or other modifier commands are called with `builtin` we have to look at the first argument
 | 
				
			||||||
                    (if isCommand ["builtin"] cmd && isJust firstArgument then fromJust firstArgument else cmd) [
 | 
					                    (if isCommand ["builtin"] cmd then fromMaybe cmd firstArgument else cmd) [
 | 
				
			||||||
                        (["declare", "export", "local", "readonly", "typeset"], readModifierSuffix),
 | 
					                        (["declare", "export", "local", "readonly", "typeset"], readModifierSuffix),
 | 
				
			||||||
                        (["time"], readTimeSuffix),
 | 
					                        (["time"], readTimeSuffix),
 | 
				
			||||||
                        (["let"], readLetSuffix),
 | 
					                        (["let"], readLetSuffix),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user