`flushBySource` leaves store unmodified if the source is not specified
- Dominant language
- Haskell
- Stars
- 423
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
`DiagnosticsBySource` is a `Map (Maybe Text) (SortedList Diagnostic)`, however, when flushing by source of `Nothing`, the key that has no source (`Nothing`) in the `DiagnosticsBySource`s is not removed. Instead, the store is returned unmodified. This causes two issues:
- the API doesn't allow for flushing diagnostics without source.
- the API is unintuitive because if the key is `Maybe Text`, the fact that you're passing a `Maybe Text` should mean that you're also removing that key and not leaving the store unmodified in that case. passing your store through the `id` function can be done by the user in any case.
Contributor guide
Research direction
Start by locating `flushBySource` and the `DiagnosticsBySource` definition, then inspect existing tests for source-based diagnostic flushing. Done means flushing with `Nothing` removes the no-source key instead of returning the store unchanged, with a regression test covering that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100