Skip to content

Commit

Permalink
Marked non-extensible classes as sealed
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Aug 7, 2013
1 parent e02eef9 commit 88b4c1b
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 30 deletions.
16 changes: 1 addition & 15 deletions LibGit2Sharp.Tests/MetaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ namespace LibGit2Sharp.Tests
{
public class MetaFixture
{
private static readonly Type[] excludedTypes = new[]
{
typeof(CheckoutOptions),
typeof(CommitFilter),
typeof(CommitRewriteInfo),
typeof(CompareOptions),
typeof(Credentials),
typeof(ExplicitPathsOptions),
typeof(ObjectId),
typeof(Repository),
typeof(RepositoryOptions),
typeof(Signature),
};

// Related to https://github.com/libgit2/libgit2sharp/pull/251
[Fact]
public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplPattern()
Expand Down Expand Up @@ -71,7 +57,7 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
var nonTestableTypes = new Dictionary<Type, IEnumerable<string>>();

IEnumerable<Type> libGit2SharpTypes = Assembly.GetAssembly(typeof(Repository)).GetExportedTypes()
.Where(t => !excludedTypes.Contains(t) && t.Namespace == typeof(Repository).Namespace && !t.IsSubclassOf(typeof(Delegate)));
.Where(t => !t.IsSealed && t.Namespace == typeof(Repository).Namespace);

foreach (Type type in libGit2SharpTypes)
{
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/CheckoutOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace LibGit2Sharp
/// <summary>
/// Collection of parameters controlling Checkout behavior.
/// </summary>
public class CheckoutOptions
public sealed class CheckoutOptions
{
/// <summary>
/// Options controlling checkout behavior.
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/CommitFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace LibGit2Sharp
/// <summary>
/// Criterias used to filter out and order the commits of the repository when querying its history.
/// </summary>
public class CommitFilter
public sealed class CommitFilter
{
/// <summary>
/// Initializes a new instance of <see cref="CommitFilter"/>.
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/CommitRewriteInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace LibGit2Sharp
/// <summary>
/// Commit metadata when rewriting history
/// </summary>
public class CommitRewriteInfo
public sealed class CommitRewriteInfo
{
/// <summary>
/// The author to be used for the new commit
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/CompareOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace LibGit2Sharp
/// <summary>
/// Options to define file comparison behavior.
/// </summary>
public class CompareOptions
public sealed class CompareOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="CompareOptions"/> class.
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Credentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Class that holds credentials for remote repository access.
/// </summary>
public class Credentials
public sealed class Credentials
{
/// <summary>
/// Username for username/password authentication (as in HTTP basic auth).
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/ExplicitPathsOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace LibGit2Sharp
/// explicit paths, and NOT pathspecs containing globs.
/// </para>
/// </summary>
public class ExplicitPathsOptions
public sealed class ExplicitPathsOptions
{
/// <summary>
/// Associated paths will be treated as explicit paths.
Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp/ObjectId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace LibGit2Sharp
/// <summary>
/// Uniquely identifies a <see cref="GitObject"/>.
/// </summary>
public class ObjectId : IEquatable<ObjectId>
public sealed class ObjectId : IEquatable<ObjectId>
{
private readonly GitOid oid;
private const int rawSize = 20;
Expand All @@ -17,7 +17,7 @@ public class ObjectId : IEquatable<ObjectId>
/// <summary>
/// Size of the string-based representation of a SHA-1.
/// </summary>
protected const int HexSize = rawSize * 2;
private const int HexSize = rawSize * 2;

private const string hexDigits = "0123456789abcdef";
private static readonly byte[] reverseHexDigits = BuildReverseHexDigits();
Expand Down Expand Up @@ -85,7 +85,7 @@ public byte[] RawId
/// <summary>
/// Gets the sha.
/// </summary>
public virtual string Sha
public string Sha
{
get { return sha; }
}
Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace LibGit2Sharp
/// A Repository is the primary interface into a git repository
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Repository : IRepository
public sealed class Repository : IRepository
{
private readonly bool isBare;
private readonly BranchCollection branches;
Expand Down Expand Up @@ -347,7 +347,7 @@ public void Dispose()
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
protected virtual void Dispose(bool disposing)
private void Dispose(bool disposing)
{
CleanupDisposableDependencies();
}
Expand Down Expand Up @@ -960,7 +960,7 @@ private IEnumerable<Commit> RetrieveParentsOfTheCommitBeingCreated(bool amendPre
/// <summary>
/// Clean the working tree by removing files that are not under version control.
/// </summary>
public virtual void RemoveUntrackedFiles()
public void RemoveUntrackedFiles()
{
var options = new GitCheckoutOpts
{
Expand Down Expand Up @@ -1036,7 +1036,7 @@ private static string ReadContentFromResource(Assembly assembly, string partialR
/// <summary>
/// Gets the references to the tips that are currently being merged.
/// </summary>
public virtual IEnumerable<MergeHead> MergeHeads
public IEnumerable<MergeHead> MergeHeads
{
get
{
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/RepositoryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Provides optional additional information to the Repository to be opened.
/// </summary>
public class RepositoryOptions
public sealed class RepositoryOptions
{
/// <summary>
/// Overrides the probed location of the working directory of a standard repository,
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace LibGit2Sharp
/// <summary>
/// A signature
/// </summary>
public class Signature : IEquatable<Signature>
public sealed class Signature : IEquatable<Signature>
{
private readonly DateTimeOffset when;
private readonly string name;
Expand Down

0 comments on commit 88b4c1b

Please sign in to comment.