Skip to content

Commit

Permalink
Remove unnecessary parenthesis from everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
DemetriouJohn committed Mar 11, 2021
1 parent 141f704 commit 3ca050f
Show file tree
Hide file tree
Showing 84 changed files with 332 additions and 332 deletions.
2 changes: 1 addition & 1 deletion src/WorkflowCore.DSL/Services/DefinitionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private void AttachOutputs(StepSourceV1 source, Type dataType, Type stepType, Wo
private void AttachOutcomes(StepSourceV1 source, Type dataType, WorkflowStep step)
{
if (!string.IsNullOrEmpty(source.NextStepId))
step.Outcomes.Add(new ValueOutcome() { ExternalNextStepId = $"{source.NextStepId}" });
step.Outcomes.Add(new ValueOutcome { ExternalNextStepId = $"{source.NextStepId}" });

var dataParameter = Expression.Parameter(dataType, "data");
var outcomeParameter = Expression.Parameter(typeof(object), "outcome");
Expand Down
14 changes: 7 additions & 7 deletions src/WorkflowCore/Models/ExecutionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ExecutionResult(object outcome)

public static ExecutionResult Outcome(object value)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = true,
OutcomeValue = value
Expand All @@ -44,7 +44,7 @@ public static ExecutionResult Outcome(object value)

public static ExecutionResult Next()
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = true,
OutcomeValue = null
Expand All @@ -53,7 +53,7 @@ public static ExecutionResult Next()

public static ExecutionResult Persist(object persistenceData)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
PersistenceData = persistenceData
Expand All @@ -62,7 +62,7 @@ public static ExecutionResult Persist(object persistenceData)

public static ExecutionResult Branch(List<object> branches, object persistenceData)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
PersistenceData = persistenceData,
Expand All @@ -72,7 +72,7 @@ public static ExecutionResult Branch(List<object> branches, object persistenceDa

public static ExecutionResult Sleep(TimeSpan duration, object persistenceData)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
SleepFor = duration,
Expand All @@ -82,7 +82,7 @@ public static ExecutionResult Sleep(TimeSpan duration, object persistenceData)

public static ExecutionResult WaitForEvent(string eventName, string eventKey, DateTime effectiveDate)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
EventName = eventName,
Expand All @@ -93,7 +93,7 @@ public static ExecutionResult WaitForEvent(string eventName, string eventKey, Da

public static ExecutionResult WaitForActivity(string activityName, object subscriptionData, DateTime effectiveDate)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
EventName = Event.EventTypeActivity,
Expand Down
30 changes: 15 additions & 15 deletions src/WorkflowCore/Models/Search/SearchFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public class ScalarFilter : SearchFilter
{
public object Value { get; set; }

public static SearchFilter Equals(Expression<Func<WorkflowSearchResult, object>> property, object value) => new ScalarFilter()
public static SearchFilter Equals(Expression<Func<WorkflowSearchResult, object>> property, object value) => new ScalarFilter
{
Property = property,
Value = value
};

public static SearchFilter Equals<T>(Expression<Func<T, object>> property, object value) => new ScalarFilter()
public static SearchFilter Equals<T>(Expression<Func<T, object>> property, object value) => new ScalarFilter
{
IsData = true,
DataType = typeof(T),
Expand All @@ -41,42 +41,42 @@ public class DateRangeFilter : SearchFilter
public DateTime? BeforeValue { get; set; }
public DateTime? AfterValue { get; set; }

public static DateRangeFilter Before(Expression<Func<WorkflowSearchResult, object>> property, DateTime value) => new DateRangeFilter()
public static DateRangeFilter Before(Expression<Func<WorkflowSearchResult, object>> property, DateTime value) => new DateRangeFilter
{
Property = property,
BeforeValue = value
};

public static DateRangeFilter After(Expression<Func<WorkflowSearchResult, object>> property, DateTime value) => new DateRangeFilter()
public static DateRangeFilter After(Expression<Func<WorkflowSearchResult, object>> property, DateTime value) => new DateRangeFilter
{
Property = property,
AfterValue = value
};

public static DateRangeFilter Between(Expression<Func<WorkflowSearchResult, object>> property, DateTime start, DateTime end) => new DateRangeFilter()
public static DateRangeFilter Between(Expression<Func<WorkflowSearchResult, object>> property, DateTime start, DateTime end) => new DateRangeFilter
{
Property = property,
BeforeValue = end,
AfterValue = start
};

public static DateRangeFilter Before<T>(Expression<Func<T, object>> property, DateTime value) => new DateRangeFilter()
public static DateRangeFilter Before<T>(Expression<Func<T, object>> property, DateTime value) => new DateRangeFilter
{
IsData = true,
DataType = typeof(T),
Property = property,
BeforeValue = value
};

public static DateRangeFilter After<T>(Expression<Func<T, object>> property, DateTime value) => new DateRangeFilter()
public static DateRangeFilter After<T>(Expression<Func<T, object>> property, DateTime value) => new DateRangeFilter
{
IsData = true,
DataType = typeof(T),
Property = property,
AfterValue = value
};

public static DateRangeFilter Between<T>(Expression<Func<T, object>> property, DateTime start, DateTime end) => new DateRangeFilter()
public static DateRangeFilter Between<T>(Expression<Func<T, object>> property, DateTime start, DateTime end) => new DateRangeFilter
{
IsData = true,
DataType = typeof(T),
Expand All @@ -91,42 +91,42 @@ public class NumericRangeFilter : SearchFilter
public double? LessValue { get; set; }
public double? GreaterValue { get; set; }

public static NumericRangeFilter LessThan(Expression<Func<WorkflowSearchResult, object>> property, double value) => new NumericRangeFilter()
public static NumericRangeFilter LessThan(Expression<Func<WorkflowSearchResult, object>> property, double value) => new NumericRangeFilter
{
Property = property,
LessValue = value
};

public static NumericRangeFilter GreaterThan(Expression<Func<WorkflowSearchResult, object>> property, double value) => new NumericRangeFilter()
public static NumericRangeFilter GreaterThan(Expression<Func<WorkflowSearchResult, object>> property, double value) => new NumericRangeFilter
{
Property = property,
GreaterValue = value
};

public static NumericRangeFilter Between(Expression<Func<WorkflowSearchResult, object>> property, double start, double end) => new NumericRangeFilter()
public static NumericRangeFilter Between(Expression<Func<WorkflowSearchResult, object>> property, double start, double end) => new NumericRangeFilter
{
Property = property,
LessValue = end,
GreaterValue = start
};

public static NumericRangeFilter LessThan<T>(Expression<Func<T, object>> property, double value) => new NumericRangeFilter()
public static NumericRangeFilter LessThan<T>(Expression<Func<T, object>> property, double value) => new NumericRangeFilter
{
IsData = true,
DataType = typeof(T),
Property = property,
LessValue = value
};

public static NumericRangeFilter GreaterThan<T>(Expression<Func<T, object>> property, double value) => new NumericRangeFilter()
public static NumericRangeFilter GreaterThan<T>(Expression<Func<T, object>> property, double value) => new NumericRangeFilter
{
IsData = true,
DataType = typeof(T),
Property = property,
GreaterValue = value
};

public static NumericRangeFilter Between<T>(Expression<Func<T, object>> property, double start, double end) => new NumericRangeFilter()
public static NumericRangeFilter Between<T>(Expression<Func<T, object>> property, double start, double end) => new NumericRangeFilter
{
IsData = true,
DataType = typeof(T),
Expand All @@ -144,7 +144,7 @@ protected StatusFilter()
Property = lambda;
}

public static StatusFilter Equals(WorkflowStatus value) => new StatusFilter()
public static StatusFilter Equals(WorkflowStatus value) => new StatusFilter
{
Value = value.ToString()
};
Expand Down
6 changes: 3 additions & 3 deletions src/WorkflowCore/Models/StepBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public Task<ExecutionResult> RunAsync(IStepExecutionContext context)

protected ExecutionResult OutcomeResult(object value)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = true,
OutcomeValue = value
Expand All @@ -24,7 +24,7 @@ protected ExecutionResult OutcomeResult(object value)

protected ExecutionResult PersistResult(object persistenceData)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
PersistenceData = persistenceData
Expand All @@ -33,7 +33,7 @@ protected ExecutionResult PersistResult(object persistenceData)

protected ExecutionResult SleepResult(object persistenceData, TimeSpan sleep)
{
return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
PersistenceData = persistenceData,
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowCore/Primitives/Foreach.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public override ExecutionResult Run(IStepExecutionContext context)
var values = Collection.Cast<object>();
if (RunParallel)
{
return ExecutionResult.Branch(new List<object>(values), new IteratorPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object>(values), new IteratorPersistenceData { ChildrenActive = true });
}
else
{
return ExecutionResult.Branch(new List<object>(new object[] { values.ElementAt(0) }), new IteratorPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object>(new object[] { values.ElementAt(0) }), new IteratorPersistenceData { ChildrenActive = true });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Primitives/If.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override ExecutionResult Run(IStepExecutionContext context)
{
if (Condition)
{
return ExecutionResult.Branch(new List<object>() { context.Item }, new ControlPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object> { context.Item }, new ControlPersistenceData { ChildrenActive = true });
}

return ExecutionResult.Next();
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Primitives/OutcomeSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override ExecutionResult Run(IStepExecutionContext context)
{
if (context.PersistenceData == null)
{
var result = ExecutionResult.Branch(new List<object>() { context.Item }, new ControlPersistenceData() { ChildrenActive = true });
var result = ExecutionResult.Branch(new List<object> { context.Item }, new ControlPersistenceData { ChildrenActive = true });
result.OutcomeValue = GetPreviousOutcome(context);
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowCore/Primitives/Recur.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public override ExecutionResult Run(IStepExecutionContext context)
return ExecutionResult.Next();
}

return new ExecutionResult()
return new ExecutionResult
{
Proceed = false,
BranchValues = new List<object>() { null },
BranchValues = new List<object> { null },
SleepFor = Interval
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowCore/Primitives/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public override ExecutionResult Run(IStepExecutionContext context)
{
if (context.PersistenceData == null)
{
return ExecutionResult.Sleep(Interval, new SchedulePersistenceData() { Elapsed = false });
return ExecutionResult.Sleep(Interval, new SchedulePersistenceData { Elapsed = false });
}

if (context.PersistenceData is SchedulePersistenceData)
{
if (!((SchedulePersistenceData)context.PersistenceData).Elapsed)
{
return ExecutionResult.Branch(new List<object>() { context.Item }, new SchedulePersistenceData() { Elapsed = true });
return ExecutionResult.Branch(new List<object> { context.Item }, new SchedulePersistenceData { Elapsed = true });
}

if (context.Workflow.IsBranchComplete(context.ExecutionPointer.Id))
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Primitives/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public override ExecutionResult Run(IStepExecutionContext context)
{
if (context.PersistenceData == null)
{
return ExecutionResult.Branch(new List<object>() { context.Item }, new ControlPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object> { context.Item }, new ControlPersistenceData { ChildrenActive = true });
}

if ((context.PersistenceData is ControlPersistenceData) && ((context.PersistenceData as ControlPersistenceData).ChildrenActive))
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Primitives/When.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override ExecutionResult Run(IStepExecutionContext context)

if (context.PersistenceData == null)
{
return ExecutionResult.Branch(new List<object>() { context.Item }, new ControlPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object> { context.Item }, new ControlPersistenceData { ChildrenActive = true });
}

if ((context.PersistenceData is ControlPersistenceData) && ((context.PersistenceData as ControlPersistenceData).ChildrenActive))
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Primitives/While.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override ExecutionResult Run(IStepExecutionContext context)
{
if (Condition)
{
return ExecutionResult.Branch(new List<object>() { context.Item }, new ControlPersistenceData() { ChildrenActive = true });
return ExecutionResult.Branch(new List<object> { context.Item }, new ControlPersistenceData { ChildrenActive = true });
}

return ExecutionResult.Next();
Expand Down
8 changes: 4 additions & 4 deletions src/WorkflowCore/Services/ActivityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<PendingActivity> GetPendingActivity(string activityName, strin
try
{
var token = Token.Create(subscription.Id, subscription.EventKey);
var result = new PendingActivity()
var result = new PendingActivity
{
Token = token.Encode(),
ActivityName = subscription.EventKey,
Expand Down Expand Up @@ -75,7 +75,7 @@ public async Task ReleaseActivityToken(string token)

public async Task SubmitActivitySuccess(string token, object result)
{
await SubmitActivityResult(token, new ActivityResult()
await SubmitActivityResult(token, new ActivityResult
{
Data = result,
Status = ActivityResult.StatusType.Success
Expand All @@ -84,7 +84,7 @@ public async Task SubmitActivitySuccess(string token, object result)

public async Task SubmitActivityFailure(string token, object result)
{
await SubmitActivityResult(token, new ActivityResult()
await SubmitActivityResult(token, new ActivityResult
{
Data = result,
Status = ActivityResult.StatusType.Fail
Expand Down Expand Up @@ -120,7 +120,7 @@ public string Encode()

public static Token Create(string subscriptionId, string activityName)
{
return new Token()
return new Token
{
SubscriptionId = subscriptionId,
ActivityName = activityName,
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Services/BackgroundTasks/EventConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected override async Task ProcessItem(string itemId, CancellationToken cance
await _eventRepository.MarkEventProcessed(itemId);
return;
}
subs = new List<EventSubscription>() { activity };
subs = new List<EventSubscription> { activity };
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace WorkflowCore.Services
public class SingleNodeQueueProvider : IQueueProvider
{

private readonly Dictionary<QueueType, BlockingCollection<string>> _queues = new Dictionary<QueueType, BlockingCollection<string>>()
private readonly Dictionary<QueueType, BlockingCollection<string>> _queues = new Dictionary<QueueType, BlockingCollection<string>>
{
[QueueType.Workflow] = new BlockingCollection<string>(),
[QueueType.Event] = new BlockingCollection<string>(),
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowCore/Services/ErrorHandlers/SuspendHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public SuspendHandler(ILifeCycleEventPublisher eventPublisher, IDateTimeProvider
public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue<ExecutionPointer> bubbleUpQueue)
{
workflow.Status = WorkflowStatus.Suspended;
_eventPublisher.PublishNotification(new WorkflowSuspended()
_eventPublisher.PublishNotification(new WorkflowSuspended
{
EventTimeUtc = _datetimeProvider.UtcNow,
Reference = workflow.Reference,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public TerminateHandler(ILifeCycleEventPublisher eventPublisher, IDateTimeProvid
public void Handle(WorkflowInstance workflow, WorkflowDefinition def, ExecutionPointer pointer, WorkflowStep step, Exception exception, Queue<ExecutionPointer> bubbleUpQueue)
{
workflow.Status = WorkflowStatus.Terminated;
_eventPublisher.PublishNotification(new WorkflowTerminated()
_eventPublisher.PublishNotification(new WorkflowTerminated
{
EventTimeUtc = _datetimeProvider.UtcNow,
Reference = workflow.Reference,
Expand Down
Loading

0 comments on commit 3ca050f

Please sign in to comment.