Skip to content
Merged
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -620,12 +620,21 @@ dotnet_diagnostic.MA0112.severity = warning
# MA0165: Make interpolated string
dotnet_diagnostic.MA0165.severity = none

# MA0173 - Use LazyInitializer.EnsureInitialize
dotnet_diagnostic.MA0173.severity = none

# MA0182: Avoid unused internal types
dotnet_diagnostic.MA0182.severity = none

# MA0184: Do not use interpolated string without parameters
dotnet_diagnostic.MA0184.severity = none

# MA0190 - Use partial property instead of partial method for GeneratedRegex
dotnet_diagnostic.MA0190.severity = none

# MA0192 - Use HasFlag instead of bitwise checks
dotnet_diagnostic.MA0192.severity = none

#### MSTest rules ####

# MSTEST0015: Test method should not be ignored
Expand Down
24 changes: 12 additions & 12 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.1" />
<PackageVersion Include="Meziantou.Analyzer" Version="3.0.18" />
<PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="coverlet.msbuild" Version="10.0.1" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.4" />
<PackageVersion Include="Meziantou.Analyzer" Version="3.0.114" />
<!-- Should stay on LTS .NET releases. -->
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="10.0.3" />
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
<PackageVersion Include="MSTest" Version="4.1.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.9" />
<PackageVersion Include="MSTest" Version="4.2.3" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.9.50" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.20.0.135146" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.10.85" />
<PackageVersion Include="PolySharp" Version="1.16.0" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.27.0.140913" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<!-- Should stay on LTS .NET releases. -->
<PackageVersion Include="System.Formats.Asn1" Version="10.0.3" />
<PackageVersion Include="Testcontainers" Version="4.10.0" />
<PackageVersion Include="System.Formats.Asn1" Version="10.0.9" />
<PackageVersion Include="Testcontainers" Version="4.12.0" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Renci.SshNet/Abstractions/SocketAbstraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Transport;

#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets

namespace Renci.SshNet.Abstractions
{
internal static partial class SocketAbstraction
Expand Down
1 change: 1 addition & 0 deletions src/Renci.SshNet/Connection/HttpConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace Renci.SshNet.Connection
/// </item>
/// </list>
/// </remarks>
#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets
internal sealed partial class HttpConnector : ProxyConnector
{
private const string HttpResponsePattern = @"HTTP/(?<version>\d[.]\d) (?<statusCode>\d{3}) (?<reasonPhrase>.+)$";
Expand Down
1 change: 1 addition & 0 deletions src/Renci.SshNet/Connection/ProtocolVersionExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Renci.SshNet.Connection
/// <remarks>
/// https://tools.ietf.org/html/rfc4253#section-4.2.
/// </remarks>
#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets
internal sealed partial class ProtocolVersionExchange : IProtocolVersionExchange
{
private const byte Null = 0x00;
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/ForwardedPortLocal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Renci.SshNet
/// <summary>
/// Provides functionality for local port forwarding.
/// </summary>
public partial class ForwardedPortLocal : ForwardedPort
public class ForwardedPortLocal : ForwardedPort
{
private ForwardedPortStatus _status;
private bool _isDisposed;
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/IServiceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Renci.SshNet
/// <summary>
/// Factory for creating new services.
/// </summary>
internal partial interface IServiceFactory
internal interface IServiceFactory
{
/// <summary>
/// Creates an <see cref="IClientAuthentication"/>.
Expand Down
6 changes: 4 additions & 2 deletions src/Renci.SshNet/Netconf/NetConfSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

using Renci.SshNet.Common;

#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets

namespace Renci.SshNet.NetConf
{
internal sealed partial class NetConfSession : SubsystemSession, INetConfSession
Expand Down Expand Up @@ -129,7 +131,7 @@ protected override void OnDataReceived(ArraySegment<byte> data)
{
_ = _data.Append(chunk);

if (!chunk.Contains(Prompt))
if (!chunk.Contains(Prompt, StringComparison.Ordinal))
{
return;
}
Expand Down Expand Up @@ -194,7 +196,7 @@ protected override void OnDataReceived(ArraySegment<byte> data)
{
_ = _data.Append(chunk);

if (!chunk.Contains(Prompt))
if (!chunk.Contains(Prompt, StringComparison.Ordinal))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Key Parse()
throw new SshException("Invalid passphrase.");
}

if (keyType.Contains("rsa"))
if (keyType.Contains("rsa", StringComparison.Ordinal))
{
var exponent = ReadBigIntWithBits(keyReader);
var d = ReadBigIntWithBits(keyReader);
Expand Down
1 change: 1 addition & 0 deletions src/Renci.SshNet/ScpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace Renci.SshNet
/// </list>
/// </para>
/// </remarks>
#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets
public partial class ScpClient : BaseClient
{
private const string FileInfoPattern = @"C(?<mode>\d{4}) (?<length>\d+) (?<filename>.+)";
Expand Down
2 changes: 1 addition & 1 deletion src/Renci.SshNet/ServiceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Renci.SshNet
/// <summary>
/// Basic factory for creating new services.
/// </summary>
internal sealed partial class ServiceFactory : IServiceFactory
internal sealed class ServiceFactory : IServiceFactory
{
/// <summary>
/// Defines the number of times an authentication attempt with any given <see cref="IAuthenticationMethod"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
/// Provides SCP client functionality.
/// </summary>
[TestClass]
public partial class ScpClientTest : IntegrationTestBase
public class ScpClientTest : IntegrationTestBase
{
[TestMethod]
[TestCategory("Scp")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides functionality for local port forwarding
/// </summary>
[TestClass]
public partial class ForwardedPortLocalTest : TestBase
public class ForwardedPortLocalTest : TestBase
{
[TestMethod]
public void ConstructorShouldThrowArgumentNullExceptionWhenBoundHostIsNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides functionality for remote port forwarding
/// </summary>
[TestClass]
public partial class ForwardedPortRemoteTest : TestBase
public class ForwardedPortRemoteTest : TestBase
{
[TestMethod]
public void Start_NotAddedToClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides functionality to perform keyboard interactive authentication.
/// </summary>
[TestClass]
public partial class KeyboardInteractiveAuthenticationMethodTest : TestBase
public class KeyboardInteractiveAuthenticationMethodTest : TestBase
{
[TestMethod]
public void Keyboard_Test_Pass_Null()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides functionality to perform password authentication.
/// </summary>
[TestClass]
public partial class PasswordAuthenticationMethodTest : TestBase
public class PasswordAuthenticationMethodTest : TestBase
{
[TestMethod]
public void Password_Test_Pass_Null_Username()
Expand Down
2 changes: 1 addition & 1 deletion test/Renci.SshNet.Tests/Classes/ScpClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides SCP client functionality.
/// </summary>
[TestClass]
public partial class ScpClientTest : TestBase
public class ScpClientTest : TestBase
{
private Random _random;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void CertificateBadCASignature_VerifySignatureReturnsFalse()
"PD7/nXcyxnY3zALlPQTxb19EVx5lz58BS96gg=";

char[] chars = goodCertString.ToCharArray();
chars[^10] = 'a';
chars[chars.Length - 10] = 'a';
string badCertString = new string(chars);

Assert.IsTrue(VerifySignature(goodCertString));
Expand Down
2 changes: 1 addition & 1 deletion test/Renci.SshNet.Tests/Classes/SessionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Renci.SshNet.Tests.Classes
/// Provides functionality to connect and interact with SSH server.
/// </summary>
[TestClass]
public partial class SessionTest : TestBase
public class SessionTest : TestBase
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISocketFactory> _socketFactoryMock;
Expand Down
2 changes: 1 addition & 1 deletion test/Renci.SshNet.Tests/Classes/SshCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
/// Represents SSH command that can be executed.
/// </summary>
[TestClass]
public partial class SshCommandTest : TestBase
public class SshCommandTest : TestBase
{
[TestMethod]
public void Test_Execute_SingleCommand_Without_Connecting()
Expand Down

This file was deleted.

This file was deleted.