Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into rmuller/submodule-c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
RomainMuller committed May 27, 2020
2 parents e87cfa6 + c964dfd commit 966a6de
Show file tree
Hide file tree
Showing 74 changed files with 2,247 additions and 2,230 deletions.
8 changes: 0 additions & 8 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,3 @@ update_configs:
default_labels:
- dependencies
- language/python

- directory: /packages/@jsii/ruby-runtime/project
package_manager: ruby:bundler
update_schedule: live
version_requirement_updates: increase_versions
default_labels:
- dependencies
- language/ruby
3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ in your development environment.
+ [`setuptools >= 38.6.0`](https://pypi.org/project/setuptools/)
+ [`wheel`](https://pypi.org/project/wheel/)
+ *Recommended:* [`twine`](https://pypi.org/project/twine/)
- [Ruby `2.4.4p296`] or later
+ [`bundler ~> 1.17.2`](https://bundler.io)

[Node `8.11.0`]: https://nodejs.org/download/release/v8.11.0/
[Yarn `1.19.1`]: https://yarnpkg.com/en/docs/install
[Oracle's OpenJDK8]: http://openjdk.java.net/install/
[Amazon Corretto 8]: https://aws.amazon.com/corretto/
[.NET Core `2.0`]: https://www.microsoft.com/net/download
[Python `3.6.5`]: https://www.python.org/downloads/release/python-365/
[Ruby `2.4.4p296`]: https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-5-1-released/

## Getting Started
### Bootstrapping
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"test:update": "lerna run test:update --stream"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"eslint": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^7.1.0",
"eslint-import-resolver-node": "^0.3.3",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"lerna": "^3.21.0",
"lerna": "^3.22.0",
"standard-version": "^8.0.0"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<Project>
<ItemGroup>
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.5.0" />
<!-- Central configuration of dependency versions for all DotNet packages -->

<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.6.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="3.1.3" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="3.1.4" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="3.1.4" />

<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Update="NSubstitute" Version="4.2.1" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
<PackageReference Update="XunitXml.TestLogger" Version="2.1.26" />

<PackageReference Update="Newtonsoft.Json" Version="12.0.3" />

<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion packages/@jsii/dotnet-runtime-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@jsii/dotnet-runtime": "^0.0.0",
"@types/node": "^10.17.21",
"@types/node": "^10.17.24",
"jsii-calc": "^0.0.0",
"jsii-pacmak": "^0.0.0",
"typescript": "~3.8.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>
<VSTestLogger>xunit</VSTestLogger>
</PropertyGroup>
Expand All @@ -19,13 +19,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="XunitXml.TestLogger" />
<DotNetCliToolReference Include="dotnet-xunit"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="XunitXml.TestLogger" />
<DotNetCliToolReference Include="dotnet-xunit" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion packages/@jsii/dotnet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@jsii/runtime": "^0.0.0",
"@types/node": "^10.17.21",
"@types/node": "^10.17.24",
"@types/semver": "^7.2.0",
"jsii-build-tools": "^0.0.0",
"semver": "^7.3.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Microsoft.CodeAnalysis;
using System;

namespace TestHelper
namespace Amazon.JSII.Analyzers.UnitTests.Helpers
{
/// <summary>
/// Location where the diagnostic appears, as determined by path, line number, and column number.
/// </summary>
public struct DiagnosticResultLocation
public readonly struct DiagnosticResultLocation
{
public DiagnosticResultLocation(string path, int line, int column)
{
Expand All @@ -20,9 +20,9 @@ public DiagnosticResultLocation(string path, int line, int column)
throw new ArgumentOutOfRangeException(nameof(column), "column must be >= -1");
}

this.Path = path;
this.Line = line;
this.Column = column;
Path = path;
Line = line;
Column = column;
}

public string Path { get; }
Expand All @@ -35,23 +35,17 @@ public DiagnosticResultLocation(string path, int line, int column)
/// </summary>
public struct DiagnosticResult
{
private DiagnosticResultLocation[] locations;
private DiagnosticResultLocation[] _locations;

public DiagnosticResultLocation[] Locations
{
get
{
if (this.locations == null)
{
this.locations = new DiagnosticResultLocation[] { };
}
return this.locations;
_locations ??= new DiagnosticResultLocation[] { };
return _locations;
}

set
{
this.locations = value;
}
set => _locations = value;
}

public DiagnosticSeverity Severity { get; set; }
Expand All @@ -60,28 +54,10 @@ public DiagnosticResultLocation[] Locations

public string Message { get; set; }

public string Path
{
get
{
return this.Locations.Length > 0 ? this.Locations[0].Path : "";
}
}
public string Path => Locations.Length > 0 ? Locations[0].Path : "";

public int Line
{
get
{
return this.Locations.Length > 0 ? this.Locations[0].Line : -1;
}
}
public int Line => Locations.Length > 0 ? Locations[0].Line : -1;

public int Column
{
get
{
return this.Locations.Length > 0 ? this.Locations[0].Column : -1;
}
}
public int Column => Locations.Length > 0 ? Locations[0].Column : -1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Xunit;
using TestHelper;
using Amazon.JSII.Analyzers.UnitTests.Helpers;
using Amazon.JSII.Analyzers.UnitTests.Verifiers;

namespace Amazon.JSII.Analyzers.UnitTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Collections.Immutable;
using System.Linq;

namespace TestHelper
namespace Amazon.JSII.Analyzers.UnitTests.Verifiers
{
/// <summary>
/// Class for turning strings into documents and getting the diagnostics on them
Expand All @@ -20,10 +20,10 @@ public abstract partial class DiagnosticVerifier
private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location);
private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location);

internal static string DefaultFilePathPrefix = "Test";
internal static string CSharpDefaultFileExt = "cs";
internal static string VisualBasicDefaultExt = "vb";
internal static string TestProjectName = "TestProject";
private const string DefaultFilePathPrefix = "Test";
private const string CSharpDefaultFileExt = "cs";
private const string VisualBasicDefaultExt = "vb";
private const string TestProjectName = "TestProject";

#region Get Diagnostics

Expand All @@ -34,7 +34,7 @@ public abstract partial class DiagnosticVerifier
/// <param name="language">The language the source classes are in</param>
/// <param name="analyzer">The analyzer to be run on the sources</param>
/// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns>
private static Diagnostic[] GetSortedDiagnostics(string[] sources, string language, DiagnosticAnalyzer? analyzer)
private static Diagnostic[] GetSortedDiagnostics(string[] sources, string language, DiagnosticAnalyzer analyzer)
{
return GetSortedDiagnosticsFromDocuments(analyzer, GetDocuments(sources, language));
}
Expand All @@ -46,7 +46,7 @@ private static Diagnostic[] GetSortedDiagnostics(string[] sources, string langua
/// <param name="analyzer">The analyzer to run on the documents</param>
/// <param name="documents">The Documents that the analyzer will be run on</param>
/// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns>
protected static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyzer? analyzer, Document[] documents)
private static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyzer analyzer, Document[] documents)
{
var projects = new HashSet<Project>();
foreach (var document in documents)
Expand All @@ -57,19 +57,18 @@ protected static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyz
var diagnostics = new List<Diagnostic>();
foreach (var project in projects)
{
var compilationWithAnalyzers = project.GetCompilationAsync().Result.WithAnalyzers(ImmutableArray.Create(analyzer));
var diags = compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync().Result;
foreach (var diag in diags)
var compilationWithAnalyzers = project.GetCompilationAsync().Result?.WithAnalyzers(ImmutableArray.Create(analyzer));
var diags = compilationWithAnalyzers?.GetAnalyzerDiagnosticsAsync().Result;
foreach (var diag in diags ?? ImmutableArray<Diagnostic>.Empty)
{
if (diag.Location == Location.None || diag.Location.IsInMetadata)
{
diagnostics.Add(diag);
}
else
{
for (int i = 0; i < documents.Length; i++)
foreach (var document in documents)
{
var document = documents[i];
var tree = document.GetSyntaxTreeAsync().Result;
if (tree == diag.Location.SourceTree)
{
Expand Down Expand Up @@ -122,17 +121,6 @@ private static Document[] GetDocuments(string[] sources, string language)
return documents;
}

/// <summary>
/// Create a Document from a string through creating a project that contains it.
/// </summary>
/// <param name="source">Classes in the form of a string</param>
/// <param name="language">The language the source code is in</param>
/// <returns>A Document created from the source string</returns>
protected static Document CreateDocument(string source, string language = LanguageNames.CSharp)
{
return CreateProject(new[] { source }, language).Documents.First();
}

/// <summary>
/// Create a project using the inputted strings as sources.
/// </summary>
Expand Down
Loading

0 comments on commit 966a6de

Please sign in to comment.