Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXDRIVE-2925: Ignore zero-byte files #5372

Merged
merged 5 commits into from
Nov 11, 2024

Conversation

gitofanindya
Copy link
Collaborator

@gitofanindya gitofanindya commented Oct 23, 2024

Summary by Sourcery

Bug Fixes:

  • Ignore zero-byte files when processing additional local paths to prevent unnecessary operations.

Copy link
Contributor

sourcery-ai bot commented Oct 23, 2024

Reviewer's Guide by Sourcery

This pull request implements a change to ignore zero-byte files when processing additional local paths in the folders dialog. The modification affects both directory and file handling, ensuring that files with no content are not added to the paths dictionary.

Sequence diagram for processing additional local paths

sequenceDiagram
    participant User
    participant FoldersDialog
    participant FileSystem

    User->>FoldersDialog: Initiate path processing
    FoldersDialog->>FileSystem: Check if path is directory
    alt Path is a directory
        FileSystem-->>FoldersDialog: Return list of files
        loop For each file in directory
            FoldersDialog->>FileSystem: Get file size
            alt File size is zero
                FoldersDialog-->>FoldersDialog: Ignore file
            else File size is greater than zero
                FoldersDialog-->>FoldersDialog: Add file to paths
            end
        end
    else Path is a file
        FoldersDialog->>FileSystem: Get file size
        alt File size is zero
            FoldersDialog-->>FoldersDialog: Ignore file
        else File size is greater than zero
            FoldersDialog-->>FoldersDialog: Add file to paths
        end
    end
Loading

File-Level Changes

Change Details Files
Implement logic to ignore zero-byte files
  • Add a check for file size before adding to paths dictionary
  • Skip files with zero bytes (continue to next iteration)
  • Separate file size calculation from dictionary assignment
nxdrive/gui/folders_dialog.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gitofanindya - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why zero-byte files are being ignored. This will help future maintainers understand the rationale behind this decision.
  • The logic for checking and ignoring zero-byte files is duplicated for both directory and file cases. Consider extracting this into a separate function to improve code maintainability and reduce duplication.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

nxdrive/gui/folders_dialog.py Outdated Show resolved Hide resolved
nxdrive/gui/folders_dialog.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 52.08%. Comparing base (74fc14e) to head (5d76d09).
Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
nxdrive/gui/folders_dialog.py 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5372      +/-   ##
==========================================
+ Coverage   49.24%   52.08%   +2.84%     
==========================================
  Files          94       96       +2     
  Lines       15699    16094     +395     
==========================================
+ Hits         7731     8383     +652     
+ Misses       7968     7711     -257     
Flag Coverage Δ
functional 42.87% <12.50%> (+4.80%) ⬆️
integration 2.01% <0.00%> (-0.06%) ⬇️
unit 40.51% <12.50%> (+2.94%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@mr-shekhar mr-shekhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@gitofanindya gitofanindya merged commit c0fac40 into master Nov 11, 2024
20 of 21 checks passed
@gitofanindya gitofanindya deleted the wip-NXDRIVE-2925-ignore-zero-byte-files branch November 11, 2024 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants