1

Closed

Plugin fighting itself and violating StyleCop rule SA1507

description

Hi.
 
The StyleCop friendly "Code Cleanup" settings are from 2008 and mere screenshots, without any explanation.
Using my current settings, "Code Cleanup" leads to files starting like this:
 
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigurationFactory.cs" company="MyCorp">
// Copyright (c) MyCorp.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
 
 
using ....;
 
Note, that two empty lines are between the using statement and the header. Those are autogenerated every time and clash with StyleCop rule SA1507. I'd like to stick to that rule and keep it, but I need to be able to issue a "Cleanup Code".
 
Playing with the settings for the header (leave it, only add it if it is missing, replace everytime) doesn't help, the result is the same: The file ends up with two blank lines and StyleCop complains.
Closed Apr 15, 2011 at 9:13 AM by andyr
If still an issue please open a new bug at http://stylecop.codeplex.com/workitem/list/basic

comments

darklajid wrote Jul 6, 2010 at 9:04 PM

Additional information: It seems to work fine in files with namespaces (and only if you allow those to be moved). Not if the header is above the using statements.

So

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigurationFactory.cs" company="MyCorp">
// Copyright (c) MyCorp.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Foo
{

works (even if it wasn't ordered correctly before) and even repeated clean up doesn't break it.

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigurationFactory.cs" company="MyCorp">
// Copyright (c) MyCorp.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


using System.Reflection;

[assembly: AssemblyVersion("1.8.2.0")]
[assembly: AssemblyFileVersion("1.8.2.0")]

doesn't work. The two blank lines are auto-inserted and recreated on every clean-up.