From b5411151d20987cc270895de45b7efb154eddffd Mon Sep 17 00:00:00 2001 From: Georgii Borovinskikh Date: Mon, 6 Jan 2025 13:30:20 +0100 Subject: [PATCH] cleanup --- ...sts.cs => SonarLintOutputLoggerFactory.cs} | 4 +-- .../EnableAllLoggerSettingsProvider.cs} | 7 ----- .../Logging/SystemDebugLoggerWriter.cs | 30 +++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) rename src/Integration.UnitTests/Helpers/{SonarLintOutputTests.cs => SonarLintOutputLoggerFactory.cs} (89%) rename src/Roslyn.Suppressions/Roslyn.Suppressions/{Logger.cs => Logging/EnableAllLoggerSettingsProvider.cs} (86%) create mode 100644 src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/SystemDebugLoggerWriter.cs diff --git a/src/Integration.UnitTests/Helpers/SonarLintOutputTests.cs b/src/Integration.UnitTests/Helpers/SonarLintOutputLoggerFactory.cs similarity index 89% rename from src/Integration.UnitTests/Helpers/SonarLintOutputTests.cs rename to src/Integration.UnitTests/Helpers/SonarLintOutputLoggerFactory.cs index e56a93f27..dd7c5e519 100644 --- a/src/Integration.UnitTests/Helpers/SonarLintOutputTests.cs +++ b/src/Integration.UnitTests/Helpers/SonarLintOutputLoggerFactory.cs @@ -24,7 +24,7 @@ namespace SonarLint.VisualStudio.Integration.UnitTests.Helpers { [TestClass] - public class SonarLintOutputTests + public class SonarLintOutputLoggerFactory { // the normal check for export does not work here because this is a special Property export instead of the normal Class export // [TestMethod] @@ -41,7 +41,7 @@ public void Ctor_CreatesLoggerWithExpectedParameters() { var loggerFactory = Substitute.For(); - var testSubject = new SonarLintOutputLoggerFactory(loggerFactory, Substitute.For(), Substitute.For()); + var testSubject = new Integration.Helpers.SonarLintOutputLoggerFactory(loggerFactory, Substitute.For(), Substitute.For()); testSubject.Instance.Should().NotBeNull(); loggerFactory.Create(Arg.Any(), Arg.Any()); diff --git a/src/Roslyn.Suppressions/Roslyn.Suppressions/Logger.cs b/src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/EnableAllLoggerSettingsProvider.cs similarity index 86% rename from src/Roslyn.Suppressions/Roslyn.Suppressions/Logger.cs rename to src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/EnableAllLoggerSettingsProvider.cs index 6acdd910f..718cf1f92 100644 --- a/src/Roslyn.Suppressions/Roslyn.Suppressions/Logger.cs +++ b/src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/EnableAllLoggerSettingsProvider.cs @@ -19,17 +19,10 @@ */ using System.Diagnostics.CodeAnalysis; -using SonarLint.VisualStudio.Core; using SonarLint.VisualStudio.Core.Logging; namespace SonarLint.VisualStudio.Roslyn.Suppressions; -[ExcludeFromCodeCoverage] -internal class SystemDebugLoggerWriter : ILoggerWriter -{ - public void WriteLine(string message) => Debug.WriteLine(message); -} - [ExcludeFromCodeCoverage] internal class EnableAllLoggerSettingsProvider : ILoggerSettingsProvider { diff --git a/src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/SystemDebugLoggerWriter.cs b/src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/SystemDebugLoggerWriter.cs new file mode 100644 index 000000000..cd74c901e --- /dev/null +++ b/src/Roslyn.Suppressions/Roslyn.Suppressions/Logging/SystemDebugLoggerWriter.cs @@ -0,0 +1,30 @@ +/* + * SonarLint for Visual Studio + * Copyright (C) 2016-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +using System.Diagnostics.CodeAnalysis; +using SonarLint.VisualStudio.Core.Logging; + +namespace SonarLint.VisualStudio.Roslyn.Suppressions; + +[ExcludeFromCodeCoverage] +internal class SystemDebugLoggerWriter : ILoggerWriter +{ + public void WriteLine(string message) => Debug.WriteLine(message); +}