Skip to content

lint: wire SingletonElisionChecker into bash lint (warn-only) #3482

Closed

Description

@zackees

Part of #3481 (Tier 0).

Task

Register the existing SingletonElisionChecker (currently defined in ci/lint_cpp_rs/src/checkers/singleton_elision.rs, included via ci/lint_cpp_rs/src/lib.rs) into the runtime registry so bash lint executes it.

Concrete steps

  1. Add "singleton_elision" to the enabled-checkers list in ci/lint_cpp_rs/src/lint_core/processor_registry_cli.rs::create_checkers() (see line ~524 where SerialPrintfChecker is registered as the pattern).
  2. Add the checker name to the enabled list around line ~295.
  3. Emit at warn severity, not error — the migration will land incrementally, so the initial rollout must not fail CI.
  4. Provide a --include=singleton_elision opt-in flag / env variable so authors touching known-clean areas can verify their file is clean without seeing the full warn spam.

Acceptance criteria

  • bash lint reports the ~119 existing violations as warnings (not errors), listing file + line + suggested fix (wrap in fl::Singleton<T> for --gc-sections elision).
  • CI stays green.
  • The scanner Python (ci/scan_singleton_elision.py) can be marked deprecated in favor of the Rust checker output.

Reference

  • Existing checker: ci/lint_cpp_rs/src/checkers/singleton_elision.rs
  • Registration pattern: SerialPrintfChecker in processor_registry_cli.rs

Activity

  1. added
    type: feature
    priority: medium
    area: ci
    on Jul 1, 2026
  2. zackees commented on Jul 28, 2026

    @zackees
    MemberAuthor

    Investigated this and the premise no longer holds — the wiring is already done, and it isn't what's blocking the acceptance criteria.

    Steps 1 and 2 are already in place on master:

    • "singleton_elision" is in supported_checker_names() (processor_registry_cli.rs:297)
    • ("singleton_elision", Box::new(SingletonElisionChecker)) is in create_checkers() (:527)
    • fastled-lint --list-checkers lists it
    • include!("checkers/singleton_elision.rs") is in lib.rs:20

    (The PascalCase list around :365 is supported_python_checker_names() — for legacy Python checkers — so a Rust-only checker correctly does not belong there.)

    The actual blocker: the checker reports zero violations.

    $ fastled-lint --checker singleton_elision            # whole tree
    All Rust C++ linting checks passed!
    

    Not a file-selection or allowlist artifact. I narrowed it down:

    • ci/scan_singleton_elision.py reports 101 violations across 39 files on the same tree, so the violations exist.
    • The worst offender (channel_manager_esp32.cpp.hpp, 14 per the scanner) yields nothing, and it does not carry the FL_LINT_ALLOW_GLOBAL_FILE opt-out — only 2 files in src/ do.
    • A synthetic minimal case also yields nothing:
      // src/tmp_probe.cpp
      namespace fl {
      int gProbeCounter = 0;
      static bool gProbeFlag = false;
      }
    • Not a stale binary: the compiled fastled-lint.exe does contain the checker's message string (wrap in \fl::Singleton` for ...`), so the current logic is linked in.
    • Not a path/separator issue: is_under_project_subpath normalizes both sides, and explicit --project-root (relative and absolute) changes nothing.

    So SingletonElisionChecker::check_file_content is reaching its violations.push site for no input — most likely a bug in the brace-depth / namespace-stack tracking that starts the scan in a state where every line is skipped.

    Implication for this issue and #3492: "wire it in warn-only" is already satisfied mechanically, but the acceptance criterion ("bash lint reports the ~119 existing violations as warnings") cannot be met until the checker actually detects anything. #3492 (promote to hard-fail) is currently a no-op promotion — it would pass trivially and guard nothing, which is the more dangerous outcome.

    Suggest retitling this to fix SingletonElisionChecker detection (currently a silent no-op), since that is the real remaining work. Item 4 of the original scope (the --include=singleton_elision opt-in) is also already covered by the existing --checker <name> flag.

    I did not attempt the detection fix in this pass — it needs a proper Rust unit test alongside it so the checker can't silently regress to a no-op again, which is arguably the root cause here: a checker with no test asserting it finds something can be registered and look healthy while doing nothing.

  3. added a commit that references this issue on Jul 28, 2026
    e74e8d7
  4. moved this from Triage to Done in FastLED Trackeron Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cipriority: mediumtype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions