Skip to content

Commit

Permalink
Merge pull request #941 from Caliburn-Micro/940-fix-code-scanning-ale…
Browse files Browse the repository at this point in the history
…rt-useless-assignment-to-local-variable

Refactor parameter names and simplify iteration
  • Loading branch information
vb2ae authored Dec 16, 2024
2 parents 664e243 + 33709af commit ad63b83
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/Caliburn.Micro.Core/ContinueResultDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ public ContinueResultDecorator(IResult result, Func<IResult> coroutine)
/// <summary>
/// Called when the execution of the decorated result has completed.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="innerResult">The decorated result.</param>
/// <param name="methodContext">The context.</param>
/// <param name="methodInnerResult">The decorated result.</param>
/// <param name="args">The <see cref="ResultCompletionEventArgs" /> instance containing the event data.</param>
protected override void OnInnerResultCompleted(CoroutineExecutionContext context, IResult innerResult, ResultCompletionEventArgs args)
protected override void OnInnerResultCompleted(CoroutineExecutionContext methodContext, IResult methodInnerResult, ResultCompletionEventArgs args)
{
if (args.Error != null || !args.WasCancelled)
{
OnCompleted(new ResultCompletionEventArgs { Error = args.Error });
}
else
{
Log.Info(string.Format("Executing coroutine because {0} was cancelled.", innerResult.GetType().Name));
Continue(context);
Log.Info(string.Format("Executing coroutine because {0} was cancelled.", methodInnerResult.GetType().Name));
Continue(methodContext);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Caliburn.Micro.Core/OverrideCancelResultDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public OverrideCancelResultDecorator(IResult result)
/// <summary>
/// Called when the execution of the decorated result has completed.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="innerResult">The decorated result.</param>
/// <param name="methodContext">The context.</param>
/// <param name="methodInnerResult">The decorated result.</param>
/// <param name="args">The <see cref="ResultCompletionEventArgs" /> instance containing the event data.</param>
protected override void OnInnerResultCompleted(CoroutineExecutionContext context, IResult innerResult, ResultCompletionEventArgs args)
protected override void OnInnerResultCompleted(CoroutineExecutionContext methodContext, IResult methodInnerResult, ResultCompletionEventArgs args)
{
if (args.WasCancelled)
{
Log.Info(string.Format("Overriding WasCancelled from {0}.", innerResult.GetType().Name));
Log.Info(string.Format("Overriding WasCancelled from {0}.", methodInnerResult.GetType().Name));
}

OnCompleted(new ResultCompletionEventArgs { Error = args.Error });
Expand Down
10 changes: 5 additions & 5 deletions src/Caliburn.Micro.Core/RescueResultDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public RescueResultDecorator(IResult result, Func<TException, IResult> coroutine
/// <summary>
/// Called when the execution of the decorated result has completed.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="innerResult">The decorated result.</param>
/// <param name="methodContext">The context.</param>
/// <param name="methodInnerResult">The decorated result.</param>
/// <param name="args">The <see cref="ResultCompletionEventArgs" /> instance containing the event data.</param>
protected override void OnInnerResultCompleted(CoroutineExecutionContext context, IResult innerResult, ResultCompletionEventArgs args)
protected override void OnInnerResultCompleted(CoroutineExecutionContext methodContext, IResult methodInnerResult, ResultCompletionEventArgs args)
{
var error = args.Error as TException;
if (error == null)
Expand All @@ -40,8 +40,8 @@ protected override void OnInnerResultCompleted(CoroutineExecutionContext context
else
{
Log.Error(error);
Log.Info(string.Format("Executing coroutine because {0} threw an exception.", innerResult.GetType().Name));
Rescue(context, error);
Log.Info(string.Format("Executing coroutine because {0} threw an exception.", methodInnerResult.GetType().Name));
Rescue(methodContext, error);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Caliburn.Micro.Core/ResultDecoratorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ private void InnerResultCompleted(object sender, ResultCompletionEventArgs args)
/// <summary>
/// Called when the execution of the decorated result has completed.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="innerResult">The decorated result.</param>
/// <param name="methodContext">The context.</param>
/// <param name="methodInnerResult">The decorated result.</param>
/// <param name="args">The <see cref="ResultCompletionEventArgs"/> instance containing the event data.</param>
protected abstract void OnInnerResultCompleted(CoroutineExecutionContext context, IResult innerResult, ResultCompletionEventArgs args);
protected abstract void OnInnerResultCompleted(CoroutineExecutionContext methodContext, IResult methodInnerResult, ResultCompletionEventArgs args);

/// <summary>
/// Occurs when execution has completed.
Expand Down
2 changes: 1 addition & 1 deletion src/Caliburn.Micro.Platform/Bind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void DataContextChanged(DependencyObject d, DependencyPropertyChangedEven
return;

var enable = d.GetValue(AtDesignTimeProperty);
if (enable == null || ((bool)enable) == false || e.NewValue == null)
if (enable == null || !((bool)enable) || e.NewValue == null)
return;

var fe = d as FrameworkElement;
Expand Down
1 change: 0 additions & 1 deletion src/Caliburn.Micro.Platform/Platforms/Maui/HttpUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public override string ToString()
if (count == 0)
return "";
StringBuilder sb = new StringBuilder();
var keys = this.Keys;
foreach (var key in this.Keys)
{
sb.AppendFormat("{0}={1}&", key, this[key]);
Expand Down

0 comments on commit ad63b83

Please sign in to comment.