Skip to content

Commit f46dd8b

Browse files
committed
Parse only handlers at the beginning of the line
1 parent 64300e2 commit f46dd8b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Aws/Lambda/Meta/Discover.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ modulesWithHandler files =
4545
&& isNotIgnoredPath file
4646

4747
isNotIgnoredPath file =
48-
filter ((Text.pack $ toFilePath file) `Text.isInfixOf`) ignoredPaths
48+
filter (Text.isInfixOf (Text.pack $ toFilePath file)) ignoredPaths
4949
& null
5050

5151
handlerNames :: [Path Rel File] -> [Text]
@@ -60,4 +60,7 @@ handlerNames modules =
6060
containsHandler :: Path Rel File -> IO Bool
6161
containsHandler file = do
6262
fileContents <- readFile $ toFilePath file
63-
pure $ "handler :: " `Text.isInfixOf` Text.pack fileContents
63+
lines fileContents
64+
& filter (Text.isPrefixOf "handler :: " . Text.pack)
65+
& (not . null)
66+
& pure

0 commit comments

Comments
 (0)