Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 1476044

Browse files
Various renames for field name collisions and other common sense
1 parent 88adbf1 commit 1476044

File tree

8 files changed

+48
-44
lines changed

8 files changed

+48
-44
lines changed

src/GitHub.Api/Authentication/ICredentialManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ICredential : IDisposable
1414
interface ICredentialManager
1515
{
1616
Task<ICredential> Load(UriString host);
17-
Task Save(ICredential credential);
17+
Task Save(ICredential cred);
1818
Task Delete(UriString host);
1919
bool HasCredentials();
2020
ICredential CachedCredentials { get; }

src/GitHub.Api/Git/GitCredentialManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ public async Task<ICredential> Load(UriString host)
9797
return credential;
9898
}
9999

100-
public async Task Save(ICredential credential)
100+
public async Task Save(ICredential cred)
101101
{
102-
Logger.Trace("Save: {0}", credential.Host);
102+
this.credential = cred;
103103

104-
this.credential = credential;
104+
Logger.Trace("Save: {0}", credential.Host);
105105

106106
if (!await LoadCredentialHelper())
107107
return;

src/GitHub.Api/IO/FileSystem.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@ public FileSystem()
1414
{
1515
}
1616

17-
public FileSystem(string currentDirectory)
17+
/// <summary>
18+
/// Initialize the filesystem object with the path passed in set as the current directory
19+
/// </summary>
20+
/// <param name="directory">Current directory</param>
21+
public FileSystem(string directory)
1822
{
19-
this.currentDirectory = currentDirectory;
23+
this.currentDirectory = directory;
2024
}
2125

22-
public void SetCurrentDirectory(string currentDirectory)
26+
public void SetCurrentDirectory(string directory)
2327
{
24-
Debug.Assert(Path.IsPathRooted(currentDirectory));
25-
this.currentDirectory = currentDirectory;
28+
Debug.Assert(Path.IsPathRooted(directory));
29+
this.currentDirectory = directory;
2630
}
2731

2832
public bool FileExists(string filename)

src/GitHub.Api/NewTaskSystem/ConcurrentExclusiveInterleave.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ protected override IEnumerable<Task> GetScheduledTasks()
391391
/// <param name="task">The task to be executed.</param>
392392
internal void ExecuteTask(Task task)
393393
{
394-
var processingTaskOnCurrentThread = this.processingTaskOnCurrentThread.Value;
395-
if (!processingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = true;
394+
var isProcessingTaskOnCurrentThread = this.processingTaskOnCurrentThread.Value;
395+
if (!isProcessingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = true;
396396
//try
397397
//{
398398
TryExecuteTask(task);
@@ -403,7 +403,7 @@ internal void ExecuteTask(Task task)
403403
// throw;
404404
//}
405405

406-
if (!processingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = false;
406+
if (!isProcessingTaskOnCurrentThread) this.processingTaskOnCurrentThread.Value = false;
407407
}
408408

409409
/// <summary>Gets the maximum concurrency level this scheduler is able to support.</summary>

src/GitHub.Api/NewTaskSystem/TaskBase.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface ITask : IAsyncResult
1010
ITask Catch(Action<Exception> handler);
1111
ITask Catch(Func<Exception, bool> handler);
1212
ITask Finally(Action handler);
13-
ITask Finally(Action<bool, Exception> continuation, TaskAffinity affinity = TaskAffinity.Concurrent);
13+
ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity = TaskAffinity.Concurrent);
1414
ITask Defer<T>(Func<T, Task> continueWith, TaskAffinity affinity = TaskAffinity.Concurrent, bool always = false);
1515
ITask Start();
1616
ITask Start(TaskScheduler scheduler);
@@ -157,22 +157,22 @@ public ITask Finally(Action handler)
157157
return this;
158158
}
159159

160-
public ITask Finally(Action<bool, Exception> continuation, TaskAffinity affinity = TaskAffinity.Concurrent)
160+
public ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity = TaskAffinity.Concurrent)
161161
{
162-
Guard.ArgumentNotNull(continuation, "continuation");
163-
var ret = Then(new ActionTask(Token, continuation) { Affinity = affinity, Name = "Finally" }, true);
162+
Guard.ArgumentNotNull(actionToContinueWith, nameof(actionToContinueWith));
163+
var ret = Then(new ActionTask(Token, actionToContinueWith) { Affinity = affinity, Name = "Finally" }, true);
164164
DependsOn?.SetFaultHandler(ret);
165165
ret.ContinuationIsFinally = true;
166166
return ret;
167167
}
168168

169-
internal virtual ITask Finally<T>(T continuation)
169+
internal virtual ITask Finally<T>(T taskToContinueWith)
170170
where T : TaskBase
171171
{
172-
Guard.ArgumentNotNull(continuation, "continuation");
172+
Guard.ArgumentNotNull(taskToContinueWith, nameof(taskToContinueWith));
173+
continuation = (TaskBase)(object)taskToContinueWith;
174+
continuationAlways = true;
173175
continuation.SetDependsOn(this);
174-
this.continuation = (TaskBase)(object)continuation;
175-
this.continuationAlways = true;
176176
DependsOn?.SetFaultHandler((TaskBase)(object)continuation);
177177
return continuation;
178178
}

src/GitHub.Api/Platform/Settings.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ public override void Rename(string oldKey, string newKey)
111111
SaveToCache(cachePath);
112112
}
113113

114-
private void LoadFromCache(string cachePath)
114+
private void LoadFromCache(string path)
115115
{
116-
logger.Trace("LoadFromCache: {0}", cachePath);
116+
logger.Trace("LoadFromCache: {0}", path);
117117

118-
EnsureCachePath(cachePath);
118+
EnsureCachePath(path);
119119

120-
if (!fileExists(cachePath))
120+
if (!fileExists(path))
121121
return;
122122

123-
var data = readAllText(cachePath, Encoding.UTF8);
123+
var data = readAllText(path, Encoding.UTF8);
124124

125125
try
126126
{
@@ -135,21 +135,21 @@ private void LoadFromCache(string cachePath)
135135
if (cacheData == null)
136136
{
137137
// cache is corrupt, remove
138-
fileDelete(cachePath);
138+
fileDelete(path);
139139
return;
140140
}
141141
}
142142

143-
private bool SaveToCache(string cachePath)
143+
private bool SaveToCache(string path)
144144
{
145-
logger.Trace("SaveToCache: {0}", cachePath);
145+
logger.Trace("SaveToCache: {0}", path);
146146

147-
EnsureCachePath(cachePath);
147+
EnsureCachePath(path);
148148

149149
try
150150
{
151151
var data = SimpleJson.SerializeObject(cacheData);
152-
writeAllText(cachePath, data);
152+
writeAllText(path, data);
153153
}
154154
catch (Exception ex)
155155
{
@@ -160,12 +160,12 @@ private bool SaveToCache(string cachePath)
160160
return true;
161161
}
162162

163-
private void EnsureCachePath(string cachePath)
163+
private void EnsureCachePath(string path)
164164
{
165-
if (fileExists(cachePath))
165+
if (fileExists(path))
166166
return;
167167

168-
var di = Path.GetDirectoryName(cachePath);
168+
var di = Path.GetDirectoryName(path);
169169
if (!dirExists(di))
170170
dirCreate(di);
171171
}

src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ protected override void InitializeUI()
3434
{
3535
Logger.Trace("Restarted {0}", Environment.Repository);
3636
ProjectWindowInterface.Initialize(Environment.Repository);
37-
var view = Window.GetWindow();
38-
if (view != null)
39-
view.Initialize(this);
37+
var window = Window.GetWindow();
38+
if (window != null)
39+
window.Initialize(this);
4040
}
4141

4242
protected override void SetProjectToTextSerialization()

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/AuthenticationView.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AuthenticationView : Subview
2323

2424
[NonSerialized] private bool need2fa;
2525
[NonSerialized] private bool busy;
26-
[NonSerialized] private string message;
26+
[NonSerialized] private string errorMessage;
2727
[NonSerialized] private bool enterPressed;
2828
[NonSerialized] private string password = "";
2929

@@ -148,7 +148,7 @@ private void OnGUILogin()
148148
}
149149
GUILayout.EndHorizontal();
150150

151-
ShowMessage(message, Styles.ErrorLabel);
151+
ShowErrorMessage();
152152

153153
GUILayout.Space(Styles.BaseSpacing + 3);
154154

@@ -182,7 +182,7 @@ private void OnGUI2FA()
182182
GUILayout.EndHorizontal();
183183
GUILayout.Space(Styles.BaseSpacing);
184184

185-
ShowMessage(message, Styles.ErrorLabel);
185+
ShowErrorMessage();
186186

187187
GUILayout.Space(Styles.BaseSpacing);
188188

@@ -214,7 +214,7 @@ private void DoRequire2fa(string msg)
214214
Logger.Trace("Strating 2FA - Message:\"{0}\"", msg);
215215

216216
need2fa = true;
217-
message = msg;
217+
errorMessage = msg;
218218
busy = false;
219219
Redraw();
220220
}
@@ -223,7 +223,7 @@ private void DoResult(bool success, string msg)
223223
{
224224
Logger.Trace("DoResult - Success:{0} Message:\"{1}\"", success, msg);
225225

226-
message = msg;
226+
errorMessage = msg;
227227
busy = false;
228228

229229
if (success == true)
@@ -236,11 +236,11 @@ private void DoResult(bool success, string msg)
236236
}
237237
}
238238

239-
private void ShowMessage(string message, GUIStyle style)
239+
private void ShowErrorMessage()
240240
{
241-
if (message != null)
241+
if (errorMessage != null)
242242
{
243-
GUILayout.Label(message, style);
243+
GUILayout.Label(errorMessage, Styles.ErrorLabel);
244244
}
245245
}
246246
}

0 commit comments

Comments
 (0)