Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
stylecop things
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Jul 8, 2017
1 parent a146d90 commit 884c8c6
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 62 deletions.
6 changes: 3 additions & 3 deletions GitBitter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using GitBitterLib;
using Microsoft.Practices.Unity;

class Program
public class Program
{
static void Main(string[] args)
public static void Main(string[] args)
{
GitBitterContainer.Default.RegisterType<ICloner, GitSharpCloner>();

Expand All @@ -19,7 +19,7 @@ static void Main(string[] args)
GitBitterContainer.Default.RegisterType<ICredentialManager, CredentialManagerWindows>();
GitBitterContainer.Default.RegisterType<IIniFile, IniFileWindows>();
GitBitterContainer.Default.RegisterType<IGitFilesAndFolders, GitFilesAndFoldersWindows>();
GitBitterContainer.Default.RegisterType<IGitBitterLogging, GitBitterLoggingCommandLine>();
GitBitterContainer.Default.RegisterType<IGitBitterLogging, GitBitterLoggingCommandLine>();
#endif

try
Expand Down
2 changes: 1 addition & 1 deletion GitBitterEdit/LoggingUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Threading;
using System.Windows;

public class LoggingUI: IGitBitterLogging
public class LoggingUI : IGitBitterLogging
{
private LoggingForm form = null;
private List<string> collectedLogging = null;
Expand Down
2 changes: 1 addition & 1 deletion GitBitterEdit/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private void AddPackage(RepositoryDescription repo)
var package = new Package();
package.Repository = repo.URL;
package.Folder = repo.Name;
if (!String.IsNullOrEmpty(repo.DefaultBranch))
if (!string.IsNullOrEmpty(repo.DefaultBranch))
{
package.Branch = repo.DefaultBranch;
}
Expand Down
2 changes: 1 addition & 1 deletion GitBitterEdit/RepoSelect.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void RefreshTeams()

edTeam.ItemsSource = this.repoLister.GetTeams();

if (currentSelection != "")
if (currentSelection != string.Empty)
{
var idx = edTeam.Items.IndexOf(currentSelection);
if (idx != -1)
Expand Down
20 changes: 9 additions & 11 deletions GitBitterLib/GitBitterLoggingVoid.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
namespace GitBitterLib
{
using System;
public class GitBitterLoggingVoid : IGitBitterLogging
{
public GitBitterLoggingVoid()
{
}

public class GitBitterLoggingVoid : IGitBitterLogging
{
public GitBitterLoggingVoid()
{
}

public void Add(string AMessage, LoggingLevel ALevel, string AModule)
{
}
}
public void Add(string message, LoggingLevel level, string module)
{
}
}
}
2 changes: 1 addition & 1 deletion GitBitterLib/Implementations/BitbucketLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public List<string> GetTeams()
sharpBucket = new SharpBucketV2();
if (Login())
{
var endpoint = sharpBucket.TeamsEndPoint("");
var endpoint = sharpBucket.TeamsEndPoint(string.Empty);
foreach (var team in endpoint.GetUserTeams())
{
teamnames.Add(team.username);
Expand Down
2 changes: 1 addition & 1 deletion GitBitterLib/Implementations/CredentialManagerPlainText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Credential ReadCredential(string applicationName)
var username = ini.IniReadValue(applicationName, "username");
var password = ini.IniReadValue(applicationName, "password");

if ((username == "") && (password == ""))
if ((username == string.Empty) && (password == string.Empty))
{
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions GitBitterLib/Implementations/GitBitterLoggingCommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public GitBitterLoggingCommandLine()
{
}

public void Add(string AMessage, LoggingLevel ALevel, string AModule)
public void Add(string message, LoggingLevel level, string module)
{
if (ALevel != LoggingLevel.Debugging)
if (level != LoggingLevel.Debugging)
{
Console.WriteLine("[" + AModule + "] " + AMessage);
Console.WriteLine("[" + module + "] " + message);
}
}
}
Expand Down
31 changes: 16 additions & 15 deletions GitBitterLib/Implementations/GitSharpCloner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using LibGit2Sharp.Handlers;
using Microsoft.Practices.Unity;

class HarmlessException : Exception
public class HarmlessException : Exception
{
public HarmlessException() : base("HarmlessException")
{
}
};
}

public class GitSharpCloner : ICloner
{
Expand Down Expand Up @@ -41,7 +41,7 @@ private string GetUrlForRepository(string repository)
// todo: find out why we need to do this on OSX/mono
return repository.Replace("https://", "git://git@");
#else
return repository.Replace("https://", "ssh://git@");
return repository.Replace("https://", "ssh://git@");
#endif
}
else
Expand All @@ -68,7 +68,8 @@ public Task Clone(string repository, string rootdir, string repodir, string bran
stage = "cloning";
logging.Add(stage, LoggingLevel.Info, repodir);
options.OnProgress = (logmessage) => {
options.OnProgress = (logmessage) =>
{
logging.Add(logmessage, LoggingLevel.Info, repodir);
return true;
};
Expand Down Expand Up @@ -162,6 +163,17 @@ public Task ResetAndUpdateExisting(string repository, string rootdir, string rep
return task;
}

private void MoveToOldFolder(string fullRepoPath)
{
var numberOfOldFolders = 1;
while (Directory.Exists(fullRepoPath + "." + numberOfOldFolders + ".old"))
{
numberOfOldFolders++;
}

Directory.Move(fullRepoPath, fullRepoPath + "." + numberOfOldFolders + ".old");
}

private void SetCredentialsProvider(PullOptions options, string repository)
{
if (gitConfig.UseSSH)
Expand Down Expand Up @@ -203,17 +215,6 @@ private void MoveAndReClone(string repository, string rootdir, string repodir, s
Clone(repository, rootdir, repodir, branchname).Wait();
}

private static void MoveToOldFolder(string fullRepoPath)
{
var numberOfOldFolders = 1;
while (Directory.Exists(fullRepoPath + "." + numberOfOldFolders + ".old"))
{
numberOfOldFolders++;
}

Directory.Move(fullRepoPath, fullRepoPath + "." + numberOfOldFolders + ".old");
}

private Branch GetOrCreateLocalBranch(IRepository repo, string branchname)
{
var localBranch = repo.Branches[branchname];
Expand Down
14 changes: 7 additions & 7 deletions GitBitterLib/Implementations/ParameterProcessing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ public class ParameterProcessing

private string commandStr;

private const string cmdStrAdd = "add";
private const string cmdStrDel = "del";
private const string CmdStrAdd = "add";
private const string CmdStrDel = "del";

public ParameterProcessing(string[] args)
{
Filepath = "gitbitter.json";
Command = ParameterCommand.None;
commandStr = "";
commandStr = string.Empty;

if (args.Length > 0)
{
if ((args.Length > 1) && (args[0].Equals(cmdStrAdd) || args[0].Equals(cmdStrDel)))
if ((args.Length > 1) && (args[0].Equals(CmdStrAdd) || args[0].Equals(CmdStrDel)))
{
commandStr = args[0];
CommandArg1 = args[1];
}
else if ((args.Length > 2) && (args[1].Equals(cmdStrAdd) || args[1].Equals(cmdStrDel)))
else if ((args.Length > 2) && (args[1].Equals(CmdStrAdd) || args[1].Equals(CmdStrDel)))
{
Filepath = args[0];

Expand All @@ -48,11 +48,11 @@ public ParameterProcessing(string[] args)
}
}

if (commandStr.Equals(cmdStrAdd))
if (commandStr.Equals(CmdStrAdd))
{
Command = ParameterCommand.Add;
}
else if (commandStr.Equals(cmdStrDel))
else if (commandStr.Equals(CmdStrDel))
{
Command = ParameterCommand.Del;
}
Expand Down
26 changes: 13 additions & 13 deletions GitBitterLib/Interfaces/ICloner.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
namespace GitBitterLib
{
using System;
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;

public class ClonerException : Exception
{
public string Activity { get; set; }
public class ClonerException : Exception
{
public string Activity { get; set; }

public string Folder { get; set; }
public string Folder { get; set; }

public ClonerException(Exception exception, string folder, string url, string activity) :
base("[" + folder + " (" + url + ")] While performing " + activity + ", this except was thrown: " + exception.Message, exception)
{
Folder = folder;
Activity = activity;
}
}
public ClonerException(Exception exception, string folder, string url, string activity) :
base("[" + folder + " (" + url + ")] While performing " + activity + ", this except was thrown: " + exception.Message, exception)
{
Folder = folder;
Activity = activity;
}
}

public interface ICloner
{
Expand Down
4 changes: 2 additions & 2 deletions GitBitterLib/Interfaces/IGitBitterLogging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ public enum LoggingLevel
Error = 1,
Info = 2,
Debugging = 3
};
}

public interface IGitBitterLogging
{
void Add(string AMessage, LoggingLevel ALevel, string AModule);
void Add(string message, LoggingLevel level, string module);
}
}
6 changes: 3 additions & 3 deletions GitBitterLib/PromptCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public PromptCredentials()
{
}

public PromptCredentials(SecureString UserName, SecureString Password)
public PromptCredentials(SecureString username, SecureString password)
{
this.UserName = UserName;
this.Password = Password;
this.UserName = username;
this.Password = password;
}
}
}

0 comments on commit 884c8c6

Please sign in to comment.