1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Output file path as summary key

This commit is contained in:
joshvera 2016-08-10 13:38:18 -04:00
parent ae0f18593b
commit 7a9f0b7786

View File

@ -8,7 +8,9 @@ import Range
import DiffSummary
import Source
import Data.Aeson
import Data.Functor.Both (runBothWith)
summary :: (HasField fields Category, HasField fields Range) => Renderer (Record fields)
summary blobs diff = SummaryOutput $ "summaries" .= (summaries >>= annotatedSummaries)
where summaries = diffSummaries (source <$> blobs) diff
summary blobs diff = SummaryOutput $ (runBothWith toSummaryKey (path <$> blobs)) .= (summaries >>= annotatedSummaries)
where summaries = diffSummaries (source <$> blobs) diff
toSummaryKey before after = toS $ if before == after then after else before <> " -> " <> after