Skip to content

Commit

Permalink
Be explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Feb 28, 2020
1 parent 5e17afa commit 5c64f8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 7 additions & 7 deletions AltCover.Visualizer/CoverageFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ type InvalidFile =
module Transformer =
let internal DefaultHelper (_ : XDocument) (document : XDocument) = document

[<System.Diagnostics.CodeAnalysis.SuppressMessage(
"Gendarme.Rules.Correctness",
"EnsureLocalDisposalRule",
Justification = "Fails on travis -- FIXME"
)>]
[<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202",
Justification = "Multiple Close() should be safe")>]
let internal LoadTransform(path : string) =
let stylesheet =
XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream(path))
use str = Assembly.GetExecutingAssembly().GetManifestResourceStream(path)
use stylesheet =
XmlReader.Create(str)
let xmlTransform = new XslCompiledTransform()
xmlTransform.Load(stylesheet, new XsltSettings(false, true), null)
xmlTransform
Expand All @@ -52,6 +50,8 @@ module Transformer =
TransformFromOtherCover document "AltCover.Visualizer.OpenCoverToNCoverEx.xsl"
report

[<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202",
Justification = "Multiple Close() should be safe")>]
// PartCover to NCover style sheet
let internal ConvertFile (helper : CoverageTool -> XDocument -> XDocument -> XDocument)
(document : XDocument) =
Expand Down
14 changes: 5 additions & 9 deletions AltCover.Visualizer/Visualizer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@ module internal Persistence =
"DoNotSwallowErrorsCatchingNonSpecificExceptionsRule",
Justification = "need to exhaustively list the espected ones"
)>]
[<System.Diagnostics.CodeAnalysis.SuppressMessage(
"Gendarme.Rules.Correctness",
"EnsureLocalDisposalRule",
Justification = "Fails on travis -- FIXME"
)>]
let private EnsureFile() =
let profileDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
let dir = Directory.CreateDirectory(Path.Combine(profileDir, ".altcover"))
Expand All @@ -182,10 +177,11 @@ module internal Persistence =
let doc = XDocument.Load(file)
try
let schemas = new XmlSchemaSet()
use xsd =
new StreamReader(Assembly.GetExecutingAssembly()
.GetManifestResourceStream("AltCover.Visualizer.config.xsd"))
|> XmlReader.Create
use str = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("AltCover.Visualizer.config.xsd")
use xr = new StreamReader(str)
use xsd = xr |> XmlReader.Create

schemas.Add(String.Empty, xsd) |> ignore
doc.Validate(schemas, null)
(file, doc)
Expand Down

0 comments on commit 5c64f8d

Please sign in to comment.