Skip to content

Commit

Permalink
style: fix SA1633 for other files.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoona committed Sep 19, 2022
1 parent a584b27 commit 35f979b
Show file tree
Hide file tree
Showing 33 changed files with 235 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="EmptyDisposable.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;

namespace WebHdfs.Extensions.FileProviders
Expand All @@ -11,3 +16,4 @@ public void Dispose()
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="PollingFileChangeToken.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Microsoft.Extensions.Primitives;

Expand Down Expand Up @@ -59,3 +64,4 @@ public IDisposable RegisterChangeCallback(Action<object> callback, object state)
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// <copyright file="VisiableToUnitTestProject.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("WebHdfs.Extensions.FileProviders.UnitTest")]

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="WebHdfsDirectoryContents.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -47,3 +52,4 @@ public void Dispose()
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="WebHdfsFileInfo.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.IO;
using System.Net;
Expand Down Expand Up @@ -179,3 +184,4 @@ private static DateTimeOffset FromUnixTimeMilliseconds(long milliseconds)
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="WebHdfsFileProvider.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
Expand Down Expand Up @@ -58,3 +63,4 @@ public IChangeToken Watch(string filter, TimeSpan pollingInterval)
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="WebHdfsFileStatus.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using Newtonsoft.Json;

namespace WebHdfs.Extensions.FileProviders
Expand Down Expand Up @@ -28,3 +33,4 @@ internal enum WebHdfsFileType
FILE, DIRECTORY, SYMLINK
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="OptionsDedupChangeExtensions.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.IO;
using System.Runtime.Serialization;
Expand Down Expand Up @@ -63,3 +68,4 @@ private static bool IsHashTokenEqual(byte[] lhs, byte[] rhs)
}
}
}

8 changes: 7 additions & 1 deletion PhiFailureDetector/PhiFailureDetector.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
// <copyright file="Program.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Linq;
using System.Text;

Expand Down Expand Up @@ -78,3 +83,4 @@ private static double Normal(long duration, dynamic intervalHistory)
}
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
// <copyright file="ExponentialPhi_UnitTest.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PhiFailureDetector.UnitTest
{
Expand All @@ -22,3 +27,4 @@ public void Test_CassandraCase()
}
}
}

Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PhiFailureDetector.UnitTest
{
[TestClass]
public class LongIntervalHistory_UnitTest
{
[TestMethod]
public void Test_Baseline()
{
var arrivalWindow = new LongIntervalHistory(5);

arrivalWindow.Enqueue(1);
arrivalWindow.Enqueue(2);
arrivalWindow.Enqueue(3);
arrivalWindow.Enqueue(4);
arrivalWindow.Enqueue(5);
arrivalWindow.Enqueue(6);
arrivalWindow.Enqueue(7);

var queueArray = arrivalWindow.ToArray();
Array.Sort(queueArray);

CollectionAssert.AreEqual(
new long[] { 3, 4, 5, 6, 7 },
queueArray
);

Assert.AreEqual(25, arrivalWindow.Sum);
Assert.AreEqual(5, arrivalWindow.Avg);
}
}
}
// <copyright file="LongIntervalHistory_UnitTest.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PhiFailureDetector.UnitTest
{
[TestClass]
public class LongIntervalHistory_UnitTest
{
[TestMethod]
public void Test_Baseline()
{
var arrivalWindow = new LongIntervalHistory(5);

arrivalWindow.Enqueue(1);
arrivalWindow.Enqueue(2);
arrivalWindow.Enqueue(3);
arrivalWindow.Enqueue(4);
arrivalWindow.Enqueue(5);
arrivalWindow.Enqueue(6);
arrivalWindow.Enqueue(7);

var queueArray = arrivalWindow.ToArray();
Array.Sort(queueArray);

CollectionAssert.AreEqual(
new long[] { 3, 4, 5, 6, 7 },
queueArray
);

Assert.AreEqual(25, arrivalWindow.Sum);
Assert.AreEqual(5, arrivalWindow.Avg);
}
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
// <copyright file="NormalPhi_UnitTest.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down Expand Up @@ -93,3 +98,4 @@ public void Test_OnlyOneHeartbeat()
}
}
}

6 changes: 6 additions & 0 deletions PhiFailureDetector/PhiFailureDetector/IWithStatistics.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="IWithStatistics.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

namespace PhiFailureDetector
{
public interface IWithStatistics
Expand All @@ -13,3 +18,4 @@ public interface IWithStatistics
double Variance { get; }
}
}

6 changes: 6 additions & 0 deletions PhiFailureDetector/PhiFailureDetector/LongIntervalHistory.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="LongIntervalHistory.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -82,3 +87,4 @@ IEnumerator IEnumerable.GetEnumerator()
}
}
}

6 changes: 6 additions & 0 deletions PhiFailureDetector/PhiFailureDetector/PhiFailureDetector.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="PhiFailureDetector.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Clocks;

Expand Down Expand Up @@ -98,3 +103,4 @@ public static double Normal(long nowTimestamp, long lastTimestamp, IWithStatisti
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="FakeStopwatchProviderAndBlocker.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Collections.Generic;
using System.Threading;
Expand Down Expand Up @@ -47,3 +52,4 @@ public IStopwatch StartNew()
}
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter.Tests/RateLimiterTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="RateLimiterTest.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Threading;
using Xunit;
Expand Down Expand Up @@ -74,3 +79,4 @@ public void TestSimpleRateUpdate()
}
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// <copyright file="AssemblyInfo.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("RateLimiter.Tests")]

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/IAsyncBlocker.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="IAsyncBlocker.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -19,3 +24,4 @@ public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken)
}
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/IRateLimiter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="IRateLimiter.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
#if !NET20
using System.Threading;
Expand Down Expand Up @@ -65,3 +70,4 @@ public interface IRateLimiter
#endif
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/RateLimiter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="RateLimiter.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Clocks;

Expand Down Expand Up @@ -44,3 +49,4 @@ public static IRateLimiter Create(
}
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/RateLimiterBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="RateLimiterBase.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using System.Diagnostics;
using System.Threading;
Expand Down Expand Up @@ -318,3 +323,4 @@ protected bool CanAcquire(long nowTimestamp, TimeSpan timeout, out TimeSpan mome
protected abstract long ReserveEarliestAvailable(int permits, long nowTimestamp);
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/SmoothBurstyRateLimiter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="SmoothBurstyRateLimiter.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Clocks;

Expand Down Expand Up @@ -49,3 +54,4 @@ protected override TimeSpan StoredPermitsToWaitTime(double storedPermits, double
}
}
}

6 changes: 6 additions & 0 deletions RateLimiter/RateLimiter/SmoothRateLimiter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="SmoothRateLimiter.cs" company="Shuai Zhang">
// Copyright Shuai Zhang. All rights reserved.
// Licensed under the GPLv3 license. See LICENSE file in the project root for full license information.
// </copyright>

using System;
using Clocks;

Expand Down Expand Up @@ -84,3 +89,4 @@ protected void Resync(long nowTimestamp)
protected abstract void DoSetRate(double permitsPerSecond, TimeSpan stableInterval);
}
}

Loading

0 comments on commit 35f979b

Please sign in to comment.