Skip to content

Commit 60aec30

Browse files
committed
oelint: Add oelint-adv lint tooling and CI gate
Add the declarative oelint-adv setup shared across the OEL layers: * .oelint.cfg pins the release (wrynose) and the only layer-wide suppression, oelint.var.bbclassextend, which never applies to a target-only layer, * oelint.constants.json declares the project distro/machine override tokens oelint cannot know when run standalone, * contrib/oelint/run-oelint.sh enumerates the recipes and runs the linter serially, * .github/workflows/oelint.yaml runs it on pull requests, merge groups and master pushes through the yocto-env.nix lint devshell. The layer lints clean, with every remaining exception documented inline as a '# nooelint: <rule.id>' comment, so the gate is blocking.
1 parent ad915b2 commit 60aec30

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/oelint.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: OE Lint
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
push:
7+
branches:
8+
- master
9+
10+
concurrency:
11+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
oelint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: ossystems/nix-actions@v1
19+
with:
20+
install-nix: true
21+
flake-check: false
22+
build-hosts: false
23+
build-devshells: false
24+
devshell: github:OSSystems/yocto-env.nix#lint
25+
run: ./contrib/oelint/run-oelint.sh

.oelint.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# oelint-adv defaults, auto-loaded from the working directory. Every recipe
2+
# here is target-only, so oelint.var.bbclassextend never applies; all other
3+
# exceptions stay inline as '# nooelint: <rule.id>' comments.
4+
[oelint]
5+
release = wrynose
6+
suppress = oelint.var.bbclassextend

contrib/oelint/run-oelint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
# Run oelint-adv over meta-shellhub. Requires oelint-adv on PATH.
3+
#
4+
# Configuration is declarative and lives at the layer root: .oelint.cfg
5+
# (--release plus the bbclassextend suppression) and oelint.constants.json
6+
# (the layer constant-DB additions). Both are auto-loaded, so this script only
7+
# enumerates the files to lint.
8+
set -eu
9+
10+
unset CDPATH
11+
12+
here=$(cd -- "$(dirname -- "$0")" && pwd)
13+
layer=$(cd -- "$here/../.." && pwd)
14+
cd -- "$layer"
15+
16+
files=$(find . \
17+
\( -name '*.bb' -o -name '*.bbappend' -o -name '*.bbclass' -o -name '*.inc' \) \
18+
| sort)
19+
20+
# Run serially: parallel workers race while loading the layer constants and
21+
# emit spurious "unknown variable/override" findings. Pass '--jobs N' to override.
22+
# shellcheck disable=SC2086
23+
exec oelint-adv --jobs 1 "$@" $files

oelint.constants.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"comment": "Layer constant DB, auto-loaded by oelint-adv from the layer root. Declares the OEL project distro/machine override tokens it cannot know about when run standalone.",
3+
"replacements": {
4+
"distros": [
5+
"oel"
6+
],
7+
"machines": [
8+
"arm"
9+
]
10+
}
11+
}

0 commit comments

Comments
 (0)