Hi,
Encountered an issue where a file formatted like this
using System.Net;
using
SomeProject.Bar;
using Microsoft.Extensions.Logging;
namespace SomeProject.Foo
{
public class Foo
{
}
}
will require 2 attempts at formatting to get the expected result. So if you did format and then check, the check would fail and not ignore the failure like it normally would.
The issue seems to be this part
After 1st formatting the output is this:
using System.Net;
using SomeProject.Bar;
using Microsoft.Extensions.Logging;
namespace SomeProject.Foo
{
public class Foo { }
}
and an error will be thrown
$ csharpier format .
Error .\Foo.cs - Failed formatting validation./n----------------------------- Original: Around Line 3 -----------------------------
using
SomeProject.Bar;
using Microsoft.Extensions.Logging;
namespace SomeProject.Foo
{
public class Foo
{
----------------------------- Formatted: Around Line 1 -----------------------------
using System.Net;
using SomeProject.Bar;
using Microsoft.Extensions.Logging;
namespace SomeProject.Foo
{
public class Foo { }
}
After second formatting the output will be what check would expect. The ordering of imports changed.
using System.Net;
using Microsoft.Extensions.Logging;
using SomeProject.Bar;
namespace SomeProject.Foo
{
public class Foo { }
}
Originally the import was split on multiple lines by some other tool I assume, because the imported namespace was very long.
Hi,
Encountered an issue where a file formatted like this
will require 2 attempts at formatting to get the expected result. So if you did
formatand thencheck, thecheckwould fail and not ignore the failure like it normally would.The issue seems to be this part
After 1st formatting the output is this:
and an error will be thrown
After second formatting the output will be what
checkwould expect. The ordering of imports changed.Originally the import was split on multiple lines by some other tool I assume, because the imported namespace was very long.