From 1eb70b51d7464aa236923b209aeb9d5de6a84eac Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 30 May 2017 12:10:02 +0200 Subject: [PATCH] #374 Remove SonarAnalyzer.Scanner --- sonaranalyzer-dotnet/SonarAnalyzer.sln | 14 - sonaranalyzer-dotnet/build/ChangeVersion.proj | 8 +- ...narAnalyzer.RuleDescriptorGenerator.csproj | 4 - .../CompilationHelper.cs | 64 ----- .../SonarAnalyzer.Scanner/Configuration.cs | 147 ---------- .../DiagnosticsRunner.cs | 84 ------ .../src/SonarAnalyzer.Scanner/Program.cs | 162 ----------- .../Properties/AssemblyInfo.cs | 28 -- .../src/SonarAnalyzer.Scanner/Scanner.nuspec | 25 -- .../ScannerAnalyzerConfiguration.cs | 30 --- .../SonarAnalyzer.Scanner.csproj | 160 ----------- .../TokenCollector/TokenCollector.cs | 96 ------- .../src/SonarAnalyzer.Scanner/app.config | 34 --- .../src/SonarAnalyzer.Scanner/packages.config | 16 -- .../ConfigurationTest.cs | 73 ----- .../DiagnosticRunnerTest.cs | 69 ----- .../EndToEnd_CSharp.cs | 253 ------------------ .../EndToEnd_NoIssue.cs | 58 ---- .../EndToEnd_VisualBasic.cs | 91 ------- .../Properties/AssemblyInfo.cs | 25 -- ...lyzer.Platform.Integration.UnitTest.csproj | 224 ---------------- .../ConfigurationTest.Empty.Cs.xml | 18 -- .../ConfigurationTest.Empty.VbNet.xml | 14 - .../TestResources/ProjectOutFolderPath.txt | 1 - .../TestResources/SonarLint.Cs.xml | 95 ------- .../TestResources/SonarLint.Vb.xml | 32 --- .../TestResources/TestInput.cs | 34 --- .../TestResources/TestInput.vb | 18 -- .../app.config | 34 --- .../packages.config | 15 -- 30 files changed, 1 insertion(+), 1925 deletions(-) delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/CompilationHelper.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Configuration.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/DiagnosticsRunner.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Program.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Properties/AssemblyInfo.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Scanner.nuspec delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/ScannerAnalyzerConfiguration.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/SonarAnalyzer.Scanner.csproj delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/TokenCollector/TokenCollector.cs delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/app.config delete mode 100644 sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/packages.config delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/ConfigurationTest.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/DiagnosticRunnerTest.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_CSharp.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_NoIssue.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_VisualBasic.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/Properties/AssemblyInfo.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/SonarAnalyzer.Platform.Integration.UnitTest.csproj delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.Cs.xml delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.VbNet.xml delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ProjectOutFolderPath.txt delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Cs.xml delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Vb.xml delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.cs delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.vb delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/app.config delete mode 100644 sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/packages.config diff --git a/sonaranalyzer-dotnet/SonarAnalyzer.sln b/sonaranalyzer-dotnet/SonarAnalyzer.sln index e91f7d975dc..a4e6efaa0ce 100644 --- a/sonaranalyzer-dotnet/SonarAnalyzer.sln +++ b/sonaranalyzer-dotnet/SonarAnalyzer.sln @@ -22,14 +22,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B7233F78 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SonarAnalyzer.UnitTest", "src\Tests\SonarAnalyzer.UnitTest\SonarAnalyzer.UnitTest.csproj", "{4AC7D054-B645-46D7-9671-D666BCE0C745}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SonarAnalyzer.Platform.Integration.UnitTest", "src\Tests\SonarAnalyzer.Platform.Integration.UnitTest\SonarAnalyzer.Platform.Integration.UnitTest.csproj", "{980FF643-2605-46F3-8C63-2F76290F84A8}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SonarQube Integration", "SonarQube Integration", "{F51A8C2A-A0F5-4282-956F-549D05860396}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SonarAnalyzer.RuleDescriptorGenerator", "src\SonarAnalyzer.RuleDescriptorGenerator\SonarAnalyzer.RuleDescriptorGenerator.csproj", "{E4D5FF22-C1A4-4CAD-B068-E47817F25848}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SonarAnalyzer.Scanner", "src\SonarAnalyzer.Scanner\SonarAnalyzer.Scanner.csproj", "{79F0B359-8275-4F3B-B919-82C493B74665}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SonarAnalyzer.RuleDocGenerator.Web", "src\SonarAnalyzer.RuleDocGenerator.Web\SonarAnalyzer.RuleDocGenerator.Web.csproj", "{98EF48F7-28D7-44CA-8C7F-6042EA4898E1}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CCEE2C5C-96D9-4427-B980-71DC0A49E23F}" @@ -60,18 +56,10 @@ Global {4AC7D054-B645-46D7-9671-D666BCE0C745}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AC7D054-B645-46D7-9671-D666BCE0C745}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AC7D054-B645-46D7-9671-D666BCE0C745}.Release|Any CPU.Build.0 = Release|Any CPU - {980FF643-2605-46F3-8C63-2F76290F84A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {980FF643-2605-46F3-8C63-2F76290F84A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {980FF643-2605-46F3-8C63-2F76290F84A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {980FF643-2605-46F3-8C63-2F76290F84A8}.Release|Any CPU.Build.0 = Release|Any CPU {E4D5FF22-C1A4-4CAD-B068-E47817F25848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E4D5FF22-C1A4-4CAD-B068-E47817F25848}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4D5FF22-C1A4-4CAD-B068-E47817F25848}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4D5FF22-C1A4-4CAD-B068-E47817F25848}.Release|Any CPU.Build.0 = Release|Any CPU - {79F0B359-8275-4F3B-B919-82C493B74665}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {79F0B359-8275-4F3B-B919-82C493B74665}.Debug|Any CPU.Build.0 = Debug|Any CPU - {79F0B359-8275-4F3B-B919-82C493B74665}.Release|Any CPU.ActiveCfg = Release|Any CPU - {79F0B359-8275-4F3B-B919-82C493B74665}.Release|Any CPU.Build.0 = Release|Any CPU {98EF48F7-28D7-44CA-8C7F-6042EA4898E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {98EF48F7-28D7-44CA-8C7F-6042EA4898E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {98EF48F7-28D7-44CA-8C7F-6042EA4898E1}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -90,9 +78,7 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {4AC7D054-B645-46D7-9671-D666BCE0C745} = {B7233F78-E142-4882-B084-7C83BE472109} - {980FF643-2605-46F3-8C63-2F76290F84A8} = {CCEE2C5C-96D9-4427-B980-71DC0A49E23F} {E4D5FF22-C1A4-4CAD-B068-E47817F25848} = {F51A8C2A-A0F5-4282-956F-549D05860396} - {79F0B359-8275-4F3B-B919-82C493B74665} = {F51A8C2A-A0F5-4282-956F-549D05860396} {CCEE2C5C-96D9-4427-B980-71DC0A49E23F} = {F51A8C2A-A0F5-4282-956F-549D05860396} EndGlobalSection EndGlobal diff --git a/sonaranalyzer-dotnet/build/ChangeVersion.proj b/sonaranalyzer-dotnet/build/ChangeVersion.proj index d75ed5cff8d..0ab09c15c08 100644 --- a/sonaranalyzer-dotnet/build/ChangeVersion.proj +++ b/sonaranalyzer-dotnet/build/ChangeVersion.proj @@ -55,17 +55,12 @@ 1 - - (?<=<version>)([^<]*) - $(NugetVersion) - 1 - (?<=<version>)([^<]*) $(NugetVersion) 1 - + (?<=<version>)([^<]*) $(NugetVersion) 1 @@ -80,7 +75,6 @@ - diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.RuleDescriptorGenerator/SonarAnalyzer.RuleDescriptorGenerator.csproj b/sonaranalyzer-dotnet/src/SonarAnalyzer.RuleDescriptorGenerator/SonarAnalyzer.RuleDescriptorGenerator.csproj index c197e7e570f..4f58bb5c833 100644 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.RuleDescriptorGenerator/SonarAnalyzer.RuleDescriptorGenerator.csproj +++ b/sonaranalyzer-dotnet/src/SonarAnalyzer.RuleDescriptorGenerator/SonarAnalyzer.RuleDescriptorGenerator.csproj @@ -105,10 +105,6 @@ {d1ae804f-ae78-4883-b3d6-9e3c4026def6} SonarAnalyzer.Common - - {79f0b359-8275-4f3b-b919-82c493b74665} - SonarAnalyzer.Scanner - diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/CompilationHelper.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/CompilationHelper.cs deleted file mode 100644 index 4b2f407d490..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/CompilationHelper.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.IO; -using System.Text; -using Microsoft.CodeAnalysis; -using SonarAnalyzer.Common; -using Microsoft.CodeAnalysis.Text; - -namespace SonarAnalyzer.Runner -{ - public static class CompilationHelper - { - private static readonly MetadataReference SystemMetadataReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location); - - public static Solution GetSolutionFromFiles(string filePath, Encoding encoding, AnalyzerLanguage language) - { - using (var workspace = new AdhocWorkspace()) - { - var file = new FileInfo(filePath); - var lang = language == AnalyzerLanguage.CSharp ? LanguageNames.CSharp : LanguageNames.VisualBasic; - var project = workspace.CurrentSolution.AddProject("foo", "foo.dll", lang) - .AddMetadataReference(SystemMetadataReference); - - using (var fileStream = File.Open(file.FullName, FileMode.Open, FileAccess.Read)) - { - var document = project.AddDocument(file.Name, SourceText.From(fileStream, encoding)); - project = document.Project; - return project.Solution; - } - } - } - - public static Solution GetSolutionWithEmptyFile(AnalyzerLanguage language) - { - using (var workspace = new AdhocWorkspace()) - { - var lang = language == AnalyzerLanguage.CSharp ? LanguageNames.CSharp : LanguageNames.VisualBasic; - return workspace.CurrentSolution.AddProject("foo", "foo.dll", lang) - .AddMetadataReference(SystemMetadataReference) - .AddDocument($"foo.{language.GetFileExtension()}", string.Empty) - .Project - .Solution; - } - } - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Configuration.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Configuration.cs deleted file mode 100644 index 5278d4517db..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Configuration.cs +++ /dev/null @@ -1,147 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Xml.Linq; -using Microsoft.CodeAnalysis.Diagnostics; -using SonarAnalyzer.Common; -using SonarAnalyzer.Helpers; -using SonarAnalyzer.Utilities; -using System.Text; - -namespace SonarAnalyzer.Runner -{ - public class Configuration - { - private readonly ImmutableArray analyzers; - private readonly AnalyzerLanguage language; - - public string SonarLintAdditionalPath { get; private set; } - public string ProtoFolderAdditionalPath { get; private set; } - public Encoding Encoding { get; private set; } - - public bool IgnoreHeaderComments { get; } - public IImmutableList Files { get; } - public IImmutableSet AnalyzerIds { get; } - - public Configuration(string sonarLintFilePath, string protoFolderFilePath, AnalyzerLanguage language) - { - if (!ParameterLoader.ConfigurationFilePathMatchesExpected(sonarLintFilePath)) - { - throw new ArgumentException( - $"Input configuration doesn't match expected file name: '{ParameterLoader.ParameterConfigurationFileName}'", - nameof(sonarLintFilePath)); - } - - this.language = language; - ProtoFolderAdditionalPath = protoFolderFilePath; - - SonarLintAdditionalPath = sonarLintFilePath; - analyzers = ImmutableArray.Create(GetAnalyzers(language).ToArray()); - - var xml = XDocument.Load(sonarLintFilePath); - var settings = ParseSettings(xml); - IgnoreHeaderComments = "true".Equals(settings[$"sonar.{language}.ignoreHeaderComments"], StringComparison.OrdinalIgnoreCase); - - Files = xml.Descendants("File").Select(e => e.Value).ToImmutableList(); - - AnalyzerIds = xml.Descendants("Rule").Select(e => e.Elements("Key").Single().Value).ToImmutableHashSet(); - - if (settings.ContainsKey("sonar.sourceEncoding")) - { - try - { - var encodingName = settings["sonar.sourceEncoding"]; - Encoding = Encoding.GetEncoding(encodingName); - } - catch (ArgumentException) - { - Program.Write($"Could not get encoding '{settings["sonar.sourceEncoding"]}'"); - } - } - } - - private static ImmutableDictionary ParseSettings(XContainer xml) - { - return xml - .Descendants("Setting") - .Select(e => - { - var keyElement = e.Element("Key"); - var valueElement = e.Element("Value"); - if (valueElement != null && keyElement != null) - { - return new - { - Key = keyElement.Value, - Value = valueElement.Value - }; - } - return null; - }) - .Where(e => e != null) - .ToImmutableDictionary(e => e.Key, e => e.Value); - } - - public ImmutableArray GetAnalyzers() - { - var builder = ImmutableArray.CreateBuilder(); - - foreach (var analyzer in analyzers - .Where(analyzer => analyzer.SupportedDiagnostics.Any(diagnostic => AnalyzerIds.Contains(diagnostic.Id)))) - { - builder.Add(analyzer); - } - - return builder.ToImmutable(); - } - - public ImmutableArray GetUtilityAnalyzers() - { - var builder = ImmutableArray.CreateBuilder(); - - var utilityAnalyzerTypes = RuleFinder.GetUtilityAnalyzerTypes(language) - .Where(t => !t.IsAbstract) - .ToList(); - - foreach (var analyzer in utilityAnalyzerTypes - .Select(type => (DiagnosticAnalyzer)Activator.CreateInstance(type))) - { - builder.Add(analyzer); - } - - return builder.ToImmutable(); - } - - #region Discover analyzers - - public static IEnumerable GetAnalyzers(AnalyzerLanguage language) - { - return - new RuleFinder().GetAnalyzerTypes(language) - .Select(type => (DiagnosticAnalyzer) Activator.CreateInstance(type)); - } - - #endregion - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/DiagnosticsRunner.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/DiagnosticsRunner.cs deleted file mode 100644 index 9f0617ac2ac..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/DiagnosticsRunner.cs +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Threading; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Diagnostics; -using CS = Microsoft.CodeAnalysis.CSharp; -using VB = Microsoft.CodeAnalysis.VisualBasic; -using SonarAnalyzer.Common; - -namespace SonarAnalyzer.Runner -{ - public class DiagnosticsRunner - { - private readonly Configuration configuration; - - public DiagnosticsRunner(Configuration configuration) - { - this.configuration = configuration; - } - - public IEnumerable GetDiagnostics(Compilation compilation) - { - var diagnosticAnalyzers = configuration.GetAnalyzers(); - - if (diagnosticAnalyzers.IsDefaultOrEmpty) - { - return new Diagnostic[0]; - } - - var compilationOptions = compilation.Language == LanguageNames.CSharp - ? (CompilationOptions)new CS.CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) - : new VB.VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary); - compilationOptions = compilationOptions.WithSpecificDiagnosticOptions( - diagnosticAnalyzers.SelectMany(analyzer => analyzer.SupportedDiagnostics) - .Select(diagnostic => - new KeyValuePair(diagnostic.Id, ReportDiagnostic.Warn))); - - var modifiedCompilation = compilation.WithOptions(compilationOptions); - - using (var tokenSource = new CancellationTokenSource()) - { - var additionalFiles = new[] { - new AnalyzerAdditionalFile(configuration.SonarLintAdditionalPath), - new AnalyzerAdditionalFile(configuration.ProtoFolderAdditionalPath)} - .Where(a => a.Path != null) - .ToArray(); - - if (!string.IsNullOrEmpty(configuration.ProtoFolderAdditionalPath)) - { - var utilityAnalyzers = configuration.GetUtilityAnalyzers(); - diagnosticAnalyzers = diagnosticAnalyzers.Union(utilityAnalyzers).ToImmutableArray(); - } - - var compilationWithAnalyzer = modifiedCompilation.WithAnalyzers( - diagnosticAnalyzers, - new AnalyzerOptions(ImmutableArray.Create(additionalFiles)), - tokenSource.Token); - - return compilationWithAnalyzer.GetAnalyzerDiagnosticsAsync().Result; - } - } - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Program.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Program.cs deleted file mode 100644 index 788c4ef532a..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Program.cs +++ /dev/null @@ -1,162 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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; -using System.Linq; -using Microsoft.CodeAnalysis; -using SonarAnalyzer.Common; -using System.IO; -using Google.Protobuf; -using SonarAnalyzer.Protobuf; -using System.Diagnostics; - -namespace SonarAnalyzer.Runner -{ - public static class Program - { - internal const string IssuesFileName = "issues.pb"; - - public static int RunAnalysis(ScannerAnalyzerConfiguration conf) - { - var language = AnalyzerLanguage.Parse(conf.Language); - - Write($"SonarAnalyzer for {language.GetFriendlyName()} version {FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location).FileVersion}"); - - var configuration = new Configuration(conf.InputConfigurationPath, conf.WorkDirectoryConfigFilePath, language); - var diagnosticsRunner = new DiagnosticsRunner(configuration); - - var outputDirectory = conf.OutputFolderPath; - Directory.CreateDirectory(outputDirectory); - - var currentFileIndex = 0; - - using (var tokentypeStream = File.Create(Path.Combine(outputDirectory, Rules.TokenTypeAnalyzerBase.TokenTypeFileName))) - using (var symRefStream = File.Create(Path.Combine(outputDirectory, Rules.SymbolReferenceAnalyzerBase.SymbolReferenceFileName))) - using (var cpdStream = File.Create(Path.Combine(outputDirectory, Rules.CopyPasteTokenAnalyzerBase.CopyPasteTokenFileName))) - using (var metricsStream = File.Create(Path.Combine(outputDirectory, Rules.MetricsAnalyzerBase.MetricsFileName))) - using (var encodingStream = File.Create(Path.Combine(outputDirectory, Rules.FileEncodingAnalyzerBase.EncodingFileName))) - using (var issuesStream = File.Create(Path.Combine(outputDirectory, IssuesFileName))) - { - foreach (var file in configuration.Files) - { - #region Single file processing - - Write(currentFileIndex + "/" + configuration.Files.Count + " files analyzed, starting to analyze: " + file); - currentFileIndex++; - - try - { - var solution = CompilationHelper.GetSolutionFromFiles(file, configuration.Encoding, language); - - var compilation = solution.Projects.First().GetCompilationAsync().Result; - var syntaxTree = compilation.SyntaxTrees.First(); - - var tokenCollector = new TokenCollector(file, solution.GetDocument(syntaxTree)); - - tokenCollector.TokenTypeInfo.WriteDelimitedTo(tokentypeStream); - tokenCollector.SymbolReferenceInfo.WriteDelimitedTo(symRefStream); - tokenCollector.CopyPasteTokenInfo.WriteDelimitedTo(cpdStream); - - MetricsBase metrics; - Rules.FileEncodingAnalyzerBase encodingCalculator; - - if (language == AnalyzerLanguage.CSharp) - { - metrics = new Common.CSharp.Metrics(syntaxTree); - encodingCalculator = new Rules.CSharp.FileEncodingAnalyzer(); - } - else - { - metrics = new Common.VisualBasic.Metrics(syntaxTree); - encodingCalculator = new Rules.VisualBasic.FileEncodingAnalyzer(); - } - - var metricsInfo = Rules.MetricsAnalyzerBase.CalculateMetrics(metrics, file, configuration.IgnoreHeaderComments); - metricsInfo.WriteDelimitedTo(metricsStream); - - var encodingInfo = Rules.FileEncodingAnalyzerBase.CalculateEncoding(encodingCalculator, syntaxTree, file); - encodingInfo.WriteDelimitedTo(encodingStream); - - var issuesInFile = new FileIssues - { - FilePath = file - }; - - foreach (var diagnostic in diagnosticsRunner.GetDiagnostics(compilation)) - { - var issue = new FileIssues.Types.Issue - { - Id = diagnostic.Id, - Message = diagnostic.GetMessage() - }; - - if (diagnostic.Location != Location.None) - { - issue.Location = Rules.UtilityAnalyzerBase.GetTextRange(diagnostic.Location.GetLineSpan()); - } - - issuesInFile.Issue.Add(issue); - } - - if (issuesInFile.Issue.Any()) - { - issuesInFile.WriteDelimitedTo(issuesStream); - } - } - catch (Exception e) - { - Console.Error.WriteLine("Failed to analyze the file: " + file); - Console.Error.WriteLine(e); - return 1; - } - - #endregion - } - } - - return 0; - } - - public static int Main(string[] args) - { - if (args.Length != 3) - { - Write("Expected parameters: "); - Write("[Input configuration path]"); - Write("[Output folder path]"); - Write("[AnalyzerLanguage: 'cs' for C#, 'vbnet' for VB.Net]"); - - return -1; - } - - return RunAnalysis(new ScannerAnalyzerConfiguration - { - InputConfigurationPath = args[0], - OutputFolderPath = args[1], - Language = args[2] - }); - } - - internal static void Write(string text) - { - Console.WriteLine(text); - } - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Properties/AssemblyInfo.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Properties/AssemblyInfo.cs deleted file mode 100644 index 27de2f652c5..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("SonarAnalyzer Scanner")] -[assembly: AssemblyProduct("SonarAnalyzer.Scanner")] -[assembly: AssemblyDescription("")] - -[assembly: InternalsVisibleTo("SonarAnalyzer.Platform.Integration.UnitTest" + Signing.InternalsVisibleToPublicKey)] diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Scanner.nuspec b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Scanner.nuspec deleted file mode 100644 index a1211383154..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/Scanner.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - SonarAnalyzer.Scanner - 5.11.0 - SonarAnalyzer Scanner - SonarSource - SonarSource - false - SonarAnalyzer Scanner - command line application to run rules and calculate metrics - - Copyright © 2015-2017 SonarSource SA - - - - - - - - - - - - - \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/ScannerAnalyzerConfiguration.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/ScannerAnalyzerConfiguration.cs deleted file mode 100644 index f96f9bb708d..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/ScannerAnalyzerConfiguration.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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. - */ - -namespace SonarAnalyzer.Runner -{ - public class ScannerAnalyzerConfiguration - { - public string InputConfigurationPath { get; set; } - public string OutputFolderPath { get; set; } - public string Language { get; set; } - public string WorkDirectoryConfigFilePath { get; set; } - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/SonarAnalyzer.Scanner.csproj b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/SonarAnalyzer.Scanner.csproj deleted file mode 100644 index 8322a7a9f9f..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/SonarAnalyzer.Scanner.csproj +++ /dev/null @@ -1,160 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {79F0B359-8275-4F3B-B919-82C493B74665} - Exe - Properties - SonarAnalyzer.Scanner - SonarAnalyzer.Scanner - v4.5.2 - 512 - - ..\SonarAnalyzer.ruleset - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\packages\Google.Protobuf.3.1.0\lib\net45\Google.Protobuf.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.VisualBasic.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll - True - - - ..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll - True - - - - ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - ..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll - True - - - ..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll - True - - - ..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll - True - - - ..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll - True - - - ..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll - True - - - ..\..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll - True - - - - - - - Properties\AssemblyInfo.Shared.cs - - - - - - - - - - - - - Designer - - - - - - {4c1bb6ce-645f-400b-b491-af7bb40e5c01} - SonarAnalyzer.Utilities - - - {01df3cb0-2213-42f3-bb8e-0c3bc330de7a} - SonarAnalyzer.VisualBasic - - - {39ccd086-a7f8-42a0-b402-3c9bd9eb4825} - SonarAnalyzer.CSharp - - - {d1ae804f-ae78-4883-b3d6-9e3c4026def6} - SonarAnalyzer.Common - - - - - - - - - Properties\SonarLint.xml - - - - - - - - - - - - - \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/TokenCollector/TokenCollector.cs b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/TokenCollector/TokenCollector.cs deleted file mode 100644 index f6b432679ad..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/TokenCollector/TokenCollector.cs +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Linq; -using Microsoft.CodeAnalysis; -using System.Collections.Generic; -using Microsoft.CodeAnalysis.Classification; -using SonarAnalyzer.Protobuf; -using System.Collections.Immutable; -using SonarAnalyzer.Helpers; - -namespace SonarAnalyzer.Runner -{ - public class TokenCollector - { - - private readonly SyntaxTree tree; - private readonly SemanticModel semanticModel; - - private readonly string filePath; - - public TokenCollector(string filePath, Document document) - { - this.filePath = filePath; - this.tree = document.GetSyntaxTreeAsync().Result; - this.semanticModel = document.GetSemanticModelAsync().Result; - } - - public SymbolReferenceInfo SymbolReferenceInfo - { - get - { - var analyzer = tree.GetRoot().Language == LanguageNames.CSharp - ? (Rules.SymbolReferenceAnalyzerBase)new Rules.CSharp.SymbolReferenceAnalyzer() - : new Rules.VisualBasic.SymbolReferenceAnalyzer(); - - var message = Rules.SymbolReferenceAnalyzerBase.CalculateSymbolReferenceInfo(tree, semanticModel, - t => IsIdentifier(t), t => analyzer.GetBindableParent(t), s => analyzer.GetSetKeyword(s)); - message.FilePath = filePath; - return message; - } - } - - - public TokenTypeInfo TokenTypeInfo - { - get - { - var analyzer = tree.GetRoot().Language == LanguageNames.CSharp - ? (Rules.TokenTypeAnalyzerBase)new Rules.CSharp.TokenTypeAnalyzer() - : new Rules.VisualBasic.TokenTypeAnalyzer(); - - var message = analyzer.GetTokenTypeInfo(tree, semanticModel); - message.FilePath = filePath; - return message; - } - } - - public CopyPasteTokenInfo CopyPasteTokenInfo - { - get - { - var analyzer = tree.GetRoot().Language == LanguageNames.CSharp - ? (Rules.CopyPasteTokenAnalyzerBase)new Rules.CSharp.CopyPasteTokenAnalyzer() - : new Rules.VisualBasic.CopyPasteTokenAnalyzer(); - - var message = analyzer.CalculateTokenInfo(tree); - message.FilePath = filePath; - return message; - } - } - - private static bool IsIdentifier(SyntaxToken token) - { - return token.IsKind(Microsoft.CodeAnalysis.CSharp.SyntaxKind.IdentifierToken) || - token.IsKind(Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.IdentifierToken); - } - } -} diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/app.config b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/app.config deleted file mode 100644 index 8bacc546535..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/app.config +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/packages.config b/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/packages.config deleted file mode 100644 index e0b9d561f4e..00000000000 --- a/sonaranalyzer-dotnet/src/SonarAnalyzer.Scanner/packages.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/ConfigurationTest.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/ConfigurationTest.cs deleted file mode 100644 index 3e48ce735b1..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/ConfigurationTest.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Linq; -using FluentAssertions; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarAnalyzer.Runner; -using SonarAnalyzer.Helpers; -using System.IO; - -namespace SonarAnalyzer.Integration.UnitTest -{ - [TestClass] - public class ConfigurationTest - { - public TestContext TestContext { get; set; } - - [TestMethod] - public void Configuration() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy(Path.Combine(EndToEnd_CSharp.TestResourcesFolderName, "SonarLint.Cs.xml"), tempInputFilePath, true); - - var conf = new Configuration( - tempInputFilePath, - null, - Common.AnalyzerLanguage.CSharp); - - conf.IgnoreHeaderComments.Should().BeTrue(); - conf.Files.Should().BeEquivalentTo(EndToEnd_CSharp.TestInputPath +".cs"); - - string[] expectedAnalyzerIds = - { - "S1121", - "S2306", - "S1227", - - "S104", - "S1541", - "S103", - "S1479", - "S1067", - "S107", - "S101", - "S100", - "S1134", - "S1135" - }; - - conf.AnalyzerIds.Should().BeEquivalentTo(expectedAnalyzerIds); - - var analyzers = conf.GetAnalyzers(); - analyzers.Should().HaveSameCount(expectedAnalyzerIds); - } - } -} diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/DiagnosticRunnerTest.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/DiagnosticRunnerTest.cs deleted file mode 100644 index 19958760db5..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/DiagnosticRunnerTest.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Linq; -using FluentAssertions; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarAnalyzer.Runner; -using SonarAnalyzer.Helpers; -using System.IO; - -namespace SonarAnalyzer.Integration.UnitTest -{ - [TestClass] - public class DiagnosticRunnerTest - { - public TestContext TestContext { get; set; } - - [TestMethod] - public void DiagnosticRunnerTest_NoAnalyzer_CSharp() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy("TestResources\\ConfigurationTest.Empty.Cs.xml", tempInputFilePath, true); - - var runner = new DiagnosticsRunner(new Configuration(tempInputFilePath, null, Common.AnalyzerLanguage.CSharp)); - - var solution = CompilationHelper.GetSolutionWithEmptyFile(Common.AnalyzerLanguage.CSharp); - - var compilation = solution.Projects.First().GetCompilationAsync().Result; - - var diagnosticsResult = runner.GetDiagnostics(compilation); - - diagnosticsResult.Should().HaveCount(0); - } - - [TestMethod] - public void DiagnosticRunnerTest_NoAnalyzer_VbNet() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy("TestResources\\ConfigurationTest.Empty.VbNet.xml", tempInputFilePath, true); - - var runner = new DiagnosticsRunner(new Configuration(tempInputFilePath, null, Common.AnalyzerLanguage.VisualBasic)); - - var solution = CompilationHelper.GetSolutionWithEmptyFile(Common.AnalyzerLanguage.VisualBasic); - - var compilation = solution.Projects.First().GetCompilationAsync().Result; - - var diagnosticsResult = runner.GetDiagnostics(compilation); - - diagnosticsResult.Should().HaveCount(0); - } - } -} diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_CSharp.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_CSharp.cs deleted file mode 100644 index 01e7ac1c34c..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_CSharp.cs +++ /dev/null @@ -1,253 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarAnalyzer.Common; -using SonarAnalyzer.Helpers; -using SonarAnalyzer.Runner; -using System.IO; -using System.Linq; -using SonarAnalyzer.Protobuf; -using Google.Protobuf; -using System.Collections.Generic; -using System; -using FluentAssertions; - -namespace SonarAnalyzer.Integration.UnitTest -{ - [TestClass] - public class EndToEnd_CSharp - { - public TestContext TestContext { get; set; } - - internal const string OutputFolderName = "Output"; - internal const string TestResourcesFolderName = "TestResources"; - internal const string TestInputFileName = "TestInput"; - internal const string TestInputPath = TestResourcesFolderName + "\\" + TestInputFileName; - - private const string extension = ".cs"; - - [TestInitialize] - public void Initialize() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy(Path.Combine(TestResourcesFolderName, "SonarLint.Cs.xml"), tempInputFilePath, true); - - Program.RunAnalysis(new ScannerAnalyzerConfiguration - { - InputConfigurationPath = tempInputFilePath, - OutputFolderPath = OutputFolderName, - Language = AnalyzerLanguage.CSharp.ToString(), - WorkDirectoryConfigFilePath = Path.Combine(TestResourcesFolderName, "ProjectOutFolderPath.txt") - }); - } - - internal class ExpectedTokenInfo - { - public int Index { get; set; } - public string Text { get; set; } - public TokenType Kind { get; set; } - } - - internal class ExpectedReferenceInfo - { - public int Index { get; set; } - public int NumberOfReferences { get; set; } - - public string DeclarationText { get; set; } - public string ReferenceText { get; set; } - } - - [TestMethod] - public void Token_Types_Computed_CSharp() - { - var testFileContent = File.ReadAllLines(TestInputPath + extension); - CheckTokenInfoFile(testFileContent, extension, 31, new[] - { - new ExpectedTokenInfo { Index = 6, Kind = TokenType.Comment, Text = "// FIXME: fix this issue" }, - new ExpectedTokenInfo { Index = 5, Kind = TokenType.TypeName, Text = "TTTestClass" }, - new ExpectedTokenInfo { Index = 18, Kind = TokenType.TypeName, Text = "TTTestClass" }, - new ExpectedTokenInfo { Index = 12, Kind = TokenType.Keyword, Text = "var" }, - new ExpectedTokenInfo { Index = 30, Kind = TokenType.Keyword, Text = "value" } - }); - } - - [TestMethod] - public void Cpd_Tokens_Computed_CSharp() - { - CheckCpdTokens(@"public class TTTestClass { public object MyMethod ( ) { using ( y = null ) { } var x = $num ; " + - "if ( $num == $num ) { new TTTestClass ( ) ; return $str + x ; } return $char ; ; } " + - "private int myVar ; public int MyProperty { get { return myVar ; } set { myVar = value ; } } }"); - } - - [TestMethod] - public void Symbol_Reference_Computed_CSharp() - { - var testFileContent = File.ReadAllLines(TestInputPath + extension); - CheckTokenReferenceFile(testFileContent, extension, 6, new[] - { - new ExpectedReferenceInfo { Index = 0, NumberOfReferences = 1, DeclarationText = "TTTestClass", ReferenceText = "TTTestClass" }, - new ExpectedReferenceInfo { Index = 1, NumberOfReferences = 0, DeclarationText = "MyMethod" }, - new ExpectedReferenceInfo { Index = 2, NumberOfReferences = 1, DeclarationText = "x", ReferenceText = "x" }, - new ExpectedReferenceInfo { Index = 5, NumberOfReferences = 1, DeclarationText = "set", ReferenceText = "value" } - }); - } - - internal static void CheckCpdTokens(string tokenCpdExpected) - { - var cpdInfos = GetDeserializedData(Path.Combine(OutputFolderName, Rules.CopyPasteTokenAnalyzerBase.CopyPasteTokenFileName)); - - cpdInfos.Should().HaveCount(1); - var actual = string.Join(" ", cpdInfos[0].TokenInfo.Select(ti => ti.TokenValue)); - actual.Should().Be(tokenCpdExpected); - } - - internal static void CheckTokenReferenceFile(string[] testFileContent, string extension, - int totalReferenceCount, IEnumerable expectedReferences) - { - var refInfos = GetDeserializedData(Path.Combine(OutputFolderName, Rules.SymbolReferenceAnalyzerBase.SymbolReferenceFileName)); - - refInfos.Should().HaveCount(1); - var refInfo = refInfos.First(); - refInfo.FilePath.Should().Be(TestInputPath + extension); - refInfo.Reference.Should().HaveCount(totalReferenceCount); - - foreach (var expectedReference in expectedReferences) - { - var declarationPosition = refInfo.Reference[expectedReference.Index].Declaration; - declarationPosition.EndLine.Should().Be(declarationPosition.StartLine); - var tokenText = testFileContent[declarationPosition.StartLine - 1].Substring( - declarationPosition.StartOffset, - declarationPosition.EndOffset - declarationPosition.StartOffset); - - tokenText.Should().Be(expectedReference.DeclarationText); - - refInfo.Reference[expectedReference.Index].Reference.Should().HaveCount(expectedReference.NumberOfReferences); - foreach (var reference in refInfo.Reference[expectedReference.Index].Reference) - { - reference.EndLine.Should().Be(reference.StartLine); - var refText = testFileContent[reference.StartLine - 1].Substring( - reference.StartOffset, - reference.EndOffset - reference.StartOffset); - refText.Should().Be(expectedReference.ReferenceText); - } - } - } - - internal static void CheckTokenInfoFile(string[] testInputFileLines, string extension, int totalTokenCount, IEnumerable expectedTokens) - { - var tokenInfos = GetDeserializedData(Path.Combine(OutputFolderName, Rules.TokenTypeAnalyzerBase.TokenTypeFileName)); - - tokenInfos.Should().HaveCount(1); - var token = tokenInfos.First(); - token.FilePath.Should().Be(TestInputPath + extension); - token.TokenInfo.Should().HaveCount(totalTokenCount); - - foreach (var expectedToken in expectedTokens) - { - token.TokenInfo[expectedToken.Index].TokenType.Should().Be(expectedToken.Kind); - - var tokenPosition = token.TokenInfo[expectedToken.Index].TextRange; - tokenPosition.EndLine.Should().Be(tokenPosition.StartLine); - var tokenText = testInputFileLines[tokenPosition.StartLine - 1].Substring( - tokenPosition.StartOffset, - tokenPosition.EndOffset - tokenPosition.StartOffset); - tokenText.Should().Be(expectedToken.Text); - } - } - - [TestMethod] - public void Metrics_Are_Present() - { - var metrics = GetDeserializedData(Path.Combine(OutputFolderName, Rules.MetricsAnalyzerBase.MetricsFileName)); - - metrics.Should().HaveCount(1); - var m = metrics.First(); - m.FilePath.Should().Be($"{TestInputPath}{extension}"); - - m.ClassCount.Should().Be(1); - } - - [TestMethod] - public void Issues_Are_Present() - { - var fileIssues = GetDeserializedData(Path.Combine(OutputFolderName, Program.IssuesFileName)); - fileIssues.Should().HaveCount(1); - var issues = fileIssues.First().Issue; - - issues.Should().Contain(new FileIssues.Types.Issue - { - Id = "S1134", - Message = "Take the required action to fix the issue indicated by this 'FIXME' comment.", - Location = new TextRange { StartLine = 8, EndLine = 8, StartOffset = 7, EndOffset = 12 } - }); - - issues.Should().Contain(new FileIssues.Types.Issue - { - Id = "S101", - Message = "Rename class 'TTTestClass' to match camel case naming rules, consider using 'TtTestClass'.", - Location = new TextRange { StartLine = 6, EndLine = 6, StartOffset = 13, EndOffset = 24 } - }); - - issues.Should().Contain(new FileIssues.Types.Issue - { - Id = "S103", - Message = "Split this 26 characters long line (which is greater than 10 authorized).", - Location = new TextRange { StartLine = 20, EndLine = 20, StartOffset = 0, EndOffset = 26 } - }); - } - - [TestMethod] - public void No_UnExpected_Issues() - { - var fileIssues = GetDeserializedData(Path.Combine(OutputFolderName, Program.IssuesFileName)); - fileIssues.First().Issue.Any(i => i.Id == "S1116").Should().BeFalse(); - } - - [TestMethod] - public void Encoding_Reported() - { - var encodingInfos = GetDeserializedData(Path.Combine(OutputFolderName, Rules.FileEncodingAnalyzerBase.EncodingFileName)); - encodingInfos.Should().HaveCount(1); - var encodingInfo = encodingInfos.First(); - - encodingInfo.FilePath.Should().Be($"{TestInputPath}{extension}"); - encodingInfo.Encoding.Should().Be("utf-8"); - } - - internal static List GetDeserializedData(string filePath) - where TMessage : IMessage, new() - { - var messages = new List(); - - using (var input = File.OpenRead(filePath)) - { - while (input.Position != input.Length) - { - var message = new TMessage(); - message.MergeDelimitedFrom(input); - messages.Add(message); - } - } - - return messages; - } - } -} diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_NoIssue.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_NoIssue.cs deleted file mode 100644 index b2161a5c5fc..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_NoIssue.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarAnalyzer.Common; -using SonarAnalyzer.Helpers; -using SonarAnalyzer.Runner; -using System.IO; -using SonarAnalyzer.Protobuf; -using FluentAssertions; - -namespace SonarAnalyzer.Integration.UnitTest -{ - [TestClass] - public class EndToEnd_NoIssue - { - public TestContext TestContext { get; set; } - - internal const string OutputFolderName = "Output"; - internal const string TestResourcesFolderName = "TestResources"; - internal const string TestInputFileName = "TestInput"; - internal const string TestInputPath = TestResourcesFolderName + "\\" + TestInputFileName; - [TestMethod] - public void IssuesFileIsEmpty() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy(Path.Combine(TestResourcesFolderName, "ConfigurationTest.Empty.Cs.xml"), tempInputFilePath, true); - - Program.RunAnalysis(new ScannerAnalyzerConfiguration - { - InputConfigurationPath = tempInputFilePath, - OutputFolderPath = OutputFolderName, - Language = AnalyzerLanguage.CSharp.ToString(), - WorkDirectoryConfigFilePath = Path.Combine(TestResourcesFolderName, "ProjectOutFolderPath.txt") - }); - - var fileIssues = EndToEnd_CSharp.GetDeserializedData(Path.Combine(OutputFolderName, Program.IssuesFileName)); - fileIssues.Should().BeEmpty(); - } - } -} diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_VisualBasic.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_VisualBasic.cs deleted file mode 100644 index af4af3fce16..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/EndToEnd_VisualBasic.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarAnalyzer.Common; -using SonarAnalyzer.Helpers; -using SonarAnalyzer.Runner; -using System.IO; -using System.Linq; -using SonarAnalyzer.Protobuf; -using Google.Protobuf; -using System.Collections.Generic; -using System; -using FluentAssertions; - -namespace SonarAnalyzer.Integration.UnitTest -{ - [TestClass] - public class EndToEnd_VisualBasic - { - public TestContext TestContext { get; set; } - - private const string extension = ".vb"; - - [TestInitialize] - public void Initialize() - { - var tempInputFilePath = Path.Combine(TestContext.DeploymentDirectory, ParameterLoader.ParameterConfigurationFileName); - File.Copy(Path.Combine(EndToEnd_CSharp.TestResourcesFolderName, "SonarLint.Vb.xml"), tempInputFilePath, true); - - Program.RunAnalysis(new ScannerAnalyzerConfiguration - { - InputConfigurationPath = tempInputFilePath, - OutputFolderPath = EndToEnd_CSharp.OutputFolderName, - Language = AnalyzerLanguage.VisualBasic.ToString(), - WorkDirectoryConfigFilePath = Path.Combine(EndToEnd_CSharp.TestResourcesFolderName, "ProjectOutFolderPath.txt") - }); - } - - [TestMethod] - public void Token_Types_Computed_VisualBasic() - { - var testFileContent = File.ReadAllLines(EndToEnd_CSharp.TestInputPath + extension); - EndToEnd_CSharp.CheckTokenInfoFile(testFileContent, extension, 32, new[] - { - new EndToEnd_CSharp.ExpectedTokenInfo { Index = 7, Kind = TokenType.Comment, Text = "' FIXME: fix this issue" }, - new EndToEnd_CSharp.ExpectedTokenInfo { Index = 6, Kind = TokenType.TypeName, Text = "TTTestClass" }, - new EndToEnd_CSharp.ExpectedTokenInfo { Index = 17, Kind = TokenType.TypeName, Text = "TTTestClass" }, - new EndToEnd_CSharp.ExpectedTokenInfo { Index = 16, Kind = TokenType.Keyword, Text = "New" } - }); - } - - [TestMethod] - public void Cpd_Tokens_Computed_VisualBasic() - { - EndToEnd_CSharp.CheckCpdTokens( - @"Public Class TTTestClass Public Function MyMethod ( ) As Object Dim x = $num Dim y = New TTTestClass " + - "If $num = $num Then Return x + $str End If Return $char End Function End Class"); - } - - [TestMethod] - public void Symbol_Reference_Computed_VisualBasic() - { - var testFileContent = File.ReadAllLines(EndToEnd_CSharp.TestInputPath + extension); - EndToEnd_CSharp.CheckTokenReferenceFile(testFileContent, extension, 4, new[] - { - new EndToEnd_CSharp.ExpectedReferenceInfo { Index = 0, NumberOfReferences = 1, DeclarationText = "TTTestClass", ReferenceText = "TTTestClass" }, - new EndToEnd_CSharp.ExpectedReferenceInfo { Index = 1, NumberOfReferences = 0, DeclarationText = "MyMethod" }, - new EndToEnd_CSharp.ExpectedReferenceInfo { Index = 2, NumberOfReferences = 1, DeclarationText = "x", ReferenceText = "x" }, - new EndToEnd_CSharp.ExpectedReferenceInfo { Index = 3, NumberOfReferences = 0, DeclarationText = "y", ReferenceText = "y" } - }); - } - } -} diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/Properties/AssemblyInfo.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 281285281c8..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2017 SonarSource SA - * mailto: contact 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.Reflection; - -[assembly: AssemblyTitle("SonarAnalyzer.Platform.Integration.UnitTest")] -[assembly: AssemblyProduct("SonarAnalyzer.Platform.Integration.UnitTest")] -[assembly: AssemblyDescription("")] diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/SonarAnalyzer.Platform.Integration.UnitTest.csproj b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/SonarAnalyzer.Platform.Integration.UnitTest.csproj deleted file mode 100644 index 95dbc5d071a..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/SonarAnalyzer.Platform.Integration.UnitTest.csproj +++ /dev/null @@ -1,224 +0,0 @@ - - - - Debug - AnyCPU - {980FF643-2605-46F3-8C63-2F76290F84A8} - Library - Properties - SonarAnalyzer.Integration.UnitTest - SonarAnalyzer.Platform.Integration.UnitTest - v4.5.2 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - ..\..\SonarAnalyzer.Test.ruleset - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.dll - True - - - ..\..\..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.Core.dll - True - - - ..\..\..\packages\Google.Protobuf.3.1.0\lib\net45\Google.Protobuf.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.VisualBasic.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll - True - - - ..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll - True - - - - ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - ..\..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll - True - - - ..\..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll - True - - - ..\..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll - True - - - ..\..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll - True - - - ..\..\..\packages\Microsoft.Composition.1.0.30\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll - True - - - ..\..\..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll - True - - - - - - - - - - - - - - - - - - - Properties\AssemblyInfo.Shared.cs - - - Always - - - Properties\SonarLint.xml - - - Always - - - Always - - - Always - - - - - - - - - - - - Always - - - - - - {01df3cb0-2213-42f3-bb8e-0c3bc330de7a} - SonarAnalyzer.VisualBasic - - - {39ccd086-a7f8-42a0-b402-3c9bd9eb4825} - SonarAnalyzer.CSharp - - - {4c1bb6ce-645f-400b-b491-af7bb40e5c01} - SonarAnalyzer.Utilities - - - {d1ae804f-ae78-4883-b3d6-9e3c4026def6} - SonarAnalyzer.Common - - - {E4D5FF22-C1A4-4CAD-B068-E47817F25848} - SonarAnalyzer.RuleDescriptorGenerator - - - {79F0B359-8275-4F3B-B919-82C493B74665} - SonarAnalyzer.Scanner - - - - - - - - - Always - - - - - Always - - - - - - - False - - - False - - - False - - - False - - - - - - - - \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.Cs.xml b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.Cs.xml deleted file mode 100644 index 5c4aaccbb2e..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.Cs.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - sonar.cs.ignoreHeaderComments - true - - - sonar.sourceEncoding - UTF-8 - - - - - - TestResources\TestInput.cs - - diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.VbNet.xml b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.VbNet.xml deleted file mode 100644 index d697dd11119..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ConfigurationTest.Empty.VbNet.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - sonar.vbnet.ignoreHeaderComments - true - - - - - - TestResources\TestInput.vb - - diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ProjectOutFolderPath.txt b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ProjectOutFolderPath.txt deleted file mode 100644 index 0f9e27c4c2e..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/ProjectOutFolderPath.txt +++ /dev/null @@ -1 +0,0 @@ -protoBufOutFolder \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Cs.xml b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Cs.xml deleted file mode 100644 index 099c270e648..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Cs.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - sonar.cs.ignoreHeaderComments - true - - - - - S1121 - - - S2306 - - - S1227 - - - S1134 - - - S1135 - - - S104 - - - maximumFileLocThreshold - 10 - - - - - S1541 - - - maximumFunctionComplexityThreshold - 10 - - - - - S103 - - - maximumLineLength - 10 - - - - - S1479 - - - maximum - 30 - - - - - S1067 - - - max - 3 - - - - - S107 - - - max - 7 - - - - - S101 - - - S100 - - - format - ^[A-Z][a-zA-Z0-9]+$ - - - - - - TestResources\TestInput.cs - - diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Vb.xml b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Vb.xml deleted file mode 100644 index 00b454b2ded..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/SonarLint.Vb.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - sonar.vbnet.ignoreHeaderComments - true - - - - - S104 - - - maximumFileLocThreshold - 10 - - - - - S103 - - - maximumLineLength - 10 - - - - - - TestResources\TestInput.vb - - diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.cs b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.cs deleted file mode 100644 index 263e9c0677b..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using M = Math; -/// -/// -/// -public class TTTestClass -{ - // FIXME: fix this issue - - //TODO: I need to fix this - public object MyMethod() - { - using (y = null) - { } - - var x = 5; - if (1==1) - { - new TTTestClass(); - return "" + x; - } - - return 'c'; - ; - } - - private int myVar; - - public int MyProperty - { - get { return myVar; } - set { myVar = value; } - } -} \ No newline at end of file diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.vb b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.vb deleted file mode 100644 index d39afbf718b..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/TestResources/TestInput.vb +++ /dev/null @@ -1,18 +0,0 @@ -Imports System -Imports M = System.Math -''' -''' -''' -Public Class TTTestClass - ' FIXME: fix this issue - ' TODO: I need to fix this - Public Function MyMethod() As Object - Dim x = 5 - Dim y = New TTTestClass - If 1 = 1.0 Then - Return x + "" - End If - - Return "A"C - End Function -End Class diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/app.config b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/app.config deleted file mode 100644 index 8bacc546535..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/app.config +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/packages.config b/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/packages.config deleted file mode 100644 index 8f720bf9726..00000000000 --- a/sonaranalyzer-dotnet/src/Tests/SonarAnalyzer.Platform.Integration.UnitTest/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file