From 2857c2deaa1af8c2affafb844e1bd0dfe344ba84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=A0ebek?= <44544735+xsebek@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:45:44 +0100 Subject: [PATCH] Link TODOs to Issues (#514) - replace `XXX` with `TODO: #` TODO has simply better editor support. The GitHub plugin will suggest creating an issue for TODO that does not have the issue number after it and some editors may even ask for confirmation when committing code with TODO. --- .github/workflows/check_todos.yml | 24 ++++++++++++++++++++++++ src/Swarm/Game/Log.hs | 2 +- src/Swarm/Language/Capability.hs | 6 +++--- src/Swarm/Language/LSP.hs | 2 +- src/Swarm/TUI/Controller.hs | 3 +-- src/Swarm/TUI/Model/StateUpdate.hs | 2 +- 6 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/check_todos.yml diff --git a/.github/workflows/check_todos.yml b/.github/workflows/check_todos.yml new file mode 100644 index 000000000..d18c2c9b5 --- /dev/null +++ b/.github/workflows/check_todos.yml @@ -0,0 +1,24 @@ +name: Look for TODOs +on: + push: + paths: + - '**.hs' + branches: + - main + pull_request: + paths: + - '**.hs' + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + if grep --include \*.hs -riP '(TODO|FIXME|XXX):?\s' src 2>&1 | grep -vP '#\d+'; then + echo "Please add a link to Issue, for example: TODO: #123" + exit 1 + else + echo "No TODOs without links found, all good!" + fi diff --git a/src/Swarm/Game/Log.hs b/src/Swarm/Game/Log.hs index ccf853bbd..3361219b9 100644 --- a/src/Swarm/Game/Log.hs +++ b/src/Swarm/Game/Log.hs @@ -14,7 +14,7 @@ -- want to use special kinds of logs that will be -- shown to the player. -- --- TODO: Currently we abuse this system for system +-- TODO: #1039 Currently we abuse this system for system -- logs, which is fun, but we should eventually make -- a dedicated `SystemLogEntry` type for 'RuntimeState' -- message queue. diff --git a/src/Swarm/Language/Capability.hs b/src/Swarm/Language/Capability.hs index 780059fbd..230a848ab 100644 --- a/src/Swarm/Language/Capability.hs +++ b/src/Swarm/Language/Capability.hs @@ -248,7 +248,7 @@ constCaps = \case Case -> Just CSum Fst -> Just CProd Snd -> Just CProd - -- XXX pair syntax should require CProd too + -- TODO: #563 pair syntax (1,2,3...) should require CProd too -- ---------------------------------------------------------------- -- Some additional straightforward ones, which however currently @@ -259,6 +259,6 @@ constCaps = \case Random -> Just CRandom -- randomness device (with bitcoins)? -- ---------------------------------------------------------------- -- Some more constants which *ought* to have their own capability but - -- currently don't. TODO: #26 - View -> Nothing -- XXX this should also require something. + -- currently don't. + View -> Nothing -- TODO: #17 should require equipping an antenna Knows -> Nothing diff --git a/src/Swarm/Language/LSP.hs b/src/Swarm/Language/LSP.hs index 343ecfe71..19907506d 100644 --- a/src/Swarm/Language/LSP.hs +++ b/src/Swarm/Language/LSP.hs @@ -70,7 +70,7 @@ validateSwarmCode :: J.NormalizedUri -> J.TextDocumentVersion -> Text -> LspM () validateSwarmCode doc version content = do -- debug $ "Validating: " <> from (show doc) <> " ( " <> content <> ")" - -- FIXME With this call to flushDiagnosticsBySource in place, the warnings + -- FIXME: #1040 With this call to flushDiagnosticsBySource in place, the warnings -- in other buffers (editor tabs) end up getting cleared when switching between -- (focusing on) other buffers in VS Code. -- However, getting rid of this seems to break error highlighting. diff --git a/src/Swarm/TUI/Controller.hs b/src/Swarm/TUI/Controller.hs index e6a71980e..5ab7c780e 100644 --- a/src/Swarm/TUI/Controller.hs +++ b/src/Swarm/TUI/Controller.hs @@ -582,8 +582,7 @@ updateAchievements = do -- Don't save to disk unless there was a change in the attainment list. let incrementalAchievements = wrappedGameAchievements `M.difference` oldMasterAchievementsList unless (null incrementalAchievements) $ do - -- TODO: This is where new achievements would be displayed in - -- a popup (see #916) + -- TODO: #916 This is where new achievements would be displayed in a popup newAchievements <- use $ uiState . uiAchievements liftIO $ saveAchievementsInfo $ M.elems newAchievements diff --git a/src/Swarm/TUI/Model/StateUpdate.hs b/src/Swarm/TUI/Model/StateUpdate.hs index a18aa2ea3..b0b01369f 100644 --- a/src/Swarm/TUI/Model/StateUpdate.hs +++ b/src/Swarm/TUI/Model/StateUpdate.hs @@ -94,7 +94,7 @@ startGameWithSeed userSeed siPair@(_scene, si) toRun = do gameState . scenarios . scenarioItemByPath p . _SISingle . _2 . scenarioStatus .= InProgress t 0 0 scenarioToAppState siPair userSeed toRun --- XXX do we need to keep an old entity map around??? +-- TODO: #516 do we need to keep an old entity map around??? -- | Modify the 'AppState' appropriately when starting a new scenario. scenarioToAppState :: (MonadIO m, MonadState AppState m) => ScenarioInfoPair -> Maybe Seed -> Maybe CodeToRun -> m ()