Skip to content

feat: add Ruby language detection (#170)#189

Open
omnipotentchaos wants to merge 6 commits into
imDarshanGK:mainfrom
omnipotentchaos:feat/add-ruby-detection
Open

feat: add Ruby language detection (#170)#189
omnipotentchaos wants to merge 6 commits into
imDarshanGK:mainfrom
omnipotentchaos:feat/add-ruby-detection

Conversation

@omnipotentchaos
Copy link
Copy Markdown

@omnipotentchaos omnipotentchaos commented May 20, 2026

Summary

This PR adds language detection support for Ruby to the explanation engine to resolve issue #170.

  • Added Ruby syntax patterns (like def, attr_accessor, require, puts, end) to LANG_SIGNATURES and its alias mappings in backend/app/services/code_assistant.py.
  • Added a RUBY_CODE snippet and a new test_explanation_ruby test case in backend/tests/test_endpoints.py to ensure it works correctly.

Fixes #170

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor

Testing

  • I ran backend tests (pytest -q)
  • I tested frontend behavior manually

Checklist

  • Code is readable and beginner-friendly
  • No fake or placeholder behavior introduced
  • Documentation updated if needed

Copilot AI review requested due to automatic review settings May 20, 2026 17:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_SIGNATURES for automatic language detection.
  • Added ruby/rb hint aliases to the detect_language hint 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.

Comment thread backend/app/services/code_assistant.py Outdated
Comment thread backend/tests/test_endpoints.py
Copy link
Copy Markdown
Owner

@imDarshanGK imDarshanGK left a comment

Choose a reason for hiding this comment

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

@omnipotentchaos, please fix the require regex and add the test without a language hint, then resolve conflicts.

omnipotentchaos and others added 3 commits May 21, 2026 15:37
Ruby Regex fix

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion

# Conflicts:
#	backend/tests/test_endpoints.py
@omnipotentchaos
Copy link
Copy Markdown
Author

@imDarshanGK Please look into it now.

Copy link
Copy Markdown
Owner

@imDarshanGK imDarshanGK left a comment

Choose a reason for hiding this comment

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

@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.

@omnipotentchaos
Copy link
Copy Markdown
Author

@imDarshanGK I have already done it. You can check the latest commit.

@omnipotentchaos
Copy link
Copy Markdown
Author

hey, @imDarshanGK . Can you please look into it and merge if everything is correct. Thanks.

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.

Add Ruby language detection to the explanation engine

3 participants