Skip to content

Commit f139428

Browse files
authored
Merge pull request #3763 from sharwell/remove-vsix
Remove VSIX project and unnecessary build outputs
2 parents 73b34ac + cdb5e0f commit f139428

27 files changed

+139
-175
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33

44
<PropertyGroup>
5-
<TargetFrameworks>netstandard1.1;net452</TargetFrameworks>
5+
<TargetFramework>netstandard1.1</TargetFramework>
6+
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
7+
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
68
<RootNamespace>StyleCop.Analyzers</RootNamespace>
79
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
810
<IncludeSymbols>true</IncludeSymbols>
@@ -16,14 +18,6 @@
1618
<NoWarn>$(NoWarn),NU5105</NoWarn>
1719
</PropertyGroup>
1820

19-
<Choose>
20-
<When Condition="'$(TargetFramework)' == 'netstandard1.1'">
21-
<PropertyGroup>
22-
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
23-
</PropertyGroup>
24-
</When>
25-
</Choose>
26-
2721
<PropertyGroup>
2822
<CodeAnalysisRuleSet>..\StyleCop.Analyzers.ruleset</CodeAnalysisRuleSet>
2923
</PropertyGroup>

StyleCop.Analyzers/StyleCop.Analyzers.Test/LightJson/JsonArrayTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace StyleCop.Analyzers.Test.LightJson
77
{
88
using System;
9+
using System.Diagnostics;
10+
using System.Reflection;
911
using global::LightJson;
1012
using Xunit;
1113
using IEnumerable = System.Collections.IEnumerable;
@@ -141,5 +143,22 @@ public void TestEnumerators()
141143
}
142144
}
143145
}
146+
147+
[Fact]
148+
public void TestDebugView()
149+
{
150+
var obj = new JsonArray("a", "b", "c");
151+
var proxyAttribute = obj.GetType().GetCustomAttribute<DebuggerTypeProxyAttribute>();
152+
Assert.NotNull(proxyAttribute);
153+
154+
var proxyType = Type.GetType(proxyAttribute.ProxyTypeName);
155+
Assert.NotNull(proxyType);
156+
157+
var proxy = Activator.CreateInstance(proxyType, obj);
158+
Assert.NotNull(proxy);
159+
160+
var items = proxyType.GetTypeInfo().GetDeclaredProperty("Items").GetValue(proxy);
161+
Assert.IsType<JsonValue[]>(items);
162+
}
144163
}
145164
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/LightJson/JsonObjectTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace StyleCop.Analyzers.Test.LightJson
77
{
88
using System;
99
using System.Collections.Generic;
10+
using System.Diagnostics;
11+
using System.Reflection;
1012
using global::LightJson;
1113
using Xunit;
1214
using IEnumerable = System.Collections.IEnumerable;
@@ -109,6 +111,35 @@ public void TestRename()
109111
Assert.Same(value, obj["y"].AsString);
110112
}
111113

114+
[Fact]
115+
public void TestDebugView()
116+
{
117+
var obj = new JsonObject
118+
{
119+
["x"] = "string value",
120+
["y"] = new JsonObject(),
121+
["z"] = new JsonArray("a", "b", "c"),
122+
};
123+
var proxyAttribute = obj.GetType().GetCustomAttribute<DebuggerTypeProxyAttribute>();
124+
Assert.NotNull(proxyAttribute);
125+
126+
var proxyType = Type.GetType(proxyAttribute.ProxyTypeName);
127+
Assert.NotNull(proxyType);
128+
129+
var proxy = Activator.CreateInstance(proxyType, obj);
130+
Assert.NotNull(proxy);
131+
132+
var keys = proxyType.GetTypeInfo().GetDeclaredProperty("Keys").GetValue(proxy);
133+
var keysArray = Assert.IsAssignableFrom<Array>(keys);
134+
135+
Assert.NotEmpty(keysArray);
136+
foreach (var key in keysArray)
137+
{
138+
var view = key.GetType().GetTypeInfo().GetDeclaredProperty("View").GetValue(key);
139+
Assert.NotNull(view);
140+
}
141+
}
142+
112143
#pragma warning disable IDE0060 // Remove unused parameter
113144
private static Type StaticType<T>(T value) => typeof(T);
114145
#pragma warning restore IDE0060 // Remove unused parameter

StyleCop.Analyzers/StyleCop.Analyzers.Test/LightJson/JsonValueTests.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace StyleCop.Analyzers.Test.LightJson
77
{
88
using System;
9+
using System.Diagnostics;
10+
using System.Reflection;
911
using global::LightJson;
1012
using global::LightJson.Serialization;
1113
using StyleCop.Analyzers.Test.Helpers;
@@ -351,5 +353,86 @@ public void TestParse()
351353
Assert.ThrowsAny<JsonParseException>(() => JsonValue.Parse(string.Empty));
352354
Assert.ThrowsAny<JsonParseException>(() => JsonValue.Parse("{"));
353355
}
356+
357+
[Fact]
358+
public void TestDebugViewOfObject()
359+
{
360+
var obj = JsonValue.Parse("{}");
361+
var proxyAttribute = obj.GetType().GetCustomAttribute<DebuggerTypeProxyAttribute>();
362+
Assert.NotNull(proxyAttribute);
363+
364+
var proxyType = Type.GetType(proxyAttribute.ProxyTypeName);
365+
Assert.NotNull(proxyType);
366+
367+
var proxy = Activator.CreateInstance(proxyType, obj);
368+
Assert.NotNull(proxy);
369+
370+
var objectView = proxyType.GetTypeInfo().GetDeclaredProperty("ObjectView").GetValue(proxy);
371+
var arrayView = proxyType.GetTypeInfo().GetDeclaredProperty("ArrayView").GetValue(proxy);
372+
var jsonValueType = proxyType.GetTypeInfo().GetDeclaredProperty("Type").GetValue(proxy);
373+
var value = proxyType.GetTypeInfo().GetDeclaredProperty("Value").GetValue(proxy);
374+
375+
Assert.Same(obj.AsJsonObject, objectView);
376+
Assert.Same(obj.AsJsonArray, arrayView);
377+
378+
Assert.IsType<JsonObject>(objectView);
379+
Assert.Null(arrayView);
380+
Assert.Equal(obj.Type, jsonValueType);
381+
Assert.Same(obj.AsJsonObject, value);
382+
}
383+
384+
[Fact]
385+
public void TestDebugViewOfArray()
386+
{
387+
var obj = JsonValue.Parse("[]");
388+
var proxyAttribute = obj.GetType().GetCustomAttribute<DebuggerTypeProxyAttribute>();
389+
Assert.NotNull(proxyAttribute);
390+
391+
var proxyType = Type.GetType(proxyAttribute.ProxyTypeName);
392+
Assert.NotNull(proxyType);
393+
394+
var proxy = Activator.CreateInstance(proxyType, obj);
395+
Assert.NotNull(proxy);
396+
397+
var objectView = proxyType.GetTypeInfo().GetDeclaredProperty("ObjectView").GetValue(proxy);
398+
var arrayView = proxyType.GetTypeInfo().GetDeclaredProperty("ArrayView").GetValue(proxy);
399+
var jsonValueType = proxyType.GetTypeInfo().GetDeclaredProperty("Type").GetValue(proxy);
400+
var value = proxyType.GetTypeInfo().GetDeclaredProperty("Value").GetValue(proxy);
401+
402+
Assert.Same(obj.AsJsonObject, objectView);
403+
Assert.Same(obj.AsJsonArray, arrayView);
404+
405+
Assert.Null(objectView);
406+
Assert.IsType<JsonArray>(arrayView);
407+
Assert.Equal(obj.Type, jsonValueType);
408+
Assert.Same(obj.AsJsonArray, value);
409+
}
410+
411+
[Fact]
412+
public void TestDebugViewOfBoolean()
413+
{
414+
var obj = JsonValue.Parse("true");
415+
var proxyAttribute = obj.GetType().GetCustomAttribute<DebuggerTypeProxyAttribute>();
416+
Assert.NotNull(proxyAttribute);
417+
418+
var proxyType = Type.GetType(proxyAttribute.ProxyTypeName);
419+
Assert.NotNull(proxyType);
420+
421+
var proxy = Activator.CreateInstance(proxyType, obj);
422+
Assert.NotNull(proxy);
423+
424+
var objectView = proxyType.GetTypeInfo().GetDeclaredProperty("ObjectView").GetValue(proxy);
425+
var arrayView = proxyType.GetTypeInfo().GetDeclaredProperty("ArrayView").GetValue(proxy);
426+
var jsonValueType = proxyType.GetTypeInfo().GetDeclaredProperty("Type").GetValue(proxy);
427+
var value = proxyType.GetTypeInfo().GetDeclaredProperty("Value").GetValue(proxy);
428+
429+
Assert.Same(obj.AsJsonObject, objectView);
430+
Assert.Same(obj.AsJsonArray, arrayView);
431+
432+
Assert.Null(objectView);
433+
Assert.Null(arrayView);
434+
Assert.Equal(obj.Type, jsonValueType);
435+
Assert.Equal(obj, value);
436+
}
354437
}
355438
}

StyleCop.Analyzers/StyleCop.Analyzers.Vsix/Properties/launchSettings.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

StyleCop.Analyzers/StyleCop.Analyzers.Vsix/StyleCop.Analyzers.Vsix.csproj

Lines changed: 0 additions & 51 deletions
This file was deleted.

StyleCop.Analyzers/StyleCop.Analyzers.Vsix/source.extension.vsixmanifest

Lines changed: 0 additions & 21 deletions
This file was deleted.

StyleCop.Analyzers/StyleCop.Analyzers/AnalyzerConstants.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,13 @@
11
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
#nullable disable
5-
64
namespace StyleCop.Analyzers
75
{
86
using System.Diagnostics.CodeAnalysis;
97
using Microsoft.CodeAnalysis;
108

119
internal static class AnalyzerConstants
1210
{
13-
static AnalyzerConstants()
14-
{
15-
#if DEBUG
16-
// In DEBUG builds, the tests are enabled to simplify development and testing.
17-
DisabledNoTests = true;
18-
#else
19-
DisabledNoTests = false;
20-
#endif
21-
}
22-
23-
/// <summary>
24-
/// Gets a reference value which can be passed to
25-
/// <see cref="DiagnosticDescriptor(string, string, string, string, DiagnosticSeverity, bool, string, string, string[])"/>
26-
/// to disable a diagnostic which is currently untested.
27-
/// </summary>
28-
/// <value>
29-
/// A reference value which can be passed to
30-
/// <see cref="DiagnosticDescriptor(string, string, string, string, DiagnosticSeverity, bool, string, string, string[])"/>
31-
/// to disable a diagnostic which is currently untested.
32-
/// </value>
33-
[ExcludeFromCodeCoverage]
34-
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1623:Property summary documentation should match accessors.", Justification = "This property behaves more like an opaque value than a Boolean.")]
35-
internal static bool DisabledNoTests { get; }
36-
3711
/// <summary>
3812
/// Gets a reference value which can be passed to
3913
/// <see cref="DiagnosticDescriptor(string, string, string, string, DiagnosticSeverity, bool, string, string, string[])"/>

StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1603DocumentationMustContainValidXml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace StyleCop.Analyzers.DocumentationRules
77
{
88
using System.Collections.Immutable;
9-
using System.Diagnostics.CodeAnalysis;
109
using Microsoft.CodeAnalysis;
1110
using Microsoft.CodeAnalysis.Diagnostics;
1211

@@ -43,7 +42,6 @@ internal class SA1603DocumentationMustContainValidXml : DiagnosticAnalyzer
4342
ImmutableArray.Create(Descriptor);
4443

4544
/// <inheritdoc/>
46-
[ExcludeFromCodeCoverage]
4745
#pragma warning disable RS1025 // Configure generated code analysis
4846
#pragma warning disable RS1026 // Enable concurrent execution
4947
public override void Initialize(AnalysisContext context)

StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1628DocumentationTextMustBeginWithACapitalLetter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace StyleCop.Analyzers.DocumentationRules
77
{
88
using System.Collections.Immutable;
9-
using System.Diagnostics.CodeAnalysis;
109
using Microsoft.CodeAnalysis;
1110
using Microsoft.CodeAnalysis.Diagnostics;
1211

@@ -59,7 +58,6 @@ internal class SA1628DocumentationTextMustBeginWithACapitalLetter : DiagnosticAn
5958
ImmutableArray.Create(Descriptor);
6059

6160
/// <inheritdoc/>
62-
[ExcludeFromCodeCoverage]
6361
#pragma warning disable RS1025 // Configure generated code analysis
6462
#pragma warning disable RS1026 // Enable concurrent execution
6563
public override void Initialize(AnalysisContext context)

0 commit comments

Comments
 (0)