-
Notifications
You must be signed in to change notification settings - Fork 26
Remove this unnecessary check for null. Some code paths are unreachable (Code-Cleanup) #532
Copy link
Copy link
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershacktoberfest-acceptedhelp wantedExtra attention is neededExtra attention is needed
Description
What version of FlowSynx?
1.2.1
Describe the bug
File: FlowSynx.Application/Features/WorkflowExecutions/Command/RejectWorkflow/RejectWorkflowHandler.cs lines 35-40
Currently, the code contains a redundant null check for logger and other types of instances that are unnecessary because of ArgumentNullException.ThrowIfNull(); already throws if the object is null. Some code paths after this check are effectively unreachable.
Code snippet:
ArgumentNullException.ThrowIfNull(logger);
ArgumentNullException.ThrowIfNull(manualApprovalService);
ArgumentNullException.ThrowIfNull(workflowExecutionService);
ArgumentNullException.ThrowIfNull(currentUserService);
ArgumentNullException.ThrowIfNull(localization);
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_manualApprovalService = manualApprovalService ?? throw new ArgumentNullException(nameof(manualApprovalService));
_workflowExecutionService = workflowExecutionService ?? throw new ArgumentNullException(nameof(workflowExecutionService));
_currentUserService = currentUserService ?? throw new ArgumentNullException(nameof(currentUserService));
_systemClock = systemClock ?? throw new ArgumentNullException(nameof(systemClock));
_localization = localization ?? throw new ArgumentNullException(nameof(localization));Proposed change:
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_manualApprovalService = manualApprovalService ?? throw new ArgumentNullException(nameof(manualApprovalService));
_workflowExecutionService = workflowExecutionService ?? throw new ArgumentNullException(nameof(workflowExecutionService));
_currentUserService = currentUserService ?? throw new ArgumentNullException(nameof(currentUserService));
_systemClock = systemClock ?? throw new ArgumentNullException(nameof(systemClock));
_localization = localization ?? throw new ArgumentNullException(nameof(localization));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershacktoberfest-acceptedhelp wantedExtra attention is neededExtra attention is needed