Skip to content
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

Add BitBake grammar and missing extensions #6665

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

ParksProjets
Copy link
Contributor

@ParksProjets ParksProjets commented Jan 2, 2024

Description

The BitBake language is a metadata language created for the Yocto project. Support in linguist was added in 2014 (PR #1129), but at the time only to solve conflicts with BlitzBasic. Only the .bb extension was implemented without any grammar.

The Yocto project now has an official VSCode extension which includes a TextMate grammar. This PR adds the BitBake grammar from this repository (MIT License).

This PR also adds the following file extensions for the BitBake language:

  • .bbappend
  • .bbclass
  • .conf
  • .inc

The two first extensions are pretty unique so no heuristics was needed. For .conf, I added it to generic.yml because a lot of Linux configuration files are using it (and are not BitBake). I tried to make heuristics that match BitBake specific assignments (e.g., A += ...) which are usually not present in generic conf files. Concerning .inc, there are many languages having this extension so making the heuristics was tricky. The current heuristics is a bit too restrictive (that's why I have added two .inc sample files), but still matches the majority (~ 95%) of BitBake .inc files in my experiments.

Finally, I fixed the .bb heuristics to reduce BlitzBasic misclassification. In my experiments, the error rate was less than 1%.

I made may experiments using the following repositories:

Checklist:

@ParksProjets ParksProjets requested a review from a team as a code owner January 2, 2024 20:29
lib/linguist/heuristics.yml Outdated Show resolved Hide resolved
lib/linguist/heuristics.yml Outdated Show resolved Hide resolved
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

Note: this PR will not be merged until close to when the next release is made. See here for more details.

@lildude lildude added this pull request to the merge queue Mar 8, 2024
Merged via the queue into github-linguist:master with commit d54d037 Mar 8, 2024
5 checks passed
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants