Skip to content

Commit 623308f

Browse files
committed
Merge branch develop into privatekey-pkcs8
2 parents 7097607 + 3b55ba3 commit 623308f

File tree

18 files changed

+97
-54
lines changed

18 files changed

+97
-54
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ dotnet_diagnostic.S101.severity = none
2929
# This is a duplicate of CA2201 and MA0012.
3030
dotnet_diagnostic.S112.severity = none
3131

32+
# S127: "for" loop stop conditions should be invariant
33+
# https://rules.sonarsource.com/csharp/RSPEC-127
34+
#
35+
# Limited use.
36+
dotnet_diagnostic.S127.severity = none
37+
3238
# S907: Remove use of 'goto'
3339
# https://rules.sonarsource.com/csharp/RSPEC-907
3440
#
@@ -128,6 +134,12 @@ dotnet_diagnostic.S2259.severity = none
128134
# This is a duplicate of IDE0032.
129135
dotnet_diagnostic.S2292.severity = none
130136

137+
# S2325: Methods and properties that don't access instance data should be static
138+
# https://rules.sonarsource.com/csharp/RSPEC-2325
139+
#
140+
# This is a duplicate of CA1822
141+
dotnet_diagnostic.S2325.severity = none
142+
131143
# S2445: Blocks should be synchronized on read-only fields
132144
# https://rules.sonarsource.com/csharp/RSPEC-2445
133145
#

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageVersion Include="Moq" Version="4.20.72" />
2020
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.70-alpha" />
2121
<PackageVersion Include="PolySharp" Version="1.14.1" />
22-
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.19.0.84025" />
22+
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
2323
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
2424
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
2525
<PackageVersion Include="Testcontainers" Version="3.10.0" />
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
4+
namespace Renci.SshNet.Abstractions
5+
{
6+
internal static class CancellationTokenSourceExtensions
7+
{
8+
#if !NET8_OR_GREATER
9+
public static Task CancelAsync(this CancellationTokenSource cancellationTokenSource)
10+
{
11+
cancellationTokenSource.Cancel();
12+
return Task.CompletedTask;
13+
}
14+
#endif
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#if !NET && !NETSTANDARD2_1_OR_GREATER
2+
using System.IO;
3+
using System.Threading.Tasks;
4+
#endif
5+
6+
namespace Renci.SshNet.Abstractions
7+
{
8+
internal static class StreamExtensions
9+
{
10+
#if !NET && !NETSTANDARD2_1_OR_GREATER
11+
public static ValueTask DisposeAsync(this Stream stream)
12+
{
13+
stream.Dispose();
14+
return default;
15+
}
16+
#endif
17+
}
18+
}

src/Renci.SshNet/Security/Algorithm.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
/// <summary>
44
/// Represents the abstract base class from which all implementations of algorithms must inherit.
55
/// </summary>
6+
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
67
public abstract class Algorithm
8+
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods
79
{
810
/// <summary>
911
/// Gets the algorithm name.

src/Renci.SshNet/Security/Cryptography/DigitalSignature.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
/// <summary>
44
/// Base class for signature implementations.
55
/// </summary>
6+
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
67
public abstract class DigitalSignature
8+
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods
79
{
810
/// <summary>
911
/// Verifies the signature.

src/Renci.SshNet/Sftp/Responses/ExtendedReplies/ExtendedReplyInfo.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Renci.SshNet.Common;
2+
3+
namespace Renci.SshNet.Sftp.Responses
4+
{
5+
/// <summary>
6+
/// Extended Reply Info.
7+
/// </summary>
8+
internal interface IExtendedReplyInfo
9+
{
10+
/// <summary>
11+
/// Loads the data from the stream into the instance.
12+
/// </summary>
13+
/// <param name="stream">The stream.</param>
14+
void LoadData(SshDataStream stream);
15+
}
16+
}

src/Renci.SshNet/Sftp/Responses/ExtendedReplies/StatVfsReplyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Renci.SshNet.Sftp.Responses
44
{
5-
internal sealed class StatVfsReplyInfo : ExtendedReplyInfo
5+
internal sealed class StatVfsReplyInfo : IExtendedReplyInfo
66
{
77
public SftpFileSystemInformation Information { get; private set; }
88

9-
public override void LoadData(SshDataStream stream)
9+
public void LoadData(SshDataStream stream)
1010
{
1111
Information = new SftpFileSystemInformation(stream.ReadUInt64(), // FileSystemBlockSize
1212
stream.ReadUInt64(), // BlockSize

src/Renci.SshNet/Sftp/Responses/SftpExtendedReplyResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public SftpExtendedReplyResponse(uint protocolVersion)
1313
}
1414

1515
public T GetReply<T>()
16-
where T : ExtendedReplyInfo, new()
16+
where T : IExtendedReplyInfo, new()
1717
{
1818
var result = new T();
1919
result.LoadData(DataStream);

0 commit comments

Comments
 (0)