Skip to content

Commit

Permalink
Fix Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Waescher, Andreas committed Jul 2, 2021
1 parent c19b053 commit 59f493a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion RepoZ.Api.Common/Git/DefaultRepositoryIgnoreStore.cs
Expand Up @@ -12,7 +12,7 @@ public class DefaultRepositoryIgnoreStore : FileRepositoryStore, IRepositoryIgno
{
private List<string> _ignores = null;
private IEnumerable<IgnoreRule> _rules;
private object _lock = new object();
private readonly object _lock = new object();

public DefaultRepositoryIgnoreStore(IErrorHandler errorHandler, IAppDataPathProvider appDataPathProvider)
: base(errorHandler)
Expand Down
3 changes: 1 addition & 2 deletions RepoZ.Api.Common/Git/DefaultRepositoryWriter.cs
Expand Up @@ -21,7 +21,6 @@ public bool Checkout(Api.Git.Repository repository, string branchName)
{
using (var repo = new LibGit2Sharp.Repository(repository.Path))
{
string realBranchName = branchName;
Branch branch;

// Check if local branch exists
Expand All @@ -37,7 +36,7 @@ public bool Checkout(Api.Git.Repository repository, string branchName)
if (upstreamBranch is null)
return false;

branch = repo.CreateBranch(branchName, upstreamBranch.Tip);
_ = repo.CreateBranch(branchName, upstreamBranch.Tip);
this.SetUpstream(repository, branchName, upstreamBranch.FriendlyName);

branch = Commands.Checkout(repo, branchName);
Expand Down
2 changes: 1 addition & 1 deletion RepoZ.Api.Common/Git/FileRepositoryStore.cs
Expand Up @@ -13,7 +13,7 @@ public abstract class FileRepositoryStore : IRepositoryStore
{
private readonly IErrorHandler _errorHandler;

public FileRepositoryStore(IErrorHandler errorHandler)
protected FileRepositoryStore(IErrorHandler errorHandler)
{
_errorHandler = errorHandler;
}
Expand Down
2 changes: 1 addition & 1 deletion RepoZ.Api.Common/Git/IgnoreRule.cs
Expand Up @@ -4,7 +4,7 @@ namespace RepoZ.Api.Common.Git
{
public class IgnoreRule
{
private Func<string, bool> _comparer;
private readonly Func<string, bool> _comparer;

public IgnoreRule(string pattern)
{
Expand Down
Expand Up @@ -103,12 +103,6 @@ private void RedirectStderr(ProcessStartInfo startInfo)
startInfo.StandardErrorEncoding = _encoding;
}

private void RedirectStdin(ProcessStartInfo startInfo)
{
startInfo.RedirectStandardInput = true;
// there is no StandardInputEncoding property, use extension method StreamWriter.WithEncoding instead
}

protected virtual string Start(Api.Git.Repository repository, string[] command, Action<ProcessStartInfo> initialize)
{
var timeout = (int)TimeSpan.FromSeconds(10).TotalMilliseconds;
Expand Down
2 changes: 1 addition & 1 deletion RepoZ.Api/Git/RepositoryViewExtensions.cs
Expand Up @@ -39,7 +39,7 @@ private static bool MatchesFilter(IRepositoryView repositoryView, string filter,
if (useRegex)
return Regex.IsMatch(filterProperty, filter, RegexOptions.IgnoreCase);

return filterProperty.IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1;
return filterProperty?.IndexOf(filter, StringComparison.OrdinalIgnoreCase) > -1;
}
}
}

0 comments on commit 59f493a

Please sign in to comment.