diff options
Diffstat (limited to 'Omni/Ci.hs')
| -rwxr-xr-x | Omni/Ci.hs | 31 |
1 files changed, 29 insertions, 2 deletions
@@ -134,7 +134,7 @@ move args = do (exitCodeLint, _, lintStderr) <- Process.readProcessWithExitCode runlint [] "" pure <| case exitCodeLint of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack lintStderr) + _ -> ("fail", extractErrorMessage (Text.pack lintStderr)) -- 6. Run Tests -- if bild "${BILD_ARGS:-""}" --test "${CODEROOT:?}"/**/* @@ -149,7 +149,7 @@ move args = do (exitCodeTest, _, testStderr) <- Process.readProcessWithExitCode "bild" ("--test" : allFiles) "" pure <| case exitCodeTest of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack testStderr) + _ -> ("fail", extractErrorMessage (Text.pack testStderr)) -- 7. Create Note let noteMsg = case (fst lintResult, fst testResult) of @@ -203,3 +203,30 @@ getCoderoot = do case mEnvRoot of Just envRoot -> pure envRoot Nothing -> panic "CODEROOT not set" -- Simplified for now + +-- | Extract meaningful error messages from tool output, filtering out progress/status lines +extractErrorMessage :: Text -> Text +extractErrorMessage output = + let errorLines = + Text.lines output + |> filter isErrorLine + |> take 5 -- Limit to first 5 error lines + cleaned = + if null errorLines + then ["Unknown error (no error lines found)"] + else errorLines + in Text.unlines cleaned + where + isErrorLine line = + let stripped = Text.strip line + in not (Text.null stripped) + && ( "fail:" + `Text.isInfixOf` stripped + || "error:" + `Text.isInfixOf` stripped + || "Error:" + `Text.isInfixOf` stripped + || "ERROR:" + `Text.isInfixOf` stripped + ) + && not ("warning:" `Text.isInfixOf` stripped) -- Exclude warnings |
