Skip to content

Command Hooks fixes and Build Warnings Log context, deduplication, and filtering - #1341

Merged
mkarlesky merged 12 commits into
next_versionfrom
fix/warnings-log-and-command-hooks
Oct 15, 2026
Merged

mkarlesky merged 12 commits into
next_versionfrom
fix/warnings-log-and-command-hooks

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Refs #194.

Summary

Command Hooks

The plugin had no specs at all. This PR fixes three bugs in it and covers it with unit, integration, and system specs.

  • Empty hook arguments. :pre_compile_execute, :post_compile_execute, and :pre_runner_generate read argument-hash keys the core never sets, so their tools always received an empty ${1}. Each hook's arguments now come from one table of the keys the core builds:
    • the compile hooks pass the source file as ${1} and the object file as ${2};
    • :pre_runner_generate passes the test file, as documented.
  • Tool lists. A hook configured with a list of tools failed validation. The validator walked the list by index through the configuration walker, which can't index lists. This has been broken since 1.1.0.
  • Logging default. Hook validation added :logging to the project configuration instead of to the hook's own tool.
  • System spec. A real test:all runs every test-build hook with a recording script, checking each hook's documented argument. A clobber afterward runs no build hook, which pins Comand hooks run after every command (including module:create, clobber, clean) #194.

Build Warnings Log

  • Context. WarningCollector groups GCC and Clang diagnostics with the lines that explain them: the function or include context before a warning, and the source line, caret, and any note after it. Output in other formats is collected a line at a time, and compiler summary lines are left out.
  • Deduplication. Each distinct warning is logged once per build context. A header warning's identity leaves out its include chain, so it is logged once rather than once per including file.
  • New settings. :patterns and :excludes take regular expressions. :patterns replaces the default match of any line mentioning "warning", and :excludes drops warnings already accepted. An invalid entry stops the build, naming its setting.

Docs

  • command-hooks.md:
    • corrects the hook names and fixes the broken example YAML;
    • documents each hook's arguments;
    • notes that build hooks don't fire for non-build commands, and that a failing tool stops the build.
  • report-build-warnings-log.md: rewritten for context, deduplication, :patterns, and :excludes.
  • Changelog: 💪 Fixed entries for Command Hooks, and a 🌟 Added entry for the warnings log.

Testing

  • Unit specs: command_hooks_spec.rb is new, warning_collector_spec.rb is new, and report_build_warnings_log_spec.rb is extended.
  • Integration specs: Command Hooks runs with real tool validation and execution. Build Warnings Log runs on real gcc output with real log writing.
  • System spec: spec/system/command_hooks_spec.rb. With the old compile-hook key restored, it fails and shows the empty ${1}.
  • Results:
    • rake specs:units: 4587 examples, 0 failures.
    • rake specs:integration: 436 examples, 0 failures.
    • Lint and the strict docs build are clean.

🤖 Generated with Claude Code

mkarlesky and others added 12 commits October 15, 2026 10:06
Integration specs run Command Hooks with Ceedling's real tool validation
and execution, feeding each hook the argument hash the core builds, and
run Build Warnings Log on real gcc output with real log writing. Pending
specs record what does not work: :pre_runner_generate and the compile
hooks hand an empty argument to their tools, a hook given a list of
tools fails validation, hook validation adds :logging to the project
configuration, and warnings lose their context and repeat per file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- :pre_runner_generate and the compile hooks read argument hash keys the
  core never sets, so their tools always received an empty ${1}. Each
  hook's arguments now come from one table of the keys the core builds.
  :pre_runner_generate passes the test file, as documented, and both
  compile hooks pass the source file as ${1} and the object file as ${2}.
- A hook configured as a list of tools failed validation, which walked
  the list by index through the configuration walker. Each listed tool
  is now validated directly.
- Hook validation added :logging to the project configuration rather
  than to the hook's own tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A real test build runs every test build hook with a script recording its
arguments, checking each against the argument its documentation
promises, including the object file compile hooks pass as ${2}. A
clobber afterward runs no build hook (#194).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WarningCollector groups GCC and Clang diagnostics with the lines that
explain them: the function or include context before a warning, and the
source line, caret, and any note after it. Output in other formats is
still taken a line at a time, and compiler summary lines are left out.
The plugin keeps each distinct warning once per build context, so a
header's warning reached through every file including it is logged once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
:report_build_warnings_log ↳ :patterns replaces the default match of
any line mentioning 'warning' with configured regular expressions, and
:excludes drops warnings any of its expressions match, context included.
Both default to empty, keeping the default match. An entry that is not a
valid regular expression stops the build, naming its setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GCC reports a header's warning after a function's warning with an 'At
top level' line it leaves out when nothing came before, so the same
header warning from two files looked distinct and was logged twice.
A warning's identity now leaves out every context line before its
diagnostic line, scope as well as include chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ceedling's stopwatch is the wall clock, a Time, on Windows, so :pre_build,
:post_build, and the other timestamp hooks received a date string there
rather than a count of seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Constants defined in describe blocks land on Object, so specs sharing a name
warned of redefinition when run in one process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkarlesky
mkarlesky merged commit 53f7224 into next_version Oct 15, 2026
@mkarlesky
mkarlesky deleted the fix/warnings-log-and-command-hooks branch October 15, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant