Skip to content
Closed
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
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
configuration: [ 'Debug', 'Release' ]
os: [ 'windows-latest' ]
test: [ 'Test', 'Test.CSharp7', 'Test.CSharp8', 'Test.CSharp9', 'Test.CSharp10', 'Test.CSharp11', 'Test.CSharp12', 'Test.CSharp13', 'Test.CSharp14' ]
testversion: [ '6', '7', '8', '9', '10', '11', '12', '13', '14' ]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand All @@ -31,4 +31,4 @@ jobs:
uses: actions/setup-dotnet@v5

- name: Build & Test
run: dotnet test StyleCop.Analyzers/StyleCop.Analyzers.${{matrix.test}}/StyleCop.Analyzers.${{matrix.test}}.csproj -c ${{matrix.configuration}} --verbosity normal
run: dotnet test StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp${{matrix.testversion}}/StyleCop.Analyzers.Test.CSharp${{matrix.testversion}}.csproj -c ${{matrix.configuration}} --verbosity normal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp6")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp7")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp8")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp9")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,16 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
var testData = context.CompilationProvider.Select((compilation, cancellationToken) =>
{
var currentAssemblyName = compilation.AssemblyName ?? string.Empty;
if (!Regex.IsMatch(currentAssemblyName, @"^StyleCop\.Analyzers\.Test\.CSharp\d+$"))
if (!Regex.IsMatch(currentAssemblyName, @"^StyleCop\.Analyzers\.Test\.CSharp\d+$") || currentAssemblyName.EndsWith("CSharp6"))
{
// This is not a test project where derived test classes are expected
return null;
}

var currentVersion = int.Parse(currentAssemblyName["StyleCop.Analyzers.Test.CSharp".Length..]);
var currentTestString = "CSharp" + currentVersion;
var previousTestString = currentVersion switch
{
7 => string.Empty,
_ => "CSharp" + (currentVersion - 1).ToString(),
};
var previousAssemblyName = previousTestString switch
{
"" => "StyleCop.Analyzers.Test",
_ => "StyleCop.Analyzers.Test." + previousTestString,
};
var previousTestString = "CSharp" + (currentVersion - 1).ToString();
var previousAssemblyName = "StyleCop.Analyzers.Test." + previousTestString;

return new TestData(previousTestString, previousAssemblyName, currentTestString, currentAssemblyName);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override void Initialize(AnalysisContext context)
context.RegisterCompilationStartAction(context =>
{
var assemblyName = context.Compilation.AssemblyName ?? string.Empty;
if (!Regex.IsMatch(assemblyName, @"^StyleCop\.Analyzers\.Test\.CSharp\d+$"))
if (!Regex.IsMatch(assemblyName, @"^StyleCop\.Analyzers\.Test\.CSharp\d+$") || assemblyName.EndsWith("CSharp6"))
{
// This is not a test project where derived test classes are expected
return;
Expand All @@ -54,16 +54,8 @@ public override void Initialize(AnalysisContext context)
{
var currentVersion = int.Parse(assemblyName["StyleCop.Analyzers.Test.CSharp".Length..]);
var currentTestString = "CSharp" + currentVersion;
var previousTestString = currentVersion switch
{
7 => string.Empty,
_ => "CSharp" + (currentVersion - 1).ToString(),
};
var previousAssemblyName = previousTestString switch
{
"" => "StyleCop.Analyzers.Test",
_ => "StyleCop.Analyzers.Test." + previousTestString,
};
var previousTestString = "CSharp" + (currentVersion - 1).ToString();
var previousAssemblyName = "StyleCop.Analyzers.Test." + previousTestString;

var previousAssembly = context.Compilation.Assembly.Modules.First().ReferencedAssemblySymbols.First(
symbol => symbol.Identity.Name == previousAssemblyName);
Expand Down
File renamed without changes.
Loading