Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move usings outside namespace #3398

Merged
merged 3 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ csharp_style_unused_value_expression_statement_preference = discard_variable:sil

# 'using' directive preferences
# Keep this in sync with the related .NET rule: IDE0065
csharp_using_directive_placement = inside_namespace:warning
csharp_using_directive_placement = outside_namespace:warning

# IDE0190: Null check can be simplified
# Keep this in sync with the related .NET rule: IDE0190
Expand Down
4 changes: 2 additions & 2 deletions playground/MSTest1/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.VisualStudio.TestTools.UnitTesting;

#nullable disable

namespace MSTest1;

using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class UnitTest1
{
Expand Down
20 changes: 10 additions & 10 deletions playground/TestPlatform.Playground/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace TestPlatform.Playground;

using Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -19,6 +9,16 @@ namespace TestPlatform.Playground;
using System.Reflection;
using System.Threading;

using Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;

#nullable disable

namespace TestPlatform.Playground;

internal class Program
{
static void Main(string[] args)
Expand Down
8 changes: 4 additions & 4 deletions src/AttachVS/AttachVs.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.AttachVS;

using System;
using System.Diagnostics;
using System.Linq;
Expand All @@ -14,6 +10,10 @@ namespace Microsoft.TestPlatform.AttachVS;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;

#nullable disable

namespace Microsoft.TestPlatform.AttachVS;

internal class DebuggerUtility
{
internal static bool AttachVSToProcess(int? pid, int? vsPid)
Expand Down
8 changes: 4 additions & 4 deletions src/AttachVS/Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.AttachVS;

using System;
using System.Diagnostics;
using System.Linq;

#nullable disable

namespace Microsoft.TestPlatform.AttachVS;

internal class Program
{
static void Main(string[] args)
Expand Down
8 changes: 4 additions & 4 deletions src/DataCollectors/DumpMinitool/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace DumpMinitool;

using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -14,6 +10,10 @@ namespace DumpMinitool;

using Microsoft.Win32.SafeHandles;

#nullable disable

namespace DumpMinitool;

internal class Program
{
static int Main(string[] args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System.Collections.Generic;
using System.Xml;

using Microsoft.VisualStudio.TestPlatform.ObjectModel;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

/// <summary>
/// Utility class that collectors can use to read name/value configuration information from
/// the XML element sent to them
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System;

/// <summary>
/// Private Exception class used for event log exceptions
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -13,7 +9,11 @@ namespace Microsoft.TestPlatform.Extensions.EventLogCollector;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection;

using Resource = Resources.Resources;
using Resource = Microsoft.TestPlatform.Extensions.EventLogCollector.Resources.Resources;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

/// <summary>
/// The event log container.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -18,7 +14,11 @@ namespace Microsoft.TestPlatform.Extensions.EventLogCollector;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;

using Resource = Resources.Resources;
using Resource = Microsoft.TestPlatform.Extensions.EventLogCollector.Resources.Resources;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

/// <summary>
/// A data collector that collects event log data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System.Collections.Generic;

/// <summary>
/// Stores the start and end index for EventLogEntries corresponding to a data collection session.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System;
using System.Collections.Generic;
using System.Data;
Expand All @@ -15,6 +11,10 @@ namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

/// <summary>
/// This class writes event log entries to an XML file in a format that can be retrieved into a DataSet
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

using System;
using System.Collections.Generic;
using System.Diagnostics;

#nullable disable

namespace Microsoft.TestPlatform.Extensions.EventLogCollector;

/// <summary>
/// Event log container interface
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Reflection;

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.Helpers;

using System;
using System.Reflection;

internal static partial class ReflectionHelpers
{
#if NETSTANDARD1_0 || NETSTANDARD1_3 || WINDOWS_UWP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Reflection;

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.Helpers;

using System;
using System.Reflection;

internal static partial class ReflectionHelpers
{
internal static bool IsGenericType(Type type)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.Helpers;

using Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities;
using Microsoft.TestPlatform.AdapterUtilities.Resources;

using System;
using System.Globalization;
using System.Text;

using Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities;

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.Helpers;

internal static partial class ReflectionHelpers
{
private static void AssertSupport<T>(T obj, string methodName, string className)
where T : class
{
if (obj == null)
{
throw new NotImplementedException(string.Format(Resources.MethodNotImplementedOnPlatform, className, methodName));
throw new NotImplementedException(string.Format(Resources.Resources.MethodNotImplementedOnPlatform, className, methodName));
}
}

Expand Down Expand Up @@ -69,7 +68,7 @@ private static int ParseEscapedStringSegment(string escapedStringSegment, int po
catch
{
throw new InvalidManagedNameException(
string.Format(CultureInfo.CurrentCulture, Resources.ErrorInvalidSequenceAt, escapedStringSegment, i)
string.Format(CultureInfo.CurrentCulture, Resources.Resources.ErrorInvalidSequenceAt, escapedStringSegment, i)
);
}

Expand All @@ -92,7 +91,7 @@ private static int ParseEscapedStringSegment(string escapedStringSegment, int po
}
}

string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorNoClosingQuote, escapedStringSegment);
string message = string.Format(CultureInfo.CurrentCulture, Resources.Resources.ErrorNoClosingQuote, escapedStringSegment);
throw new InvalidManagedNameException(message);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities;

using System;

#if !NETSTANDARD1_0 && !WINDOWS_UWP
using System.Runtime.Serialization;
#endif

#nullable disable

namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities;

#if !NETSTANDARD1_0 && !WINDOWS_UWP
[Serializable]
#endif
Expand Down
Loading