-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix:handle misc files and folder names mixed with lang folder #246
Conversation
if the resouces dir contained files or folder that aren't valid lang codes the score calculation would throw an exception
WalkthroughThe changes in this pull request primarily focus on enhancing the Changes
Possibly related PRs
Suggested reviewers
Poem
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 (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #246 +/- ##
==========================================
- Coverage 53.41% 49.15% -4.27%
==========================================
Files 37 37
Lines 4362 4360 -2
==========================================
- Hits 2330 2143 -187
- Misses 2032 2217 +185 ☔ View full report in Codecov by Sentry. |
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: 1
🧹 Outside diff range and nitpick comments (1)
ovos_workshop/resource_files.py (1)
87-97
: Improved error handling for invalid language codes. LGTM!The changes effectively address the issue of handling miscellaneous files and folder names mixed with language folders. The try-except block catches potential exceptions when calculating tag_distance, allowing the function to continue processing valid language codes.
Consider adding a debug log message when an invalid language code is encountered to help with troubleshooting:
try: score = tag_distance(lang, folder.name) except: # not a valid language code + LOG.debug(f"Skipping invalid language code: {folder.name}") continue
🧰 Tools
🪛 Ruff
90-90: Do not use bare
except
(E722)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- ovos_workshop/resource_files.py (1 hunks)
🧰 Additional context used
🪛 Ruff
ovos_workshop/resource_files.py
90-90: Do not use bare
except
(E722)
🔇 Additional comments (1)
ovos_workshop/resource_files.py (1)
87-97
: Summary: Effective solution for handling miscellaneous files and folder namesThe changes implemented in the
locate_lang_directories
function successfully address the issue of handling miscellaneous files and folder names mixed with language folders. By adding error handling for invalid language codes, the function now gracefully skips non-language folders without throwing exceptions.This improvement enhances the robustness of the resource handling system, allowing it to work correctly even when the resources directory contains files or folders that are not valid language codes.
The implementation is sound and aligns well with the PR objectives. With the minor suggestions provided earlier, this change is ready to be merged.
🧰 Tools
🪛 Ruff
90-90: Do not use bare
except
(E722)
if the resouces dir contained files or folder that aren't valid lang codes the score calculation would throw an exception
introduced in #241
Summary by CodeRabbit
Bug Fixes
New Features
resolve_resource_file
method to inform users of its new location inovos_utils.file_utils
.Documentation