Skip to content

Commit 7e67875

Browse files
committed
seal types not publicly instantiable (ma0053)
1 parent 38803e5 commit 7e67875

File tree

9 files changed

+20
-24
lines changed

9 files changed

+20
-24
lines changed

Directory.Packages.props

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@
99
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
1010
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
1111
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
12-
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.203" />
13-
12+
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.205" />
1413
<!-- Should stay on LTS .NET releases. -->
15-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
16-
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.6" />
17-
<PackageVersion Include="MSTest" Version="3.9.1" />
14+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
15+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.7" />
16+
<PackageVersion Include="MSTest" Version="3.9.3" />
1817
<PackageVersion Include="Moq" Version="4.20.72" />
1918
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.115" />
2019
<PackageVersion Include="PolySharp" Version="1.15.0" />
21-
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.12.0.118525" />
20+
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.13.0.120203" />
2221
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
23-
2422
<!-- Should stay on LTS .NET releases. -->
2523
<PackageVersion Include="System.Formats.Asn1" Version="8.0.2" />
26-
<PackageVersion Include="Testcontainers" Version="4.5.0" />
24+
<PackageVersion Include="Testcontainers" Version="4.6.0" />
2725
</ItemGroup>
28-
</Project>
26+
</Project>

src/Renci.SshNet/Common/PortForwardEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Renci.SshNet.Common
66
/// <summary>
77
/// Provides data for <see cref="ForwardedPort.RequestReceived"/> event.
88
/// </summary>
9-
public class PortForwardEventArgs : EventArgs
9+
public sealed class PortForwardEventArgs : EventArgs
1010
{
1111
/// <summary>
1212
/// Initializes a new instance of the <see cref="PortForwardEventArgs"/> class.

src/Renci.SshNet/Session.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Renci.SshNet
3030
/// <summary>
3131
/// Provides functionality to connect and interact with SSH server.
3232
/// </summary>
33-
public class Session : ISession
33+
public sealed class Session : ISession
3434
{
3535
internal const byte CarriageReturn = 0x0d;
3636
internal const byte LineFeed = 0x0a;
@@ -2185,7 +2185,7 @@ public void Dispose()
21852185
/// Releases unmanaged and - optionally - managed resources.
21862186
/// </summary>
21872187
/// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param>
2188-
protected virtual void Dispose(bool disposing)
2188+
private void Dispose(bool disposing)
21892189
{
21902190
if (_disposed)
21912191
{

src/Renci.SshNet/Sftp/SftpFileAttributes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Renci.SshNet.Sftp
1010
/// <summary>
1111
/// Contains SFTP file attributes.
1212
/// </summary>
13-
public class SftpFileAttributes
13+
public sealed class SftpFileAttributes
1414
{
1515
#pragma warning disable IDE1006 // Naming Styles
1616
#pragma warning disable SA1310 // Field names should not contain underscore

src/Renci.SshNet/Sftp/SftpFileStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Sftp
1616
#pragma warning disable IDE0079 // We intentionally want to suppress the below warning.
1717
[SuppressMessage("Performance", "CA1844: Provide memory-based overrides of async methods when subclassing 'Stream'", Justification = "TODO: This should be addressed in the future.")]
1818
#pragma warning restore IDE0079
19-
public class SftpFileStream : Stream
19+
public sealed class SftpFileStream : Stream
2020
{
2121
private readonly Lock _lock = new Lock();
2222
private readonly int _readBufferSize;
@@ -162,7 +162,7 @@ public override long Position
162162
/// <value>
163163
/// The operating system file handle for the file that the current <see cref="SftpFileStream"/> encapsulates.
164164
/// </value>
165-
public virtual byte[] Handle
165+
public byte[] Handle
166166
{
167167
get
168168
{

src/Renci.SshNet/Sftp/SftpFileSystemInformation.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
namespace Renci.SshNet.Sftp
44
{
55
/// <summary>
6-
/// Contains File system information exposed by [email protected] request.
6+
/// Contains file system information exposed by [email protected] request.
77
/// </summary>
8-
#pragma warning disable SA1649 // File name should match first type name
9-
public class SftpFileSystemInformation
10-
#pragma warning restore SA1649 // File name should match first type name
8+
public sealed class SftpFileSystemInformation
119
{
1210
#pragma warning disable SA1310 // Field names should not contain underscore
1311
internal const ulong SSH_FXE_STATVFS_ST_RDONLY = 0x1;

src/Renci.SshNet/Shell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Renci.SshNet
1212
/// <summary>
1313
/// Represents instance of the SSH shell object.
1414
/// </summary>
15-
public class Shell : IDisposable
15+
public sealed class Shell : IDisposable
1616
{
1717
private const int DefaultBufferSize = 1024;
1818

@@ -315,7 +315,7 @@ public void Dispose()
315315
/// Releases unmanaged and - optionally - managed resources.
316316
/// </summary>
317317
/// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param>
318-
protected virtual void Dispose(bool disposing)
318+
private void Dispose(bool disposing)
319319
{
320320
if (_disposed)
321321
{

src/Renci.SshNet/ShellStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Renci.SshNet
1717
/// <summary>
1818
/// Contains operation for working with SSH Shell.
1919
/// </summary>
20-
public class ShellStream : Stream
20+
public sealed class ShellStream : Stream
2121
{
2222
private const int DefaultBufferSize = 1024;
2323

src/Renci.SshNet/SshCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Renci.SshNet
1616
/// <summary>
1717
/// Represents an SSH command that can be executed.
1818
/// </summary>
19-
public class SshCommand : IDisposable
19+
public sealed class SshCommand : IDisposable
2020
{
2121
private readonly ISession _session;
2222
private readonly Encoding _encoding;
@@ -630,7 +630,7 @@ public void Dispose()
630630
/// Releases unmanaged and - optionally - managed resources.
631631
/// </summary>
632632
/// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param>
633-
protected virtual void Dispose(bool disposing)
633+
private void Dispose(bool disposing)
634634
{
635635
if (_isDisposed)
636636
{

0 commit comments

Comments
 (0)