From 09d5a5941a1feb23aece4d5311092c1a23d4ae11 Mon Sep 17 00:00:00 2001
From: Fabian Kirchner <kirchner@posteo.de>
Date: Fri, 13 Oct 2023 20:45:00 +0200
Subject: also support FIXME and QUESTION as markers

---
 app/Issue.hs | 23 ++++++++++++++++-------
 app/Main.hs  |  5 -----
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/app/Issue.hs b/app/Issue.hs
index a222d0a..ab47ba5 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -5,7 +5,7 @@
 
 module Issue (Issue (..), fromMatch, id) where
 
-import Data.List (find)
+import Data.List (find, foldl')
 import Data.Text (Text)
 import Data.Text qualified as T
 import Issue.Tag (Tag (..))
@@ -37,7 +37,7 @@ id issue =
 
 fromMatch :: G.Result -> G.Match -> Maybe Issue
 fromMatch result match =
-  if T.isPrefixOf marker title'
+  if any (\marker -> T.isPrefixOf marker title') issueMarkers
     then
       Just
         Issue
@@ -52,10 +52,19 @@ fromMatch result match =
     else Nothing
   where
     (title', description) = I.extractText result.file_type match.text
-    title = stripMarker title'
+    title = stripIssueMarkers title'
 
-marker :: Text
-marker = "TODO"
+issueMarkers :: [Text]
+issueMarkers =
+  [ "TODO",
+    "FIXME",
+    "QUESTION"
+  ]
 
-stripMarker :: Text -> Text
-stripMarker text = maybe text T.stripStart (T.stripPrefix marker text)
+stripIssueMarkers :: Text -> Text
+stripIssueMarkers text =
+  foldl' (stripIssueMarker) text issueMarkers
+
+stripIssueMarker :: Text -> Text -> Text
+stripIssueMarker text marker =
+  maybe text T.stripStart (T.stripPrefix marker text)
diff --git a/app/Main.hs b/app/Main.hs
index 0faff19..9e25025 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -70,11 +70,6 @@
 -- # @original-issue more information on the issue
 -- ```
 
--- TODO Add support for other keywords
---
--- Additionally to TODO, also FIXME should start an issue.  There might
--- be more interesting keywords.
-
 module Main where
 
 import Control.Exception (Exception, catch, handle, throw, throwIO)
-- 
cgit v1.2.3