Bug 13206 - Bitbake needs a lint-like tool
Summary: Bitbake needs a lint-like tool
Status: NEW
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 6.99
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-02-26 21:38 UTC by Evadeflow
Modified: 2026-08-13 15:28 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evadeflow 2019-02-26 21:38:07 UTC
I feel it would benefit the Yocto project *tremendously* to have a linter for Bitbake builds. Bitbake is quite liberal in terms of what it will permit recipe/layer authors to do. However, a set of best practices have emerged over the past several years, many of which take the form: "Avoid X." Here are a few such rules I encountered this week:

- In general, avoid override-style removal (i.e., `FOO_remove = ...`), because it's extremely difficult to undo in append recipes. If you must use this syntax, prefer the idiom`FOO_remove = ${FOO_REMOVALS}` so that appends can override the removal.

- Avoid adding extra whitespace when using += and =+
   BAD: FOO += " bar"
  OKAY: FOO += "bar"

- Avoid forgetting to add whitespace when appending via override syntax.
   BAD: FOO_append = "bar"
  OKAY: FOO_append = " bar"

My guess is that core Yocto project contributors can rattle off a few dozen rules like this off the top of their head. And I'm betting that automated checks could be written for many/most of them.
Comment 1 Randy MacLeod 2023-10-24 14:24:25 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 2 Duy Dang 2024-03-18 03:48:13 UTC
There is a python library for this purpose: https://pypi.org/project/oelint-adv/

But can we use it in bitbake or create a contrib script in poky?