Skip to content

Bug: Unnecessary Boolean Literal in File Overwrite Check #722

@ziagham

Description

@ziagham

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);

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions