-
Notifications
You must be signed in to change notification settings - Fork 53
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-2844: Nuxeo Drive transfer failed after removing hardware (Sourcery refactored) #4024
Conversation
Sourcery AI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## wip-NXDRIVE-2844-Nuxeo-Drive-transfer-failed-after-removing-hardware #4024 +/- ##
========================================================================================================
- Coverage 47.23% 47.23% -0.01%
========================================================================================================
Files 93 93
Lines 15645 15638 -7
========================================================================================================
- Hits 7390 7386 -4
+ Misses 8255 8252 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
f741570
to
86d2d68
Compare
0e098df
to
365477b
Compare
365477b
to
acfa69a
Compare
if should_ignore(event): | ||
# The event will not be sent if None is returned | ||
return None | ||
|
||
return event | ||
return None if should_ignore(event) else event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function before_send
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
This removes the following comments ( why? ):
# The event will not be sent if None is returned
state = self.dao.get_state_from_id(item.id) | ||
if state: | ||
if state := self.dao.get_state_from_id(item.id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Processor._get_next_doc_pair
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
self.dao.remove_filter( | ||
doc_pair.remote_parent_path + "/" + doc_pair.remote_ref | ||
) | ||
self.dao.remove_filter(f"{doc_pair.remote_parent_path}/{doc_pair.remote_ref}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Processor._execute
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
) - Swap if/else branches (
swap-if-else-branches
) - Remove unnecessary else after guard condition (
remove-unnecessary-else
)
if WINDOWS: | ||
path = doc_pair.local_path | ||
else: | ||
# The path retrieved from the database will have its starting slash trimmed, restore it | ||
path = Path(f"/{doc_pair.local_path}") | ||
|
||
path = doc_pair.local_path if WINDOWS else Path(f"/{doc_pair.local_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Processor._synchronize_direct_transfer
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
This removes the following comments ( why? ):
# The path retrieved from the database will have its starting slash trimmed, restore it
# Update session then handle the status | ||
session = self.dao.get_session(doc_pair.session) | ||
if session: | ||
if session := self.dao.get_session(doc_pair.session): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Processor._direct_transfer_end
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
This removes the following comments ( why? ):
# Update session then handle the status
modified = self.dao.get_state_from_local(doc_pair.local_path) | ||
if modified: | ||
if modified := self.dao.get_state_from_local(doc_pair.local_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Processor._synchronize_if_not_remotely_dirty
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
Pull Request #4023 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
wip-NXDRIVE-2844-Nuxeo-Drive-transfer-failed-after-removing-hardware
branch, then run:Help us improve this pull request!