-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
11168 clean unused glossary languages #12331
11168 clean unused glossary languages #12331
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: weblate/glossary/tasks.py
Did you find this useful? React with a 👍 or 👎 |
Co-authored-by: Michal Čihař <michal@cihar.com>
@coderabbitai review |
Actions performedReview triggered.
|
WalkthroughThe changes implement a feature that automatically removes stale empty glossaries in the documentation system, enhancing content management. Additionally, a bug fix allows the use of Docker network names in automatic suggestion settings. The updates include new tests and modifications to existing methods to ensure proper functionality and maintenance of glossary entries. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Translation
participant Task
participant Database
User->>Translation: Remove translation
Translation->>Database: Log removal
Translation->>Task: Call cleanup_stale_glossaries
Task->>Database: Check for stale glossaries
Task->>Database: Remove stale glossaries
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- docs/changes.rst (1 hunks)
- weblate/api/tests.py (2 hunks)
- weblate/glossary/tasks.py (3 hunks)
- weblate/glossary/tests.py (2 hunks)
- weblate/trans/models/translation.py (2 hunks)
Additional comments not posted (9)
weblate/glossary/tasks.py (4)
22-25
: LGTM!The code changes are approved.
50-74
: LGTM!The code changes are approved.
The previous review comment suggesting the use of the
remove
method has been addressed in this implementation.
7-8
: LGTM!The code changes are approved.
13-13
: LGTM!The code changes are approved.
weblate/glossary/tests.py (1)
480-491
: LGTM!The
test_stale_glossaries_cleanup
test is well-structured and correctly verifies the functionality of thecleanup_stale_glossaries
function. It follows the AAA (Arrange-Act-Assert) pattern:
- Arrange: Records the initial count of glossary translations.
- Act: Deletes a translation and calls the
cleanup_stale_glossaries
function.- Assert: Checks if the count of glossary translations has decreased by 1.
The test uses the
assertEqual
assertion to verify the expected outcome.docs/changes.rst (1)
10-11
: This is a changelog entry describing a new feature. It does not contain any code that needs to be reviewed.weblate/trans/models/translation.py (2)
1340-1341
: Approved: Theremove
method now cleans up the translation more thoroughly.The updated
remove
method ensures the translation is deleted from both the VCS and the database. This keeps them in sync and prevents stale data.Also, invoking
cleanup_stale_glossaries
after the deletion is a good practice to remove any glossary entries that are no longer needed.Also applies to: 1372-1372
1340-1341
: Docstring update looks good.The revised docstring correctly states that the
remove
method now removes translations from both the VCS and the database.weblate/api/tests.py (1)
3298-3300
: LGTM!The changes to the
test_delete
method look good. Introducing the_translation_count
function improves the specificity of the test by excluding glossaries from the translation count.Also applies to: 3302-3302, 3313-3314
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.
docs part OK
@sourcery-ai review |
Reviewer's Guide by SourceryThis pull request implements a new feature to clean up unused glossary languages in Weblate. It introduces a new task to remove stale empty glossaries and integrates this cleanup process into existing workflows. The changes primarily affect the glossary management system, with updates to related tests and API functionality. File-Level Changes
Tips
|
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.
Hey @gersona - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12331 +/- ##
==========================================
+ Coverage 91.14% 91.20% +0.05%
==========================================
Files 596 596
Lines 60940 61067 +127
Branches 9646 6340 -3306
==========================================
+ Hits 55545 55696 +151
+ Misses 3724 3723 -1
+ Partials 1671 1648 -23
|
07efc6a
to
59b5b58
Compare
…glossary_languages
Co-authored-by: Michal Čihař <michal@cihar.com>
Proposed changes
glossary/tasks.py
to cleanup unused glossariesChecklist
Other information
Summary by Sourcery
Add a task to clean up unused glossaries and enhance the glossary synchronization process to include the deletion of empty stale glossaries. Update tests to verify the new functionality.
New Features:
glossary/tasks.py
file.Enhancements:
sync_glossary_languages
function to delete empty stale glossaries in addition to adding missing glossary languages.Tests:
weblate/glossary/tests.py
.weblate/api/tests.py
.Summary by CodeRabbit
New Features
Bug Fixes
Tests