From 9b4887e43ca9cad55f5185060d0479a5d0ca27d9 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 22 Dec 2025 21:05:38 -0500 Subject: Omni/Bild: add file filtering to prevent namespace parsing errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add isLikelySourceFile filter to exclude dotfiles and config files - Apply filter before namespaceFromPathOrDie to prevent crashes - Removes need to add every config file type to namespace system - Fixes CI failures from .dir-locals.el and similar files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Omni/Bild.hs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'Omni') diff --git a/Omni/Bild.hs b/Omni/Bild.hs index fcf959f..39ac01f 100644 --- a/Omni/Bild.hs +++ b/Omni/Bild.hs @@ -225,6 +225,7 @@ move args = do |> filterM Dir.doesFileExist +> filterGitIgnored /> filter (\x -> isGitHook x |> don't) + /> filter isLikelySourceFile +> traverse Dir.makeAbsolute +> traverse (namespaceFromPathOrDie root) let (namespaces, skippedNamespaces) = partition isBuildableNs allNamespaces @@ -326,6 +327,40 @@ isGitHook :: FilePath -> Bool isGitHook path = "Omni/Ide/hooks" `List.isInfixOf` path +-- | Filter out files that are clearly not source files to avoid namespace parsing errors +isLikelySourceFile :: FilePath -> Bool +isLikelySourceFile path = + not (isDotfile path || isConfigFile path) + where + isDotfile p = + let filename = List.reverse (takeWhile (/= '/') (List.reverse p)) + in case filename of + ('.' : _) -> True + _ -> False + isConfigFile p = + any + (`List.isSuffixOf` p) + [ ".json", + ".yaml", + ".yml", + ".toml", + ".ini", + ".cfg", + ".conf", + ".lock", + ".log", + ".tmp", + ".bak", + ".orig", + "Makefile", + "makefile", + "Dockerfile", + "LICENSE", + "README", + ".gitignore", + ".gitattributes" + ] + test_isGitHook :: Test.Tree test_isGitHook = Test.group -- cgit v1.2.3