-
Notifications
You must be signed in to change notification settings - Fork 26
Bug: Unnecessary Boolean Literal in File Overwrite Check #722
Copy link
Copy link
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededrefactoringRefactoring codeRefactoring codereliability
Description
What version of FlowSynx?
1.2.4
Describe the bug
The condition uses an unnecessary Boolean literal (is false). This goes against common C# style conventions and reduces readability.
File: plugins/FlowSynx.Plugins.LocalFileSystem/Services/LocalFileManager.cs
Lines: 340 and 345
Current Code:
if (File.Exists(fullPath) && overwrite is false)
throw new ArgumentException(string.Format(Resources.FileIsAlreadyExistAndCannotBeOverwritten, fullPath));Why This Is a Problem:
Using is false adds no value and makes the intent slightly harder to read. It is recommended to use direct negation (!overwrite) instead.
Proposed Fix
Replace line 340 with:
if (File.Exists(fullPath) && !overwrite)
throw new ArgumentException(string.Format(Resources.FileIsAlreadyExistAndCannotBeOverwritten, fullPath));and replace 345 with:
if (!overwrite)
throw new ArgumentException(string.Format(Resources.FileIsAlreadyExistAndCannotBeOverwritten, fullPath));
else
DeleteEntity(new DeleteParameters { Path = fullPath }, cancellationToken);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededrefactoringRefactoring codeRefactoring codereliability