2 StyleCop problems found

Oct 9, 2008 at 2:22 PM
1. In MSBuild.ExtensionPack.tasks file in the line:
    <UsingTask AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\StyleCop\v4.3\MSBuild.ExtensionPack.CodeQuality.StyleCop.dll" TaskName="MSBuild.ExtensionPack.CodeQuality.StyleCop"/>
    MSBuild.ExtensionPack.CodeQuality.StyleCop.dll should be renamed to MSBuild.ExtensionPack.StyleCop.dll, I think :)

2. I want to analyze my project with StyleCop and your extensions. It consists of two solutions - Solution_A which is placed in Solution_A_Folder and Solution_B which is placed in Solution_B_Folder, both folders are placed in the Source folder like this:
    --Source
    ----Solution_A_Folder
    ----Solution_B_Folder
    
    So i override AfterGet target in my TFSBuild.proj:

 

 

 

<

Target Name="AfterGet" DependsOnTargets="InitializeWorkspace">

 

    <!--

Create a collection of files to scan -->

 

    <

CreateItem Include="$(SolutionRoot)\**\*.cs">

 

    <

Output TaskParameter="Include" ItemName="StyleCopFiles"/>

 

    </

CreateItem>

 

    <!--

Run the StyleCop MSBuild task -->

 

    <

MSBuild.ExtensionPack.CodeQuality.StyleCop TaskAction="Scan"

 

 

        SourceFiles="@(StyleCopFiles)"

 

 

        ShowOutput="true"

 

 

        ForceFullAnalysis="true"

 

 

        CacheResults="false"

 

 

        logFile="$(SolutionRoot)\StyleCopLog.txt"

 

 

        SettingsFile="$(MSBuildExtensionsPath)\Microsoft\StyleCop\v4.3\Settings.StyleCop">

 

    <

Output TaskParameter="Succeeded" PropertyName="AllPassed"/>

 

    <

Output TaskParameter="ViolationCount" PropertyName="Violations"/>

 

    <

Output TaskParameter="FailedFiles" ItemName="Failures"/>

 

    </

MSBuild.ExtensionPack.CodeQuality.StyleCop>

 

    <

Message Text="Succeeded: $(AllPassed), Violations: $(Violations)"/>

 

    <

Message Text="%(Failures.Identity) - Failed on Line %(Failures.LineNumber). %(Failures.CheckId): %(Failures.Message)"/>

 

</

Target>

 


    Everything is OK while getting *.cs files from both A and B fodlers to @(StyleCopFiles), but when the analyses starts, it check only files from folder the FIRST in Solution_A_Folder :(
Coordinator
Oct 9, 2008 at 9:06 PM
Edited Oct 9, 2008 at 9:09 PM
Thanks for the bug report. #1 has been resolved and checked in.

I'm trying to repro #2 but haven't managed to yet.

I created a folder structure like you have said (You can find the zipped content here: http://cid-ec3c8f2028d842d5.skydrive.live.com/self.aspx/MSBEPPublic/StyleCopIssue.zip)

I run the following sample:


<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <CreateItem Include="C:\Source\**\*.cs">
            <Output TaskParameter="Include" ItemName="StyleCopFiles"/>
        </CreateItem>
        <MSBuild.ExtensionPack.CodeQuality.StyleCop TaskAction="Scan" SourceFiles="@(StyleCopFiles)" ShowOutput="true" ForceFullAnalysis="true" CacheResults="false" logFile="c:\StyleCopLog.txt" SettingsFile="C:\Program Files (x86)\MSBuild\Microsoft\StyleCop\v4.3\Settings.StyleCop">
            <Output TaskParameter="Succeeded" PropertyName="AllPassed"/>
            <Output TaskParameter="ViolationCount" PropertyName="Violations"/>
            <Output TaskParameter="FailedFiles" ItemName="Failures"/>
        </MSBuild.ExtensionPack.CodeQuality.StyleCop>
        <Message Text="Succeeded: $(AllPassed), Violations: $(Violations)"/>
        <Message Text="%(Failures.Identity) - Failed on Line %(Failures.LineNumber). %(Failures.CheckId): %(Failures.Message)"/>
    </Target>
</Project>


And I get:


C:\Projects\CodePlex\MSBuildExtensionPack\Solutions\Main3.5\StyleCop\XmlSamples>
msbuild StyleCop.proj
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3053]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
 
Build started 09/10/2008 21:54:05.
Project "C:\Projects\CodePlex\MSBuildExtensionPack\Solutions\Main3.5\StyleCop\X
mlSamples\StyleCop.proj" on node 0 (default targets).
  Performing StyleCop scan...
  SourceFiles count is: 4
  Adding file:C:\Source\Solution_A_Folder\a.cs
  Adding file:C:\Source\Solution_A_Folder\FIRST\a.cs
  Adding file:C:\Source\Solution_B_Folder\b.cs
  Adding file:C:\Source\Solution_B_Folder\FIRST\b.cs
  Pass 1: a.cs...
  Pass 1: a.cs...
  Pass 1: b.cs...
  Pass 1: b.cs...
  16 violations encountered.
  Succeeded: False, Violations: 16
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 13. SA1600: The class must have a documentation header.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 13. SA1600: The class must have a documentation header.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 15. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 15. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 16. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 16. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 17. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 17. SA1600: The field must have a documentation header.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 1. SA1638: The file attribute in the file header's copyright tag must contain the name of the file.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 1. SA1638: The file attribute in the file header's copyright tag must contain the name of the file.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 19. SA1507: The code must not contain multiple blank lines in a row.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 19. SA1507: The code must not contain multiple blank lines in a row.
  C:\Source\Solution_A_Folder\a.cs - Failed on Line 21. SA1508: A closing curly bracket must not be preceded by a blank line.
  C:\Source\Solution_A_Folder\FIRST\a.cs - Failed on Line 21. SA1508: A closing curly bracket must not be preceded by a blank line.
  C:\Source\Solution_B_Folder\b.cs - Failed on Line 1. SA1633: The file has no header, the header Xml is invalid, or the header is not located at the top of the file.
  C:\Source\Solution_B_Folder\FIRST\b.cs - Failed on Line 1. SA1633: The file has no header, the header Xml is invalid, or the header is not located at the top of the file.
 
Done Building Project "C:\Projects\CodePlex\MSBuildExtensionPack\Solutions\Main
3.5\StyleCop\XmlSamples\StyleCop.proj" (default targets).
 
 
Build succeeded.
    0 Warning(s)
    0 Error(s)
 
Time Elapsed 00:00:00.34


As you can see, its picking up both folders as expected. Could you provide a zipped repro?

Thanks

Mike

Oct 10, 2008 at 6:59 AM
Edited Oct 10, 2008 at 7:11 AM
May be I have a more complex folder-structure:

c:\Program Files (x86)\MSBuild\ExtensionPack\Samples>C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild
.exe StyleCop.proj
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3053]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 10.10.2008 9:53:15.
Project "c:\Program Files (x86)\MSBuild\ExtensionPack\Samples\StyleCop.proj" on node 0 (default tar
gets).
  Performing StyleCop scan...
  SourceFiles count is: 88
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\IDefaultMasterView.cs
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\Views\DefaultViewPresenter.cs
  Adding file:c:\Source\Solution_A\Main\Source\Modules\Shell\Views\IDefaultView.cs
  Adding file:c:\Source\Solution_A\Main\Source\WebSites\Solution_A\Default.aspx.cs
  Adding file:c:\Source\Solution_A\Main\Source\WebSites\Solution_A\Shared\DefaultMaster.master.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\CurrentContext.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Alerting\Alerter.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Currency.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Department.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\DomainObj.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\ObjectFactory.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Office.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Person.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\PersonMailing.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Position.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Room.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Collection\PersonCollection.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Collection\PositionsCollection.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Collection\RoleCollection.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Collection\RoomCollection.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Enums\PersonRole.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\BLL\Enums\RoleName.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Caching\Solution_BCacheManager.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\CurrencyDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\DepartmentDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\Names.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\OfficeDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\PersonDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\PositionDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\RoomDAO.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\DAL\SafeReader.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\ExceptionMessage.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSApplicationException.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSAuthenticationException.c
  s
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSBaseException.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSProgramException.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSSecurityException.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Exceptions\MSValidateException.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Logging\Logger.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Mailing\BaseMailMessage.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Mailing\ExceptionMailMessage.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Utils\StringUtil.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL\Utils\TypeSelectorUtil.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\CountryTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\CurrencyTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\DepartmentTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\OfficeTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\PersonTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\PositionTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\RoomTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\VSCodeGenAccessors.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.BLL.Test\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\MainForm.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\MainForm.Designer.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\PersonsForm.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\PersonsForm.Designer.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\Program.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\SelectDBForm.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\SelectDBForm.Designer.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\Enums\ProjectType.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\Properties\Resources.Designer.c
  s
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.TesterTool\Properties\Settings.Designer.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\CollapsableControl\Collapsa
  bleControl.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\CollapsableControl\Design\C
  ollapseControlDesigner.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\ConfirmCloseControl\Confirm
  CloseControl.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\GridViewEx\GridViewEx.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\GridViewEx\GridViewExtended
  .cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\TabControl\PageControl.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\TabControl\TabPage.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\ToolTipControl\ToolTipContr
  ol.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Components\WideComboBox\WideComboBox.c
  s
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\HttpModules\MSAuthenticationModule.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution_B.Web\Utils\RequestUtil.cs
  Adding file:c:\Source\Solution_B\Main\Source\Solution_B\Solution Items\Solution_BAssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database FCSM.Test\DatabaseSetup.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database FCSM.Test\FillByStartupDataTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database FCSM.Test\FillDatabaseByTestDataTest
  .cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database FCSM.Test\FillOSByTestDataTest.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database FCSM.Test\Properties\AssemblyInfo.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database.OS.Test\DatabaseSetup.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database.OS.Test\UnitTest1.cs
  Adding file:c:\Source\Solution_B\Main\Source\Database\Database.OS.Test\Properties\AssemblyInfo.cs
  Pass 1: DefaultMasterPresenter.cs...
  Pass 1: ShellModuleInitializer.cs...
  48 violations encountered.
  Succeeded: False, Violations: 44
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 1
  1. SA1604: The documentation header must have a summary tag.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 2
  4. SA1604: The documentation header must have a summary tag.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 3
  0. SA1604: The documentation header must have a summary tag.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 16. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 21. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 1
  . SA1633: The file has no header, the header Xml is invalid, or the header is not located at the
  top of the file.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 27. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 27. SA1612: T
  he param tags in the documentation header must match the element's parameter list.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 27. SA1614: T
  he documentation text within the param tag for the '<param name="moduleContainer"></param>' param
  eter must not be empty.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 41. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 41. SA1614: T
  he documentation text within the param tag for the '<param name="globalServices"></param>' parame
  ter must not be empty.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 52. SA1614: T
  he documentation text within the param tag for the '<param name="moduleServices"></param>' parame
  ter must not be empty.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 61. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 61. SA1614: T
  he documentation text within the param tag for the '<param name="siteMapBuilderService"></param>'
   parameter must not be empty.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 77. SA1631: T
  he documentation text within the summary tag does not appear to follow a proper grammatical struc
  ture required for documentation text.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 77. SA1614: T
  he documentation text within the param tag for the '<param name="services"></param>' parameter mu
  st not be empty.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 1. SA1633: Th
  e file has no header, the header Xml is invalid, or the header is not located at the top of the f
  ile.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 8
  . SA1505: An opening curly bracket must not be followed by a blank line.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 1
  2. SA1505: An opening curly bracket must not be followed by a blank line.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 3
  9. SA1507: The code must not contain multiple blank lines in a row.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 36. SA1507: T
  he code must not contain multiple blank lines in a row.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 47. SA1507: T
  he code must not contain multiple blank lines in a row.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 1
  . SA1200: All using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 2
  . SA1200: All using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 3
  . SA1200: All using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 4
  . SA1200: All using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 5
  . SA1200: All using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 1. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 2. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 3. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 4. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 5. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 6. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 7. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 8. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 9. SA1200: Al
  l using directives must be placed inside of the namespace.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 77. SA1202: A
  ll protected methods must be placed after all public methods.
  c:\Source\Solution_A\Main\Source\Modules\Shell\MasterPages\DefaultMasterPresenter.cs - Failed on Line 4
  . SA1210: Using directives must be sorted alphabetically by the namespaces.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 5. SA1210: Us
  ing directives must be sorted alphabetically by the namespaces.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 6. SA1210: Us
  ing directives must be sorted alphabetically by the namespaces.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 7. SA1210: Us
  ing directives must be sorted alphabetically by the namespaces.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 31. SA1101: T
  he call to AddGlobalServices must begin with the 'this.' prefix to indicate that the item is a me
  mber of the class.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 32. SA1101: T
  he call to AddModuleServices must begin with the 'this.' prefix to indicate that the item is a me
  mber of the class.
  c:\Source\Solution_A\Main\Source\Modules\Shell\ShellModuleInitializer.cs - Failed on Line 33. SA1101: T
  he call to RegisterSiteMapInformation must begin with the 'this.' prefix to indicate that the ite
  m is a member of the class.
  TPath -
Done Building Project "c:\Program Files (x86)\MSBuild\ExtensionPack\Samples\StyleCop.proj" (default
 targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.53

My StyleCop.csproj:

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
    <Target Name="Default">
        <!-- Create a collection of files to scan -->
        <CreateItem Include="c:\Source\**\*.cs">
            <Output TaskParameter="Include" ItemName="StyleCopFiles"/>
        </CreateItem>
        <!-- Run the StyleCop MSBuild task -->
        <MSBuild.ExtensionPack.CodeQuality.StyleCop
       TaskAction="Scan"
       SourceFiles="@(StyleCopFiles)"
       ShowOutput="true"
       ForceFullAnalysis="false"
       CacheResults="false"
       logFile="C:\StyleCopLog.txt"
       SettingsFile="C:\Settings.StyleCop">
            <Output TaskParameter="Succeeded" PropertyName="AllPassed"/>
            <Output TaskParameter="ViolationCount" PropertyName="Violations"/>
            <Output TaskParameter="FailedFiles" ItemName="Failures"/>
        </MSBuild.ExtensionPack.CodeQuality.StyleCop>
        <Message Text="Succeeded: $(AllPassed), Violations: $(Violations)"/>
        <!-- FailedFile format is:
        <ItemGroup>
            <FailedFile Include="filename">
                <CheckId>SA Rule Number</CheckId>
                <RuleDescription>Rule Description</RuleDescription>
                <RuleName>Rule Name</RuleName>
                <LineNumber>Line the violation appears on</LineNumber>
                <Message>SA violation message</Message>
            </FailedFile>
        </ItemGroup>-->
        <Message Text="%(Failures.Identity) - Failed on Line %(Failures.LineNumber). %(Failures.CheckId): %(Failures.Message)"/>
        <Message Text="TPath - $(TPath)"/>
    </Target>
</Project>

Coordinator
Oct 10, 2008 at 10:26 AM
Hi

Please can you try running it with the debug version I have put here: http://cid-ec3c8f2028d842d5.skydrive.live.com/self.aspx/MSBEPPublic/MSBuild.ExtensionPack.StyleCop%20DEBUG.zip
Simply replace your extension assembly in the stylecop folder.

In this build, if StyleCop fails to add a file for processing, it will error.

Would it be possible to provide a zip of your sourcecode, or a sample that repros the issue?

Mike
Oct 27, 2008 at 2:52 PM

Hi,
I've got a similar result with MSBuild.ExtensionPack.StyleCop.dll like shengen's one(#2).
We use TFS2008 and i integrated MSBuild.ExtensionPack.CodeQuality.StyleCop task into our daily build teamproject (the msbuild script completely same as the sample in the help)

 

Target "CodeQuality" in file "c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\TFSBuild.proj" from project "c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\TFSBuild.proj":

Using "CreateItem" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

Task "CreateItem"

Done executing task "CreateItem".

Using "MSBuild.ExtensionPack.CodeQuality.StyleCop" task from assembly "C:\Program Files\MSBuild\Microsoft\StyleCop\v4.3\MSBuild.ExtensionPack.StyleCop.dll".

Task "MSBuild.ExtensionPack.CodeQuality.StyleCop"

c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\TFSBuild.proj : warning : DEBUG CODE ------ DEBUG CODE

c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\TFSBuild.proj : warning : DEBUG CODE ------ DEBUG CODE

c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\TFSBuild.proj : warning : DEBUG CODE ------ DEBUG CODE

  Performing StyleCop scan...

  SourceFiles count is: 392

  Adding file: c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\..\Sources\Source\Business\AssemblyInfo.cs

  ...

  Adding file: c:\builds\HWI080902-SI-AGENT-1\HWI080902-SI\EzyControl_Development\BuildType\..\Sources\Source\UI\WebApplication\EntityAdministration\EntityAdministration.ascx.cs

  Pass 1: AssemblyInfo.cs...

  Pass 1: AuditTable.cs...

  Pass 1: BackendSystemStatusTable.cs...

  6 violations encountered.

Done executing task "MSBuild.ExtensionPack.CodeQuality.StyleCop".

Task "Message"

  Succeeded: False, Violations: 2

Done executing task "Message".

 

As you can see I replaced the dll with the downloaded DEBUG version on the buildagent machine...the scanning is stoped at the third file (in the same source folder)...
Should i change the verbosity level or any idea? 

Anti

Coordinator
Oct 27, 2008 at 7:09 PM
Hi Anti

Any chance of getting a zip of your code? I can provide a secured FTP drop. Failing that, if you have a smaller repro that you can share. I can't repro this one. Changing the verbosity won't do anything for you.

Mike
Oct 8, 2009 at 4:10 AM

Was any more progress made on this issue? I'm using the 3.5.4.0 release of MSBuild Extension Pack with the 4.3 release of StyleCop, and am finding a similar result - the task will only process a handful of files, then terminate. Here's the interesting excerpt from the logs:

  Pass 1: AdvertiserDB.cs...
  Pass 1: CommonAssemblyInfo.cs...
  Loaded Analyzer: Documentation Rules...
  Loaded Analyzer: Layout Rules...
  Loaded Analyzer: Maintainability Rules...
  Loaded Analyzer: Naming Rules...
  Loaded Analyzer: Ordering Rules...
  Loaded Analyzer: Readability Rules...
  Loaded Analyzer: Spacing Rules...
  Exception thrown by analyzer 'Naming Rules' while processing 'D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Src\API\Advertiser\AdvertiserDB.cs'.
  Pass 1: Address.cs...
  Exception thrown by analyzer 'Naming Rules' while processing 'D:\Source\MyProject\DailyBuild\BuildType\..\Sources\Src\API\Advertiser\Address\Address.cs'.
  73 violations encountered.

Done executing task "MSBuild.ExtensionPack.CodeQuality.StyleCop".

But there is no further detail on what the exception is. If I try to run StyleCop against the two offending files from within Visual Studio, it works just fine (with a total of 89 violations). Is there any way I can find out what the exceptions were?

Coordinator
Oct 8, 2009 at 11:32 AM

Can you confirm you are using 4.3.2.1.

Can you send me the files or a link to the files you are scanning, or just the ones throwing exceptions.

I'll move this to a workitem so we can track it better.

Mike

Coordinator
Oct 8, 2009 at 11:33 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.