Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Static analysis to find unnecessary locations (#416)
- Loading branch information
1 parent
3879e66
commit 288d13e
Showing
29 changed files
with
1,906 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
plutus-contract/src/Plutus/Contract/Test/Coverage/Analysis.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{-# OPTIONS_GHC -Wno-name-shadowing #-} | ||
|
||
module Plutus.Contract.Test.Coverage.Analysis | ||
( computeRefinedCoverageIndex | ||
) where | ||
|
||
import Control.Lens | ||
|
||
import Data.Map qualified as Map | ||
import Data.Set qualified as Set | ||
|
||
import PlutusCore.Default | ||
import PlutusTx.Code | ||
import PlutusTx.Coverage | ||
|
||
import Plutus.Contract.Test.Coverage.Analysis.Interpreter | ||
|
||
computeRefinedCoverageIndex :: CompiledCodeIn DefaultUni DefaultFun a -> CoverageIndex | ||
computeRefinedCoverageIndex cc = | ||
foldr (flip addCoverageMetadata IgnoredAnnotation) covIdx (Set.toList ignoredLocs) | ||
where | ||
covIdx = getCovIdx cc | ||
importantLocs = allNonFailLocations cc | ||
ignoredLocs = covIdx ^. coverageMetadata . to Map.keysSet . to (`Set.difference` importantLocs) |
Oops, something went wrong.