Add Ruby support to repository analysis - #97
Merged
Merged
Conversation
New tree-sitter based Ruby analyzer extracting modules, classes, methods, and singleton methods, with call relationships for inheritance, include/extend/prepend mixins, instantiation, and method calls (implicit-self, constant, and inferred receivers). Kernel/stdlib noise is pruned via curated core-method and builtin constant sets. Wired through the language whitelist, dispatcher, CLI validation, prompt code-fence map, MCP change detection, and packaging (tree-sitter-ruby dependency). Includes analyzer unit tests and a DependencyParser end-to-end test. Touched files also get the mechanical ruff cleanup the CI lint job requires (modern defaults over every changed file): import sorting, ruff format, typing modernization, logger.exception, and noqa'd intentional blanket handlers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Ruby language analyzer, closing a coverage gap:
.rbwas already inCODE_EXTENSIONSand the default include patterns, but there was no analyzer andrubywas missing from the language whitelist, so Ruby files silently produced zero components.How
New
analyzers/ruby.pyfollowing the same tree-sitter pattern as the Kotlin/PHP analyzers (#33):module,class(with superclass asbase_classes), instance methods, singleton methods (def self.x,def Foo.x,class << self), and top-level functions.initializeis registered for call resolution but not emitted as a component, mirroring the JS constructor rule.include/extend/prependmixins,Const.newinstantiation, and method calls with implicit-self, constant, and inferred receivers (x = Foo.new; x.bar). Intra-file calls resolve against a same-file symbol table; unresolved callees stay bare logical names for the global resolver.puts/each/File.read-style calls out of the graph.Registration follows the Kotlin precedent end-to-end: language whitelist, dispatcher branch + wrapper, CLI validation/repo validator, prompt code-fence map, MCP change detection, cytoscape class, entry-point/function patterns, and the
tree-sitter-rubydependency inpyproject.toml+requirements.txt.Tests
tests/test_ruby_analyzer.py(first analyzer tests in the suite): unit tests for component extraction, docstrings/parameters, and call relationships, plus aDependencyParserend-to-end test proving the whitelist/dispatcher wiring. Sanity-checked against the Logstash repo: 3,200 Ruby components extracted (previously 0), includinglogstash-core/lib,lib/pluginmanager, andx-pack.The touched files also carry the mechanical ruff cleanup the Lint job requires (it runs modern-default ruff over every changed file, same situation as before): import sorting, formatting, typing modernization,
logger.exception, and noqa'd intentional blanket handlers. No behavior changes outside the Ruby addition.