Skip to content

[ruby] Add Support for ERB files #5447

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AndreiDreyer
Copy link
Contributor

  • Added support for basic ERB files
  • Added templateOutRaw (<%== %>) and templateOutEscape (<%= %>) operator calls
  • Added return for the generated fmtString from the ERB processing
  • Added .html.erb files as config files

* Added tests for ERB processing

* update test expectation

* Add isLineFeed func

* removed erb config file test

* Fixed new line issues with ERB files, updated test expectations
… operators. Included explicit return for ERB file processing
@AndreiDreyer AndreiDreyer added the ruby Relates to rubysrc2cpg label Apr 23, 2025
@AndreiDreyer AndreiDreyer self-assigned this Apr 23, 2025
Copy link
Contributor

@DavidBakerEffendi DavidBakerEffendi left a comment

Choose a reason for hiding this comment

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

Nice

@maltek
Copy link
Contributor

maltek commented Apr 24, 2025

I'm still missing a lot of .erb files. E.g. for https://github.com/chatwoot/chatwoot:

ocular> cpg.file.name(".*.html.erb").size
val res18: Int = 40

ocular> cpg.configFile.name(".*.html.erb").size
val res19: Int = 88

The frontend spits out some warnings for the project, e.g. Yield expression outside of method scope: yield(:head) and Type 'String' is considered a 'core' type, not a 'Kernel-contained' type - but not enough to explain 48 missing files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Relates to rubysrc2cpg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants