Files
lvgl/.github/copilot-instructions.md
VIFEX 50e2852624
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify GDB constants are up-to-date / verify-gdb-consts (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build Docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
ci(review): add Copilot code review instructions (#10012)
2026-04-24 13:42:38 +02:00

3.1 KiB

LVGL Code Review Instructions

LVGL is an embedded C99 graphics library for MCUs, MPUs, and simulators. Code must be portable, memory-efficient, and bare-metal safe.

Critical Issues (always flag)

  • NULL dereference: every lv_malloc/lv_realloc result must be checked
  • Buffer overflow or out-of-bounds array access
  • Memory leak: every lv_malloc needs matching lv_free on all exit paths
  • Use-after-free, uninitialized variable use
  • Integer overflow in size/coordinate calculations
  • Missing #if LV_USE_xxx / #endif guards for optional features
  • Global variables not in lv_global_t — must use LV_GLOBAL_DEFAULT()
  • Test headers included in production source (#include "lv_test_..." in src/)

Embedded Performance (flag in hot paths)

  • No heap allocation in draw loops, event handlers, timer callbacks
  • Avoid lv_obj_is_valid() in internal callbacks — walks entire object tree
  • lv_free(NULL) is safe — no redundant NULL check before it

Naming & Style

  • lv_<module>_<action>_<subject> for public API
  • ALL_CAPS for enums/defines; _t suffix for typedefs
  • 4 spaces, no tabs; function brace on new line; if/for brace on same line
  • <stdint.h> types; C files use block comments /* */ only (no //), C++ files may use //; "%" LV_PRId32 for format strings
  • File-scope variables must be static; no globals outside lv_global_t

Code Organization

  • Extract helpers when functions exceed ~50 lines, but don't over-engineer single-use helpers
  • Eliminate code duplication across branches
  • Struct layout: pointers first, then int32, then small types/bitfields (minimize padding)
  • New files follow src/misc/lv_templ.c section template
  • #if LV_USE_xxx near top, #endif /* LV_USE_xxx */ at bottom

Memory & Error Patterns

  • Prefer graceful degradation over assert for recoverable failures (e.g. cache alloc fail → log + disable, not crash)
  • LV_LOG_WARN for unexpected recoverable conditions; LV_LOG_ERROR for bugs

GPU / Draw Units

  • All vg_lite_* calls: check with LV_VG_LITE_CHECK_ERROR
  • Use current API names (vg_lite_set_path_type not deprecated variants)
  • GL state: save and restore (scissor, framebuffer binding, clear color)
  • #if LV_USE_DRAW_* guards required

PR Requirements

  • Commit: <type>(<scope>): <subject> — imperative, lowercase, no period, max 90 chars
  • Types with source code changes: fix, feat, refactor, arch, perf, style, test
  • Types without source code changes: chore, ci, docs, build
  • Exception: inline source documentation (Doxygen) uses docs even though it lives in source files
  • CI analyzes and reports patch coverage on new coverable lines
  • New features need tests; bug fixes need regression tests when feasible
  • New features and API changes should include examples in examples/
  • If lv_conf_template.h was modified, check that lv_conf_internal_gen.py was run and Kconfig updated
  • Code must be formatted with scripts/code-format.py (astyle) — flag obvious style violations
  • Doxygen /** */ with @param/@return for all public functions in .h files
  • Comments explain why, not what