feat: add Ruby language detection (#170)#189
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Ruby language support to the backend “explanation engine” by extending the language detection heuristics and adding a new endpoint test, addressing issue #170.
Changes:
- Added Ruby regex signatures to
LANG_SIGNATURESfor automatic language detection. - Added
ruby/rbhint aliases to thedetect_languagehint mapping. - Added a Ruby code fixture and a Ruby explanation test case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| backend/app/services/code_assistant.py | Extends language detection with Ruby signatures and hint aliases. |
| backend/tests/test_endpoints.py | Adds a Ruby snippet and a new explanation endpoint test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
imDarshanGK
left a comment
There was a problem hiding this comment.
@omnipotentchaos, please fix the require regex and add the test without a language hint, then resolve conflicts.
Ruby Regex fix Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion # Conflicts: # backend/tests/test_endpoints.py
|
@imDarshanGK Please look into it now. |
imDarshanGK
left a comment
There was a problem hiding this comment.
@omnipotentchaos Please add a Ruby test that omits the language hint so it validates auto-detection from code alone. The current test only confirms the alias mapping for [language: "ruby"] and does not cover the new [LANG_SIGNATURES]behavior.
|
@imDarshanGK I have already done it. You can check the latest commit. |
|
hey, @imDarshanGK . Can you please look into it and merge if everything is correct. Thanks. |
Summary
This PR adds language detection support for Ruby to the explanation engine to resolve issue #170.
def,attr_accessor,require,puts,end) toLANG_SIGNATURESand its alias mappings inbackend/app/services/code_assistant.py.RUBY_CODEsnippet and a newtest_explanation_rubytest case inbackend/tests/test_endpoints.pyto ensure it works correctly.Fixes #170
Type of Change
Testing
pytest -q)Checklist