Commit 8de7b5f
committed
gp-opengraph, gp-sitemap(fix[logging]): attach NullHandler + drop trailing periods
why: PR #22 code review flagged two CLAUDE.md#logging violations in the
two new packages. These are house-style invariants that every existing
workspace package (gp_sphinx, sphinx_fonts, sphinx_ux_badges, …)
already follows:
1. "Add ``NullHandler`` in library ``__init__.py`` files" (CLAUDE.md
line 553) — both new package __init__.py files declared a
module-level logger without one. Importing either package outside a
Sphinx build could surface a "no handlers could be found" warning
from stdlib logging.
2. "No trailing punctuation" in log messages (CLAUDE.md line 576) —
two log calls introduced in commit ab3a6a6 and 04f0121 ended with a
period.
what:
- packages/gp-opengraph/src/gp_opengraph/__init__.py:
* After ``logger = logging.getLogger(__name__)`` attach
``logger.addHandler(logging.NullHandler())`` to match the
sphinx-fonts pattern exactly.
* ``_warn_if_social_cards_used``: message reworded to "ogp_social_cards
ignored — gp-opengraph ships no card generator; use a static PNG
via ogp_image (site default) or per-page 'og:image' frontmatter"
(no trailing period; also trimmed the "is ignored — gp-opengraph
does not bundle a card generator" phrasing into "ignored — …
ships no card generator" which reads cleaner as a warning).
- packages/gp-sitemap/src/gp_sitemap/__init__.py:
* Import ``logging`` from stdlib and add
``logging.getLogger(__name__).addHandler(logging.NullHandler())``
alongside the existing ``logger = getLogger(__name__)`` from
``sphinx.util.logging``. The Sphinx adapter is kept because it
supports the ``type=``/``subtype=`` kwargs used elsewhere for
warning classification; the NullHandler attaches to the underlying
stdlib logger with the same name so the library is well-behaved
when imported outside Sphinx. Inline comment memorializes the
two-getLogger dance so future readers don't try to delete one.
* ``_write_sitemap`` "skipping sitemap" info message: trailing period
removed.
CI gate (all green before commit):
- uv run ruff check . --fix --show-fixes: clean
- uv run ruff format .: no changes
- uv run mypy: Success (176 source files)
- uv run py.test --reruns 0: 1199 passed, 3 skipped
- just build-docs: build succeeded1 parent 6c31af6 commit 8de7b5f
2 files changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | | - | |
264 | | - | |
265 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
229 | 235 | | |
230 | 236 | | |
231 | 237 | | |
232 | | - | |
| 238 | + | |
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
| |||
0 commit comments