Skip to content

Commit

Permalink
Enable multiple blank lines StyleCop rules (Azure#17318)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored and annelo-msft committed Feb 17, 2021
1 parent ac4ae82 commit 9763dbe
Show file tree
Hide file tree
Showing 446 changed files with 48 additions and 774 deletions.
1 change: 0 additions & 1 deletion common/Perf/Azure.Test.Perf/PerfProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ private static async Task Run(Type testType, PerfOptions options)

try
{

try
{
await tests[0].GlobalSetupAsync();
Expand Down
1 change: 0 additions & 1 deletion common/Stress/Azure.Test.Stress/StressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ protected static string GetEnvironmentVariable(string name)
throw new InvalidOperationException($"Undefined environment variable {name}");
}
return value;

}
}
}
8 changes: 4 additions & 4 deletions eng/CodeAnalysis.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@
<Rule Id="SA1502" Action="None" /> <!-- Element should not be on a single line -->
<Rule Id="SA1503" Action="None" /> <!-- Braces should not be omitted -->
<Rule Id="SA1504" Action="None" /> <!-- All accessors should be single-line or multi-line -->
<Rule Id="SA1505" Action="None" /> <!-- Opening braces should not be followed by blank line -->
<Rule Id="SA1505" Action="Warning" /> <!-- Opening braces should not be followed by blank line -->
<Rule Id="SA1506" Action="None" /> <!-- Element documentation headers should not be followed by blank line -->
<Rule Id="SA1507" Action="None" /> <!-- Code should not contain multiple blank lines in a row -->
<Rule Id="SA1508" Action="None" /> <!-- Closing braces should not be preceded by blank line -->
<Rule Id="SA1509" Action="None" /> <!-- Opening braces should not be preceded by blank line -->
<Rule Id="SA1507" Action="Warning" /> <!-- Code should not contain multiple blank lines in a row -->
<Rule Id="SA1508" Action="Warning" /> <!-- Closing braces should not be preceded by blank line -->
<Rule Id="SA1509" Action="Warning" /> <!-- Opening braces should not be preceded by blank line -->
<Rule Id="SA1510" Action="None" /> <!-- Chained statement blocks should not be preceded by blank line -->
<Rule Id="SA1511" Action="None" /> <!-- While-do footer should not be preceded by blank line -->
<Rule Id="SA1512" Action="None" /> <!-- Single-line comments should not be followed by blank line -->
Expand Down
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Update="ApprovalTests" Version="3.0.22" />
<PackageReference Update="ApprovalUtilities" Version="3.0.22" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20201203.1" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20201203.2" />
<PackageReference Update="Azure.AI.FormRecognizer" Version="3.0.0" />
<PackageReference Update="Azure.AI.TextAnalytics" Version="5.0.0" />
<PackageReference Update="Azure.Data.AppConfiguration" Version="1.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ public async Task CustomHeadersAreAddedOnceWithRetries()
Assert.AreEqual(1, correlationContexts.Count());
}


private void AssertContent(byte[] expected, MockRequest request, bool compareAsString = true)
{
using (var stream = new MemoryStream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private void Normalize(JObject o)
}
}
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public void FilterReservedCharacter()
ConfigurationClient.BuildBatchQuery(builder, selector, null);

Assert.AreEqual(@"http://localhost/?key=my_key%2Ckey%5C%2Ckey&label=my_label%2Clabel%5C%2Clabel", builder.ToUri().AbsoluteUri);

}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public async Task GetAsync()
await s_configurationClient.GetConfigurationSettingAsync("key");
}


private class MockClientHandler : HttpClientHandler
{
private readonly Func<HttpRequestMessage, HttpResponseMessage> _responseMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public async Task HelloWorldExtended()
await client.SetConfigurationSettingAsync(instancesToUpdate);
#endregion


#region Snippet:AzConfigSample2_GetConfigurationSettingsAsync
var selector = new SettingSelector { LabelFilter = "production" };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void GetSetting()
var setupClient = new ConfigurationClient(connectionString);
setupClient.SetConfigurationSetting("some_key", "some_value");


#region Snippet:GetConfigurationSetting
//@@ string connectionString = "<connection_string>";
var client = new ConfigurationClient(connectionString);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.


using Azure.Core.TestFramework;

namespace Azure.ResourceManager.AppConfiguration.Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public override ValueTask<Response<ReservationStatus>> WaitForCompletionAsync(Ca
public override ValueTask<Response<ReservationStatus>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken)
=> this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken);


private static string GetErrorMessage(ReservationStatus? reservationStatus)
{
if (reservationStatus == ReservationStatus.Cancelled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,5 @@ public async Task Troubleshooting()
Assert.Fail($"Unexpected error: {ex}");
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public async Task GetAddRemoveMembersAsync()
#endregion Snippet:Azure_Communication_Chat_Tests_Samples_RemoveMember

await chatClient.DeleteChatThreadAsync(threadId);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public void CommunicationUserCredential_ThrowsIfInvalidToken(string token)
public void CommunicationUserCredential_ThrowsIfTokenIsNull()
=> Assert.Throws<ArgumentNullException>(() => new CommunicationUserCredential(null!));


[Test]
[TestCase(false)]
[TestCase(true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Azure.Communication.Sms.Tests
{
public class SmsClientTest
{

[TestCaseSource(nameof(TestData))]
public async Task SendSmsAsyncOverload_PassesToGeneratedOne(PhoneNumber expectedFrom, PhoneNumber expectedTo, string expectedMessage, SendSmsOptions expectedOptions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ public override void Sanitize(RecordSession session)

base.Sanitize(session);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ private static List<VirtualMachineSize> GetExpectedVirtualMachineSize(bool hasAZ
expectedVMSizePropertiesList.Add(new VirtualMachineSize(VirtualMachineSizeTypes.StandardA1.ToString(),1,130048,71680, 1792, 2));
}


return expectedVMSizePropertiesList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ private async Task VerifyInvalidFDUDValuesFail()
{
Assert.NotNull(ex);
//Assert.True(ex.Response.StatusCode == HttpStatusCode.BadRequest);

}
Assert.True(createOrUpdateResponse == null);

Expand All @@ -135,7 +134,6 @@ private async Task VerifyInvalidFDUDValuesFail()
{
Assert.NotNull(ex);
//Assert.True(ex.Response.StatusCode == HttpStatusCode.BadRequest);

}
Assert.True(createOrUpdateResponse == null);

Expand All @@ -151,7 +149,6 @@ private async Task VerifyInvalidFDUDValuesFail()
{
Assert.NotNull(ex);
//Assert.True(ex.Response.StatusCode == HttpStatusCode.BadRequest);

}
Assert.True(createOrUpdateResponse == null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace Azure.ResourceManager.Compute.Tests
[AsyncOnly]
public class DedicatedHostTests : VMTestBase
{

public DedicatedHostTests(bool isAsync)
: base(isAsync)
{
Expand Down Expand Up @@ -110,7 +109,6 @@ private void ValidateDedicatedHostGroup(DedicatedHostGroup expectedDHG, Dedicate
Assert.AreEqual(expectedDHG.Location, actualDHG.Location);
Assert.AreEqual(expectedDHG.Name, actualDHG.Name);
}

}

private void ValidateDedicatedHost(DedicatedHost expectedDH, DedicatedHost actualDH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ private async Task TestVMWithOSProfile(
await WaitForCompletionAsync(await VirtualMachinesOperations.StartDeleteAsync(rgName, vm.Name));
}


//Not used
public static string ReadFromEmbeddedResource(Type type, string resourceName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Azure.ResourceManager.Resources.Models;
using NUnit.Framework;


namespace Azure.ResourceManager.Compute.Tests
{
[AsyncOnly]
Expand Down Expand Up @@ -402,7 +401,6 @@ private async void ValidateResults(ProximityPlacementGroup outputProximityPlacem
private void ValidateProximityPlacementGroup(ProximityPlacementGroup expectedProximityPlacementGroup, ProximityPlacementGroup outputProximityPlacementGroup,
string expectedProximityPlacementGroupName)
{

Assert.True(outputProximityPlacementGroup != null, "ProximityPlacementGroup is null in response.");
Assert.True(expectedProximityPlacementGroupName == outputProximityPlacementGroup.Name, "ProximityPlacementGroup.Name in response mismatch with expected value.");
Assert.True(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Azure.ResourceManager.Compute.Tests
[AsyncOnly]
public class VMCertificateTests : VMTestBase
{

public VMCertificateTests(bool isAsync)
: base(isAsync)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public async Task CleanupResourceGroup()
//[Trait("Name", "TestDiskEncryption")]
public async Task TestVMDiskEncryption()
{

EnsureClientsInitialized(DefaultLocation);

ImageReference imageRef = await GetPlatformVMImage(useWindowsImage: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ public async Task TestVMOperations_PerformMaintenance()
inputVM1Name = returnTwovm.Item3;
await WaitForCompletionAsync(await VirtualMachinesOperations.StartPerformMaintenanceAsync(rg1Name, vm1.Name));
passed = true;

}
catch (Exception cex)
{
Expand Down Expand Up @@ -361,7 +360,6 @@ public async Task TestVMOperations_SimulateEviction()
VirtualMachine vm1 = returnTwoVM.Item1;
inputVM1 = returnTwoVM.Item2;


await VirtualMachinesOperations.SimulateEvictionAsync(rg1Name, vm1.Name);
passed = true;
Assert.True(passed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ private async Task TestVMScenarioOperationsInternal(string methodName, bool hasM

if (diskEncryptionSetId != null)
{

Assert.True(getVMWithInstanceViewResponse.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet != null, "OsDisk.ManagedDisk.DiskEncryptionSet is null");
Assert.True(string.Equals(diskEncryptionSetId, getVMWithInstanceViewResponse.StorageProfile.OsDisk.ManagedDisk.DiskEncryptionSet.Id, StringComparison.OrdinalIgnoreCase),
"OsDisk.ManagedDisk.DiskEncryptionSet.Id is not matching with expected DiskEncryptionSet resource");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ public async Task TestVMScaleSetWithPublicIPAndIPTags()

publicipConfiguration.IpTags.Add(new VirtualMachineScaleSetIpTag("FirstPartyUsage", "/Sql"));


var getTwoVirtualMachineScaleSet = await CreateVMScaleSet_NoAsyncTracking(
rgName: rgName,
vmssName: vmssName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public async Task TestVMScaleSetOperations_ManagedDisks()

private async Task TestVMScaleSetOperationsInternal(bool hasManagedDisks = false)
{

ImageReference imageRef = await GetPlatformVMImage(useWindowsImage: true);

// Create resource group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Azure.ResourceManager.Resources;
using NUnit.Framework;


namespace Azure.ResourceManager.Compute.Tests
{
public class VMScaleSetRollingUpgradeTests : VMScaleSetTestsBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ public async Task TestVMScaleSetScenarioOperations_OrchestrationService()
Assert.AreEqual("Running", getInstanceViewResponse.OrchestrationServices[0].ServiceState.ToString());
Assert.AreEqual("AutomaticRepairs", getInstanceViewResponse.OrchestrationServices[0].ServiceName.ToString());


////TODO
OrchestrationServiceStateInput orchestrationServiceStateInput = new OrchestrationServiceStateInput(OrchestrationServiceNames.AutomaticRepairs, OrchestrationServiceStateAction.Suspend);
//OrchestrationServiceStateAction orchestrationServiceStateAction = new OrchestrationServiceStateAction();
Expand All @@ -302,7 +301,6 @@ public async Task TestVMScaleSetScenarioOperations_OrchestrationService()
await WaitForCompletionAsync(await VirtualMachineScaleSetsOperations.StartDeleteAsync(rgName, vmssName));
}


private async Task TestScaleSetOperationsInternal(string vmSize = null, bool hasManagedDisks = false, bool useVmssExtension = true,
bool hasDiffDisks = false, IList<string> zones = null, int? osDiskSizeInGB = null, bool isPpgScenario = false, bool? enableUltraSSD = false,
Action<VirtualMachineScaleSet> vmScaleSetCustomizer = null, Action<VirtualMachineScaleSet> vmScaleSetValidator = null, string diskEncryptionSetId = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using NUnit.Framework;


namespace Azure.ResourceManager.Compute.Tests
{
public class VMScaleSetServiceFabricScenarioTests : VMScaleSetTestsBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ protected async Task PatchVMScaleSet(string rgName, string vmssName, VirtualMach
return (createOrUpdateResponse, inputVMScaleSet);
}


protected void ValidateVMScaleSetInstanceView(VirtualMachineScaleSet vmScaleSet,
VirtualMachineScaleSetInstanceView vmScaleSetInstanceView)
{
Expand Down Expand Up @@ -670,7 +669,6 @@ VirtualMachineScaleSetDataDisk matchingDataDisk

if (ppgId != null)
{

Assert.AreEqual(ppgId.ToLower(), vmScaleSetOut.ProximityPlacementGroup.Id.ToLower());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public async Task TestVMScaleSetScalingOperations()

await WaitForCompletionAsync(await VirtualMachineScaleSetsOperations.StartDeleteAsync(rgName, "VMScaleSetDoesNotExist"));


var getTwoVirtualMachineScaleSet = await CreateVMScaleSet_NoAsyncTracking(rgName, vmssName, storageAccountOutput, imageRef);
VirtualMachineScaleSet vmScaleSet = getTwoVirtualMachineScaleSet.Item1;
inputVMScaleSet = getTwoVirtualMachineScaleSet.Item2;
Expand Down Expand Up @@ -171,7 +170,6 @@ public async Task TestVMScaleSetPatchOperations()
getResponse = await VirtualMachineScaleSetsOperations.GetAsync(rgName, vmScaleSet.Name);
ValidateVMScaleSet(inputVMScaleSet, getResponse);


// Scaling the VMScaleSet now to 3 instances
VirtualMachineScaleSetUpdate patchVMScaleSet2 = new VirtualMachineScaleSetUpdate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ private async Task AttachDataDiskToVMScaleSetVM(VirtualMachineScaleSetVM vmssVM,

var disk = await CreateDataDisk(diskName);


var dd = new DataDisk(lun, DiskCreateOptionTypes.Attach)
{
Name = diskName,
Expand Down
6 changes: 1 addition & 5 deletions sdk/core/Azure.Core.Experimental/src/DynamicJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ private IEnumerable GetDynamicEnumerable()

private DynamicJson GetPropertyValue(string propertyName)
{

if (EnsureObject().TryGetValue(propertyName, out DynamicJson element))
{
return element;
Expand Down Expand Up @@ -371,7 +370,6 @@ public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicM
}
}


/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -445,7 +443,6 @@ public static DynamicJson Array(params DynamicJson[] values)
public static explicit operator float(DynamicJson json) => json.GetFloat();
public static explicit operator double(DynamicJson json) => json.GetDouble();


public static explicit operator bool?(DynamicJson json) => json._kind == JsonValueKind.Null ? (bool?)null : json.GetBoolean();
public static explicit operator int?(DynamicJson json) => json._kind == JsonValueKind.Null ? (int?)null : json.GetIn32();
public static explicit operator long?(DynamicJson json) => json._kind == JsonValueKind.Null ? (long?)null : json.GetLong();
Expand Down Expand Up @@ -585,6 +582,5 @@ public double AsDouble()
return _double;
}
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public GeoPosition(double longitude, double latitude, double? altitude)
Altitude = altitude;
}


/// <inheritdoc />
public bool Equals(GeoPosition other)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,5 @@ public static IEnumerable<object[]> PrimitiveValues()
yield return new object[] {true, "true"};
yield return new object[] {false, "false"};
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ public void ExistingObjectPropertiesCanBeAssigned()

Assert.AreEqual(json.ToString(), "{\"a\":\"2\"}");
}

}
}
Loading

0 comments on commit 9763dbe

Please sign in to comment.