Add ROS Interface by jtbandes · Pull Request #7523 · github-linguist/linguist · GitHub
Skip to content

Add ROS Interface#7523

Merged
lildude merged 8 commits into
github-linguist:mainfrom
jtbandes:add-rosmsg
Aug 14, 2025
Merged

Add ROS Interface#7523
lildude merged 8 commits into
github-linguist:mainfrom
jtbandes:add-rosmsg

Conversation

@jtbandes

@jtbandes jtbandes commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

Adding a language grammar for ROS interfaces (messages, services, and actions).

Resolves #5619

image

Description

Checklist:

@jtbandes jtbandes requested a review from a team as a code owner August 11, 2025 23:40

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All three of these extensions are very generic and match a lot more non-ROS files then they do ROS based on your search queries. This will mean there's a very likely chance more files will be incorrectly classified as ROS.

IFF you can come up with a heuristic that will 100% only match ROS files, you can add the extension to generic.yml and add a heuristic - this needs to be a linear an PCRE2 compatible regex. If you can't, it's best not to add the extension and heuristic.

.msg already exists in generic.yml and already has a good regex so you only need to add a heuristic for this extension.

.action does not meet out usage requirements so I'd advise against including it at this time. User can use an override until it's popular enough for inclusion.
.msg al

@jtbandes

Copy link
Copy Markdown
Contributor Author

@jtbandes

Copy link
Copy Markdown
Contributor Author

I'm also not quite sure what is wrong with the current test failures...do I need to add more samples?

@lildude

lildude commented Aug 13, 2025

Copy link
Copy Markdown
Member

Curious what the requirements are – the one I saw in the template was "used in hundreds of repositories"?

linguist/CONTRIBUTING.md

Lines 109 to 110 in 4a1a14c

In most cases we prefer that each new file extension be in use in at least 200 unique `:user/:repo` repositories before supporting them in Linguist
(but see [#5756][] for a temporary change in the criteria).

Note the issue referenced.

I'm also not quite sure what is wrong with the current test failures...do I need to add more samples?

The failures indicate your heuristic regular expressions don't match the content of your samples. This will be because they're not valid (unescaped /). They're also vulnerable to ReDos attack. Please fix these and make your regexes PCRE2 compliant (I plan to make this a requirement soon).

@jtbandes

jtbandes commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the tips. I believe I've fixed the redos issue, although couldn't quite figure out how to get codeql up and running in my local working copy to verify, but I did check against https://makenowjust-labs.github.io/recheck/playground/. As for PCRE2 compatibility, I believe they already were and still are compatible according to https://regex101.com, but let me know if you're seeing otherwise.

@jtbandes jtbandes requested a review from lildude August 13, 2025 21:22
@jtbandes

Copy link
Copy Markdown
Contributor Author

@lildude lildude changed the title Add ROS Interface language grammar Add ROS Interface Aug 14, 2025

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks.

Important

The changes in this PR will not appear on GitHub until the next release has been made and deployed. See here for more details.

@lildude lildude added this pull request to the merge queue Aug 14, 2025
Merged via the queue into github-linguist:main with commit f7e5ac0 Aug 14, 2025
5 checks passed
@jtbandes jtbandes deleted the add-rosmsg branch August 14, 2025 17:24
JesusValeraDev pushed a commit to phel-lang/linguist that referenced this pull request Apr 18, 2026
* Add ROS Interface language grammar

* Update submodule

* update heuristics

* some test fixes

* Update submodule

* fix unescaped /, redos, and incorrect negative pattern

* update license cache

---------

Co-authored-by: Colin Seymour <colin@github.com>
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 ROS message (msg, srv, action)

2 participants