Skip to content

Commit 05f8360

Browse files
committed
Revert several changes
* Require new JSON parser not break existing settings files * Allow unrecognized settings
1 parent fc1cf57 commit 05f8360

11 files changed

Lines changed: 22 additions & 29 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/NoXmlFileHeaderUnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class NoXmlFileHeaderUnitTests : CodeFixVerifier
2525
""copyrightText"": ""Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information."",
2626
""variables"": {
2727
""licenseName"": ""???"",
28-
""licenseFile"": ""LICENSE""
28+
""licenseFile"": ""LICENSE"",
2929
},
3030
""xmlHeader"": false
3131
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1203UnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ protected override string GetSettings()
448448
""kind"",
449449
""constant"",
450450
""static"",
451-
""readonly""
451+
""readonly"",
452452
]
453453
}
454454
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1717
<FileAlignment>512</FileAlignment>
1818
<TargetFrameworkProfile />
19-
<NuGetPackageImportStamp>
20-
</NuGetPackageImportStamp>
2119
</PropertyGroup>
2220
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2321
<DebugSymbols>true</DebugSymbols>

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/DocumentationSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected internal DocumentationSettings(JsonObject documentationSettingsObject)
141141

142142
if (!Regex.IsMatch(name, "^[a-zA-Z0-9]+$"))
143143
{
144-
throw new InvalidSettingsException($"{name} contains invalid characters");
144+
continue;
145145
}
146146

147147
string value = child.ToStringValue();
@@ -160,7 +160,7 @@ protected internal DocumentationSettings(JsonObject documentationSettingsObject)
160160
break;
161161

162162
default:
163-
throw new InvalidSettingsException($"documentationRules should not contain a child named {kvp.Key}");
163+
break;
164164
}
165165
}
166166
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/LayoutSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected internal LayoutSettings(JsonObject layoutSettingsObject)
3636
break;
3737

3838
default:
39-
throw new InvalidSettingsException($"layoutRules should not contain a child named {kvp.Key}");
39+
break;
4040
}
4141
}
4242
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/MaintainabilitySettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ protected internal MaintainabilitySettings()
2121
protected internal MaintainabilitySettings(JsonObject maintainabilitySettingsObject)
2222
: this()
2323
{
24-
if (maintainabilitySettingsObject.Count > 0)
25-
{
26-
throw new InvalidSettingsException($"maintainabilityRules should not contain any child objects");
27-
}
2824
}
2925
}
3026
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/NamingSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected internal NamingSettings(JsonObject namingSettingsObject)
5151

5252
if (!Regex.IsMatch(prefix, "^[a-z]{1,2}$"))
5353
{
54-
throw new InvalidSettingsException($"{kvp.Key} contains an invalid prefix.");
54+
continue;
5555
}
5656

5757
this.allowedHungarianPrefixes.Add(prefix);
@@ -60,7 +60,7 @@ protected internal NamingSettings(JsonObject namingSettingsObject)
6060
break;
6161

6262
default:
63-
throw new InvalidSettingsException($"namingRules should not contain a child named {kvp.Key}");
63+
break;
6464
}
6565
}
6666
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/OrderingSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected internal OrderingSettings(JsonObject orderingSettingsObject)
7171
break;
7272

7373
default:
74-
throw new InvalidSettingsException($"orderingRules should not contain a child named {kvp.Key}");
74+
break;
7575
}
7676
}
7777
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/ReadabilitySettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ protected internal ReadabilitySettings()
2121
protected internal ReadabilitySettings(JsonObject readabilitySettingsObject)
2222
: this()
2323
{
24-
if (readabilitySettingsObject.Count > 0)
25-
{
26-
throw new InvalidSettingsException($"readabilityRules should not contain any child objects");
27-
}
2824
}
2925
}
3026
}

StyleCop.Analyzers/StyleCop.Analyzers/Settings/ObjectModel/SpacingSettings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ protected internal SpacingSettings()
2121
protected internal SpacingSettings(JsonObject spacingSettingsObject)
2222
: this()
2323
{
24-
if (spacingSettingsObject.Count > 0)
25-
{
26-
throw new InvalidSettingsException($"spacingRules should not contain any child objects");
27-
}
2824
}
2925
}
3026
}

0 commit comments

Comments
 (0)