tag:help.appveyor.com,2012-11-13:/discussions/kb/9-support-for-stylecop-reportAppVeyor: Discussion 2018-08-25T01:49:12Ztag:help.appveyor.com,2012-11-13:Comment/346679722014-09-22T12:31:08Z2014-09-22T12:31:08ZSupport for StyleCop Report<div><p>Hello,</p>
<p>I am trying to run StyleCop as part of my build process, and I
would like to see the report in the build results.</p>
<p>I have tried to do this, but I am running into an issue. My
results file doesn't seem to be there where I expect it to be. It
is almost as though StyleCop isn't being executed. The only reason
that this wouldn't happen is if the nuget package for
StyleCop.Msbuild wasn't available. And I think that this is at the
heart of the matter.</p>
<p>In each build that I have executed since I started trying to do
this, I am getting the following output when I try to do a nuget
package restore:</p>
<pre>
<code>All packages listed in packages.config are already installed.</code>
</pre>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-unstable.34+34%20(Build%2052)">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a><br>
<a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-unstable.34+34%20(Build%2053)">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a><br>
<a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-unstable.34+34%20(Build%2054)">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a><br>
<a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-unstable.34+34%20(Build%2055)">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a></p>
<p>When I would expect to get:</p>
<pre>
<code>Running NugetPackageRestore...
Installing 'StyleCop.MSBuild 4.7.49.0'.
Successfully installed 'StyleCop.MSBuild 4.7.49.0'.
All packages listed in packages.config are already installed.</code>
</pre>
<p>Which is what I get if I run the build locally, but first delete
the StyleCop.Msbuild folder from the packages folder. The reason
that I started looking at this as the potential problem is that I
am using build_cache, and I wondered if that might be an issue.</p>
<p>Also, what support is there for transforming the XML file from
the report file into something that can be easily read in the
results window?</p>
<p>Thanks<br>
Gary</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-09-22T12:45:24Z2014-09-22T12:45:24ZSupport for StyleCop Report<div><p>To rule out the build cache, I have just pushed a change to the
appveyor.yml file to remove it, and I can see the nuget packages
getting restored:</p>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/1.0.56">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/1....</a></p>
<p>Here there are:</p>
<pre>
<code>Running NugetPackageRestore...
Installing 'Autofac 3.5.2'.
Installing 'Microsoft.Bcl.Build 1.0.21'.
Installing 'AutoMapper 3.2.1'.
Installing 'Microsoft.Data.OData 5.6.2'.
Successfully installed 'Autofac 3.5.2'.
Successfully installed 'Microsoft.Bcl.Build 1.0.21'.
Successfully installed 'Microsoft.Data.OData 5.6.2'.
Installing 'Rx-Core 2.2.5'.
Istalling 'Mindscape.Raygun4Net 3.3.2'.
Successfully installed 'AutoMapper 3.2.1'.
Successfully installed 'Rx-Core 2.2.5'.
Successfully installed 'Mindscape.Raygun4Net 3.3.2'.
Installing 'Newtonsoft.Json 6.0.5'.
Successfully installed 'Newtonsoft.Json 6.0.5'.
Installing 'log4net 2.0.3'.
Installing 'Rx-Main 2.2.5'.
Installing 'Rx-WPF 2.2.5'.
Installing 'Rx-PlatformServices 2.2.5'.
Installing 'Microsoft.Bcl 1.1.9'.
Installing 'Microsoft.Bcl.Async 1.0.168'.
Installing 'Microsoft.Data.Edm 5.6.2'.
Installing 'MahApps.Metro 0.14.0.0'.
Installing 'MahApps.Metro.Resources 0.3.0.0'.
Successfully installed 'Rx-Main 2.2.5'.
Installing 'Rx-Xaml 2.2.5'.
Successfully installed 'Rx-WPF 2.2.5'.
Successfully installed 'Rx-Xaml 2.2.5'.
Successfully installed 'MahApps.Metro 0.14.0.0'.
Successfully installed 'Rx-PlatformServices 2.2.5'.
Successfully installed 'log4net 2.0.3'.
Installing 'System.Spatial 5.6.2'.
Successfully installed 'MahApps.Metro.Resources 0.3.0.0'.
Successfully installed 'Microsoft.Data.Edm 5.6.2'.
Installing 'Rx-Linq 2.2.5'.
Successfully installed 'System.Spatial 5.6.2'.
Installing 'Microsoft.Data.Services.Client 5.6.2'.
nstalling 'System.Management.Automation 6.1.7601.17515'.
Installing 'Rx-Interfaces 2.2.5'.
Successfully installed 'Rx-Interfaces 2.2.5'.
Successfully installed 'System.Management.Automation 6.1.7601.17515'.
Successfully installed 'Microsoft.Bcl.Async 1.0.168'.
Successfully installed 'Rx-Linq 2.2.5'.
Successfully installed 'Microsoft.Data.Services.Client 5.6.2'.
Successfully installed 'Microsoft.Bcl 1.1.9'.</code>
</pre>
<p>As you can see, StyleCop.MsBuild is not on the list of packages
that were installed, even though it is part of the packages.config
file that I am checking in.</p>
<p>I have just done:</p>
<pre>
<code>git clone -q https://github.com/chocolatey/ChocolateyGUI.git C:\projects\ChocolateyGUI
git fetch -q origin +refs/pull/164/merge:
git checkout -qf FETCH_HEAD</code>
</pre>
<p>On my local machine, and these are the contents of the
packages.config file:</p>
<pre>
<code><?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.2" targetFramework="net40" />
<package id="AutoMapper" version="3.2.1" targetFramework="net40" />
<package id="log4net" version="2.0.3" targetFramework="net40" />
<package id="MahApps.Metro" version="0.14.0.0" targetFramework="net40" />
<package id="MahApps.Metro.Resources" version="0.3.0.0" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net40" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net40" />
<package id="Microsoft.Data.Edm" version="5.6.2" targetFramework="net40" />
<package id="Microsoft.Data.OData" version="5.6.2" targetFramework="net40" />
<package id="Microsoft.Data.Services.Client" version="5.6.2" targetFramework="net40" />
<package id="Mindscape.Raygun4Net" version="3.3.2" targetFramework="net40" />
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net40" />
<package id="Rx-Core" version="2.2.5" targetFramework="net40" />
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net40" />
<package id="Rx-Linq" version="2.2.5" targetFramework="net40" />
<package id="Rx-Main" version="2.2.5" targetFramework="net40" />
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net40" />
<package id="Rx-WPF" version="2.2.5" targetFramework="net40" />
<package id="Rx-Xaml" version="2.2.5" targetFramework="net40" />
<package id="StyleCop.MSBuild" version="4.7.49.0" targetFramework="net40" developmentDependency="true" />
<package id="System.Management.Automation" version="6.1.7601.17515" targetFramework="net40" />
<package id="System.Spatial" version="5.6.2" targetFramework="net40" />
</packages></code>
</pre></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-09-22T12:46:49Z2014-09-22T12:46:49ZSupport for StyleCop Report<div><p>Sorry, that submitted before I was finished...</p>
<p>Do you have any ideas as to why the StyleCop.MsBuild package
isn't getting installed? I have just noticed the
developmentDependency flag, but my understanding of that is that it
only gets inspected during <code>nuget pack</code> not <code>nuget
restore</code></p>
<p>Any ideas?</p>
<p>Thanks</p>
<p>Gary</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-09-23T06:51:04Z2014-09-23T06:51:04ZSupport for StyleCop Report<div><p>Hello Feodor,</p>
<p>I am really starting to think that there is something not quite
right with the Pull Request mechanism in AppVeyor, or the way that
I am doing things.</p>
<p>I have just merged the above work into the develop branch, and
straight away, where the StyleCop.MsBuild package was not getting
installed, now it is:</p>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/1.0.67">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/1....</a></p>
<p>Do you have any ideas about what could be going on here.</p>
<p>This is the second time that code, while in a Pull Request
branch, wasn't working correctly, but as soon as I pull it into the
main branch, it works exactly as expected.</p>
<p>Thanks</p>
<p>Gary</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-09-23T21:06:15Z2014-09-23T21:06:15ZSupport for StyleCop Report<div><p>Ok, as discussed on GitHub, I don't think this issue is anything
to do with AppVeyor, but rather GitVersion, so don't think there is
anything else to worry about on that score.</p>
<p>However, I would still like to know how I can submit other
result xml files to AppVeyor for display in the build report.</p>
<p>The two main tests are StyleCop and also Code Analysis (FxCop).
How can I go about including these test results? I am assuming that
this would be something that would have to be done on your end?</p>
<p>Thanks</p>
<p>Gary</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-09-23T21:25:43Z2014-09-23T21:25:43ZSupport for StyleCop Report<div><p>Wow, amazing findings! I've been sure GitVersion works in kind
of "read-only" mode. Interesting indeed.</p>
<p>For <a href=
"http://www.appveyor.com/docs/running-tests#test-results">pushing
test results into AppVeyor</a> there are two ways right now:</p>
<ol>
<li>Using Build Worker REST (PS, CMD) API, so you have an
additional PS script parsing XML and calling API for each test or
batch. This sample is a good start: <a href=
"http://help.appveyor.com/discussions/questions/495-integrating-chutzpah-into-appveyor#comment_34475268">
http://help.appveyor.com/discussions/questions/495-integrating-chut...</a><br>
</li>
<li>Uploading test results to AppVeyor. xUnit, NUnit and MSTest
formats are supported.</li>
</ol>
<p>Though I think other parsers could be easily added. Send me
their sample XML output.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/346679722014-09-24T11:52:25Z2014-09-24T11:52:25ZSupport for StyleCop Report<div><p>Sure, no probs. Here are some sample reports, both for StyleCop
and FxCop, for when there are errors, and when there are none.</p>
<p>In the mean time, I will take a look at the REST API.</p>
<p>However, I do think that this is something that would benefit
multiple people, and a common usage, so direct support from a
parser in AppVeyor would be a great addition :-)</p>
<p>Thanks!</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-10-07T12:19:30Z2014-10-07T12:19:30ZSupport for StyleCop Report<div><p>Feodor,</p>
<p>How do this look to you?</p>
<p><a href=
"https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0.12.0-PullRequest.179+8%20(Build%20101)/tests">
https://ci.appveyor.com/project/GaryEwanPark/chocolateygui/build/0....</a></p>
<p>I have added a very simple parsing routine to my psake script to
inspect the violations within the generated StyleCop Report:</p>
<pre>
<code>function analyseStyleCopResults( [Parameter(ValueFromPipeline=$true)]$styleCopResultsFile ) {
$styleCopViolations = [xml](Get-Content $styleCopResultsFile)
foreach ($styleCopViolation in $styleCopViolations.StyleCopViolations.Violation) {
$output = "Violation of Rule $($styleCopViolation.RuleId): $($styleCopViolation.Rule) Line Number: $($styleCopViolation.LineNumber) -Outcome Failed -FileName $($styleCopViolation.Source) -ErrorMessage $($styleCopViolation.InnerXml)"
Write-Host $output
if(isAppVeyor) {
Add-AppveyorTest "Violation of Rule $($styleCopViolation.RuleId): $($styleCopViolation.Rule) Line Number: $($styleCopViolation.LineNumber)" -Outcome Failed -FileName $styleCopViolation.Source -ErrorMessage $styleCopViolation.InnerXml
}
}
}</code>
</pre>
<p>Gary</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-10-07T12:20:40Z2014-10-07T12:20:40ZSupport for StyleCop Report<div><p>Next up, Code Analysis Results file...</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-10-07T18:38:44Z2014-10-07T18:38:44ZSupport for StyleCop Report<div><p>Looks cool! I'm moving this thread to KB.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/346679722014-10-08T21:25:02Z2014-10-08T21:25:02ZSupport for StyleCop Report<div><p>Sounds good to me.</p>
<p>Should I close this discussion, or leave it open?</p></div>gep13tag:help.appveyor.com,2012-11-13:Comment/346679722014-10-08T21:34:31Z2014-10-08T21:34:31ZSupport for StyleCop Report<div><p>Leave it open.</p></div>Feodor Fitsner