Skip to content

Release 3.7

Release 3.7 #18

Triggered via push February 15, 2024 16:20
Status Success
Total duration 15s
Artifacts

hlint.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

14 warnings
hlint
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, rwe/actions-hlint-setup@v1, rwe/actions-hlint-run@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
hlint
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, rwe/actions-hlint-setup@v1, rwe/actions-hlint-run@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
hlint: src/CrackNum/Main.hs#L148
Suggestion in getFP in module Main: Use otherwise ▫︎ Found: "mkEBSB eb sb\n | eb >= 2 && eb <= 29 && sb >= 2 && sb <= 1073741822\n = Floating $ FP eb sb\n | True\n = BadFlag\n [\"Invalid floating-point precision.\", \"\",\n \" Exponent size must be between \"\n ++ show (2 :: Int) ++ \" to \" ++ show (29 :: Int),\n \" Significant size must be between \"\n ++ show (2 :: Int) ++ \" to \" ++ show (1073741822 :: Int),\n \"\", \"Received: \" ++ show eb ++ \" \" ++ show sb]" ▫︎ Perhaps: "mkEBSB eb sb\n | eb >= 2 && eb <= 29 && sb >= 2 && sb <= 1073741822\n = Floating $ FP eb sb\n | otherwise\n = BadFlag\n [\"Invalid floating-point precision.\", \"\",\n \" Exponent size must be between \"\n ++ show (2 :: Int) ++ \" to \" ++ show (29 :: Int),\n \" Significant size must be between \"\n ++ show (2 :: Int) ++ \" to \" ++ show (1073741822 :: Int),\n \"\", \"Received: \" ++ show eb ++ \" \" ++ show sb]"
hlint: src/CrackNum/Main.hs#L256
Suggestion in crack in module Main: Use otherwise ▫︎ Found: "inferLanes prefix\n | prefix `rem` eSize == 0 = pure $ Just (prefix `div` eSize)\n | True\n = die\n [\"Verilog notation size mismatch:\",\n \" Input length: \" ++ show prefix,\n \" Element size: \" ++ show eSize,\n \"Length must be an exact multiple of the element size.\"]" ▫︎ Perhaps: "inferLanes prefix\n | prefix `rem` eSize == 0 = pure $ Just (prefix `div` eSize)\n | otherwise\n = die\n [\"Verilog notation size mismatch:\",\n \" Input length: \" ++ show prefix,\n \" Element size: \" ++ show eSize,\n \"Length must be an exact multiple of the element size.\"]"
hlint: src/CrackNum/Main.hs#L272
Suggestion in crack in module Main: Use otherwise ▫︎ Found: "lanes\n | tryInfer = fromMaybe lanesGiven lanesInferred\n | True = lanesGiven" ▫︎ Perhaps: "lanes\n | tryInfer = fromMaybe lanesGiven lanesInferred\n | otherwise = lanesGiven"
hlint: src/CrackNum/Main.hs#L290
Suggestion in decodeAllLanes in module Main: Use otherwise ▫︎ Found: "header i\n | lanes == 1 = pure ()\n | True = putStrLn $ \"== Lane \" ++ show i ++ \" \" ++ replicate 60 '='" ▫︎ Perhaps: "header i\n | lanes == 1 = pure ()\n | otherwise\n = putStrLn $ \"== Lane \" ++ show i ++ \" \" ++ replicate 60 '='"
hlint: src/CrackNum/Main.hs#L351
Suggestion in parseToBits in module Main: Use otherwise ▫︎ Found: "cvt i\n | isHex = concat <$> mapM cvtHex i\n | True = concat <$> mapM cvtBin i" ▫︎ Perhaps: "cvt i\n | isHex = concat <$> mapM cvtHex i\n | otherwise = concat <$> mapM cvtBin i"
hlint: src/CrackNum/Main.hs#L420
Suggestion in encodeLane in module Main: Use otherwise ▫︎ Found: "encodeLane lanes num rm inp\n | lanes /= 1\n = die\n [\"Lanes argument is only valid with decoding values.\",\n \"Received: \" ++ show lanes]\n | True\n = case num of\n SInt n -> print =<< ei True n\n SWord n -> print =<< ei False n\n SFloat s -> ef s\n where\n ei :: Bool -> Int -> IO SatResult\n ei sgn n\n = case reads inp of\n [(v :: Integer, \"\")] -> satWith z3 {crackNum = True} $ p v\n _ -> die\n [\"Expected an integer value to decode, received: \" ++ show inp]\n where\n p :: Integer -> Predicate\n p iv\n = do let k = KBounded sgn n\n v = SBV $ SVal k $ Left $ mkConstCV k iv\n x <- (if sgn then sIntN else sWordN) n \"ENCODED\"\n pure $ SBV x .== v\n convert :: Int -> Int -> (BigFloat, Maybe String)\n convert i j\n = case s of\n Ok -> (v, Nothing)\n _ -> (v, Just (trim (show s)))\n where\n bfOpts\n = allowSubnormal\n <>\n rnd (toLibBFRM rm)\n <> expBits (fromIntegral i) <> precBits (fromIntegral j)\n (v, s) = bfFromString 10 bfOpts inp\n trim xs\n | \"[\" `isPrefixOf` xs && \"]\" `isSuffixOf` xs = init (drop 1 xs)\n | True = xs\n note :: Maybe String -> IO ()\n note mbs\n = do putStrLn $ \" Rounding mode: \" ++ show rm\n case mbs of\n Nothing\n -> putStrLn\n $ \" Note: Conversion from \"\n ++ show inp ++ \" was exact. No rounding happened.\"\n Just s\n -> putStrLn\n $ \" Note: Conversion from \"\n ++ show inp ++ \" was not faithful. Status: \" ++ s ++ \".\"\n ef :: FP -> IO ()\n ef SP\n = case reads (fixup inp) of\n [(v :: Float, \"\")]\n -> do print =<< satWith z3 {crackNum = True} (p v)\n note $ snd $ convert 8 24\n _ -> ef (FP 8 24)\n where\n p :: Float -> Predicate\n p f\n = do x <- sFloat \"ENCODED\"\n pure $ x .=== literal f\n ef DP\n = case reads (fixup inp) of\n [(v :: Double, \"\")]\n -> do print =<< satWith z3 {crackNum = True} (p v)\n note $ snd $ convert 11 53\n _ -> ef (FP 11 53)\n where\n p :: Double -> Predicate\n p d\n = do x <- sDouble \"ENCODED\"\n pure $ x .=== literal d\n ef (FP i j)\n = do let (v, mbS) = convert i j\n if bfIsNaN v then\n die\n [\"Input does not represent floating point number we recognize.\",\n \"Saw: \" ++ inp, \"\",\n \"For decoding bit-strings, prefix them with 0x, N'h, 0b and\",\n \"provide a hexadecimal or binary representation of the input.\"]\n else\n do print =<< satWith z3 {crackNum = True} (p v)\n note mbS\n where\n p :: BigFloat -> Predicate\n p bf\n = do let k = KFP i j\n sx <- svNewVar k \"ENCODED\"\n pure\n $ SBV\n $ sx\n `svStrongEqual` SVal k (Left (CV k (CFP (fpFromBigFloat i j bf))))" ▫︎ Perhaps: "encodeLane lanes num rm inp\n | lanes /= 1\n = die\n [\"Lanes argument is only valid with decoding values.\",\n \"Received: \" ++ show lanes]\n | otherwise\n = case num of\n SInt n -> print =<< ei True n\n SWord n -> print =<< ei False n\n SFloat s -> ef s\n where\n ei :: Bool -> Int -> IO SatResult\n ei sgn n\n = case reads inp of\n [(v :: Integer, \"\")] -> satWith z3 {crackNum = True} $ p v\n _ -> die\n [\"Expected an integer value to decode, received: \" ++ show inp]\n where\n p :: Integer -> Predicate\n p iv\n = do let k = KBounded sgn n\n v = SBV $ SVal k $ Left $ mkConstCV k iv\n x <- (if sgn then sIntN else sWordN) n \"ENCODED\"\n pure $ SBV x .== v\n convert :: Int -> Int -> (BigFloat, Maybe String)\n convert i j\n = case s of\n Ok -> (v, Nothing)\n _ -> (v, Just (trim (show s)))\n where\n bfOpts\n = allowSubnormal\n <>\n rnd (toLibBFRM rm)\n <> expBits (fromIntegral i) <> precBits (fromIntegral j)\n (v, s) = bfFromString 10 bfOpts inp\n trim xs\n | \"[\" `isPrefixOf` xs && \"]\" `isSuffixOf` xs = init (drop 1 xs)\n | True = xs\n note :: Maybe String -> IO ()\n note mbs\n = do putStrLn $ \" Rounding mode: \" ++ show rm\n case mbs of\n Nothing\n -> putStrLn\n $ \" Note: Conversion from \"\n ++ show inp ++ \" was exact. No rounding happened.\"\n Just s\n -> putStrLn\n $ \" Note: Conversion from \"\n ++ show inp ++ \" was not faithful. Status: \" ++ s ++ \".\"\n ef :: FP -> IO ()\n ef SP\n = case reads (fixup inp) of\n [(v :: Float, \"\")]\n -> do print =<< satWith z3 {crackNum = True} (p v)\n note
hlint: src/CrackNum/Main.hs#L446
Suggestion in encodeLane in module Main: Use otherwise ▫︎ Found: "trim xs\n | \"[\" `isPrefixOf` xs && \"]\" `isSuffixOf` xs = init (drop 1 xs)\n | True = xs" ▫︎ Perhaps: "trim xs\n | \"[\" `isPrefixOf` xs && \"]\" `isSuffixOf` xs = init (drop 1 xs)\n | otherwise = xs"
hlint: src/CrackNum/Main.hs#L489
Suggestion in fixup in module Main: Use otherwise ▫︎ Found: "fixup inp\n | linp `elem` [\"inf\", \"infinity\"] = \"Infinity\"\n | linp `elem` [\"-inf\", \"-infinity\"] = \"-Infinity\"\n | linp == \"nan\" = \"NaN\"\n | linp == \"-nan\" = \"-NaN\"\n | True = inp\n where\n linp = map toLower inp" ▫︎ Perhaps: "fixup inp\n | linp `elem` [\"inf\", \"infinity\"] = \"Infinity\"\n | linp `elem` [\"-inf\", \"-infinity\"] = \"-Infinity\"\n | linp == \"nan\" = \"NaN\"\n | linp == \"-nan\" = \"-NaN\"\n | otherwise = inp\n where\n linp = map toLower inp"
hlint
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
hlint
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
hlint
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
hlint
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/