Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Analyzer.Core.BuiltInRuleTests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void TestRules(TestConfiguration ruleExpectations)
var failingLines = thisRuleEvaluations
.Where(e => !e.Passed)
.SelectMany(e => GetAllFailedLines(e))
.Distinct()
.ToList();

failingLines.Sort();
Expand All @@ -59,7 +60,7 @@ public void TestRules(TestConfiguration ruleExpectations)
var expectedLines = ruleExpectations.ReportedFailures.Select(failure => failure.LineNumber).ToList();
expectedLines.Sort();
Assert.IsTrue(failingLines.SequenceEqual(expectedLines),
"Expected failing lines do not match actual failed lines." + Environment.NewLine +
$"Expected failing lines do not match actual failed lines for rule {ruleExpectations.RuleId}." + Environment.NewLine +
$"Expected: [{string.Join(",", expectedLines)}] Actual: [{string.Join(",", failingLines)}]" +
(failingLines.Count > 0 ? "" : Environment.NewLine + "(Do the test directory and test config have the same name as the RuleId being tested?)"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,7 @@
},
{
"LineNumber": 82,
"Description": "httpLoggingEnabled is not given a value"
},
{
"LineNumber": 82,
"Description": "detailedErrorLoggingEnabled is not given a value"
},
{
"LineNumber": 82,
"Description": "requestTracingEnabled is not given a value"
"Description": "httpLoggingEnabled, detailedErrorLoggingEnabled, and requestTracingEnabled are not given values"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "remoteDebuggingOn",
"location": "[parameters('location')]",
"properties": {
"siteConfig": {
"remoteDebuggingEnabled": true
}
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "offInResourceButOnInChildConfig",
"location": "[parameters('location')]",
"properties": {
"siteConfig": {
"remoteDebuggingEnabled": false
}
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInResourceButonInChildConfig')]"
],
"properties": {
"remoteDebuggingEnabled": true
}
}
]
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "onInResourceButOffInChildConfig",
"location": "[parameters('location')]",
"properties": {
"siteConfig": {
"remoteDebuggingEnabled": true
}
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInResourceButonInChildConfig')]"
],
"properties": {
"remoteDebuggingEnabled": false
}
}
]
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "onInChildConfig",
"location": "[parameters('location')]",
"properties": { },
"resources": [
{
"apiVersion": "2019-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'onInChildConfig')]"
],
"properties": {
"remoteDebuggingEnabled": true
}
}
]
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "onInDependentConfig",
"location": "[parameters('location')]",
"properties": { }
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites/config",
"name": "onInDependentConfig/web",
"kind": "api",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'onInDependentConfig')]"
],
"properties": {
"remoteDebuggingEnabled": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "linux",
"name": "notApiKind",
"location": "[parameters('location')]",
"properties": {
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "withoutSpecifyingProperties",
"location": "[parameters('location')]",
"properties": {
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "remoteDebuggingOff",
"location": "[parameters('location')]",
"properties": {
"siteConfig": {
"remoteDebuggingEnabled": false
}
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "absentInChildConfig",
"location": "[parameters('location')]",
"properties": {
"siteConfig": { }
},
"resources": [
{
"apiVersion": "2019-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInChildConfig')]"
],
"properties": { }
}
]
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "offInChildConfig",
"location": "[parameters('location')]",
"properties": { },
"resources": [
{
"apiVersion": "2019-08-01",
"type": "config",
"name": "web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInChildConfig')]"
],
"properties": {
"remoteDebuggingEnabled": false
}
}
]
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites",
"kind": "api",
"name": "offInDependentConfig",
"location": "[parameters('location')]",
"properties": { }
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites/config",
"name": "offInDependentConfig/web",
"kind": "api",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInDependentConfig')]"
],
"properties": {
"remoteDebuggingEnabled": false
}
},
{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites/config",
"name": "offInDependentConfig/metadata",
"kind": "api",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', 'offInDependentConfig')]"
],
"properties": {
"remoteDebuggingEnabled": true
}
},
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[
{
"Template": "RemoteDebugging-Failures.json",
"ReportedFailures": [
{
"LineNumber": 22,
"Description": "remoteDebuggingEnabled set to true in resource"
},
{
"LineNumber": 46,
"Description": "remoteDebuggingEnabled set to true in child config (even though it's false in parent resource)"
},
{
"LineNumber": 59,
"Description": "remoteDebuggingEnabled set to true in resource (even though it's false in child config)"
},
{
"LineNumber": 92,
"Description": "remoteDebuggingEnabled set to true in child config"
},
{
"LineNumber": 114,
"Description": "remoteDebuggingEnabled set to true in dependent config"
}
]
},
{
"Template": "RemoteDebugging-Passes.json",
"ReportedFailures": [ ],
"PassingSections": [
{
"ResourceName": "notApiKind",
"Explanation": "Wrong resource kind"
},
{
"ResourceName": "withoutSpecifyingProperties",
"Explanation": "remoteDebuggingEnabled is not defined"
},
{
"ResourceName": "remoteDebuggingOff",
"Explanation": "remoteDebuggingEnabled is false"
},
{
"ResourceName": "absentInChildConfig",
"Explanation": "remoteDebuggingEnabled not defined in web app or in child web app config"
},
{
"ResourceName": "offInChildConfig",
"Explanation": "remoteDebuggingEnabled is false in a child config"
},
{
"ResourceNames": [
"offInDependentConfig",
"offInDependentConfig/web",
"offInDependentConfig/metadata"
],
"Explanation": "remoteDebuggingEnabled is false in a dependent config. Config with name 'metadata' is not the right config type for this property, so it being defined with 'true' has no effect."
}
]
}
]
Loading