-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from csMACnz/release-0.5.0
Merge Release 0.5.0 to Master
- Loading branch information
Showing
14 changed files
with
139 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
version: 0.{build} | ||
skip_tags: true | ||
os: Windows Server 2012 R2 | ||
environment: | ||
COVERALLS_REPO_TOKEN: | ||
|
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
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,86 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Xml.Linq; | ||
|
||
namespace csmacnz.Coveralls | ||
{ | ||
public class DynamicCodeCoverageParser | ||
{ | ||
private readonly FileSystem _fileSystem; | ||
private readonly PathProcessor _pathProcessor; | ||
|
||
public DynamicCodeCoverageParser(FileSystem fileSystem, PathProcessor pathProcessor) | ||
{ | ||
_fileSystem = fileSystem; | ||
_pathProcessor = pathProcessor; | ||
} | ||
|
||
public List<CoverageFile> GenerateSourceFiles(XDocument document, bool useRelativePaths) | ||
{ | ||
var files = new List<CoverageFile>(); | ||
if (document.Root != null) | ||
{ | ||
var xElement = document.Root.Element("modules"); | ||
if (xElement != null) | ||
foreach (var module in xElement.Elements("module")) | ||
{ | ||
var filesElement = module.Element("source_files"); | ||
if (filesElement != null) | ||
{ | ||
foreach (var file in filesElement.Elements("source_file")) | ||
{ | ||
var fileid = file.Attribute("id").Value; | ||
var fullPath = file.Attribute("path").Value; | ||
var path = fullPath; | ||
if (useRelativePaths) | ||
{ | ||
path = _pathProcessor.ConvertPath(fullPath); | ||
} | ||
path = _pathProcessor.UnixifyPath(path); | ||
var coverageBuilder = new CoverageFileBuilder(path); | ||
|
||
var classesElement = module.Element("functions"); | ||
if (classesElement != null) | ||
{ | ||
foreach (var @class in classesElement.Elements("function")) | ||
{ | ||
var ranges = @class.Element("ranges"); | ||
if (ranges != null) | ||
{ | ||
foreach (var range in ranges.Elements("range")) | ||
{ | ||
var rangeFileId = range.Attribute("source_id").Value; | ||
if (fileid == rangeFileId) | ||
{ | ||
var sourceStartLine = int.Parse(range.Attribute("start_line").Value); | ||
var sourceEndLine = int.Parse(range.Attribute("end_line").Value); | ||
var covered = range.Attribute("covered").Value == "yes"; | ||
|
||
foreach ( | ||
var lineNumber in | ||
Enumerable.Range(sourceStartLine, | ||
sourceEndLine - sourceStartLine + 1)) | ||
{ | ||
coverageBuilder.RecordCoverage(lineNumber, covered ? 1 : 0); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
var readAllText = _fileSystem.TryLoadFile(fullPath); | ||
if (readAllText != null) | ||
{ | ||
coverageBuilder.AddSource(readAllText); | ||
} | ||
var coverageFile = coverageBuilder.CreateFile(); | ||
files.Add(coverageFile); | ||
} | ||
} | ||
} | ||
} | ||
return files; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="BCLExtensions" version="1.0.0" targetFramework="net451" /> | ||
<package id="docopt.net" version="0.6.1.6" targetFramework="net451" /> | ||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net451" /> | ||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net451" /> | ||
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net451" /> | ||
<package id="Newtonsoft.Json" version="6.0.6" targetFramework="net451" /> | ||
</packages> | ||
</packages> |