Skip to content

Commit 317f7b7

Browse files
authored
docs: redesign the home page and revise the inner pages (#65)
Redesigns the home page and brings the rest of the site to the same look and the same facts. The current home page reads like a docs index; this one says what cpp-linter does and sends visitors to the right tool. What is on the home page: - Hero: what cpp-linter does, an "Add it to a repository" button, and an illustration of what lands on a pull request (a clang-tidy review suggestion from github-actions and the auto-fix commit) inside the logo's circle and check. - "Pick where the checks run": the action, the pre-commit hooks, the CLI and clang-tools, each with a command. - "Pin the same LLVM version in each tool", with the setting each tool uses. - What reviewers see: annotations by default; review suggestions, the summary comment and auto-fix with the input and permission each needs. - Showcase projects, a one-file quick start and a sponsor band. Site-wide: - In the light scheme, inner pages use the home page's paper background, light header and tabs, ink footer, and fonts (Instrument Sans, JetBrains Mono, Bricolage Grotesque for headings). Fonts load from `docs/overrides/main.html` and `theme.font` is `false`. - The dark scheme (palette toggle) uses the same layout in the home page's ink tones: `#16182a` background and header, warm light text, a lighter indigo for links. The home page itself stays light. How it is built: - `docs/overrides/home.html` overrides the header, hero, content and footer blocks. The header keeps the `md-header` class and includes Material's search partial, so search works as before. - `docs/stylesheets/home.css` loads on the home page only. `extra.css` loses the rules only the old home page used. Facts: every statement on the home page was checked against the repos and live data. That changed a few things beyond the copy: - The logo wall (Microsoft, NASA, Samsung, …) is replaced by eight showcase projects with an active workflow that uses the action. - Waybar keeps the action only in a disabled `.yml.bak` workflow, so it is removed from the home page and `showcase.md`, and the star total drops from 87,000+ to 75,000+. The other 34 showcase projects were rechecked. - The download count is dropped: the last 30 days across the three PyPI packages is below 30K and counts the same CI runs twice. - "MIT licensed" became "open source": the Docker images and the static binaries are not MIT. Inner pages, after a review of every page: - Layout: buttons match the home page, and pages that are a section of their own hide the left navigation, which only repeated the tab name. The why page's comparison table and the sponsor size chart fit without sideways scrolling. Tab labels match the home header (Get started, Why cpp-linter, Community). The prev/next footer is gone, since it pointed at blog archive pages. Blog tags are shown. - Get started gives a working setup for each tool instead of two lists of links, with the home page's names, version ranges and caveats. cpp-linter-rs is mentioned as a release candidate instead of being recommended. - Why cpp-linter and the three blog posts were checked against the tools and the other projects' sources on 2026-09-24. Auto-fix shipped in v2.23.0. On pull requests from forks only annotations work and `thread-comments` fails the step, so the examples skip it there. The action installs clang with apt on Linux and Homebrew on macOS, so "the bytes match" was wrong. `--checks=.clang-tidy` adds a check pattern, not a config file. `format-review` and `tidy-review` together duplicate suggestions. `--all-files` in CI keeps "format as you go" teams red. - Showcase: Jupyter Xeus (hook commented out), Rancher Sandbox (moved to Kubewarden) and Bosch Research (forks only) are replaced by projects that run the hook. - Sponsor: no shop wording ("ordering", "refunds") for shirts that are not for sale, the chest row says it is measured laid flat, and the two photos are 280 KB instead of 8.4 MB. - Community (was Discussion) says where to ask, report bugs and security problems, and contribute. - The orphan `blog/author/team` page is removed, `overrides/` and `requirements.txt` are no longer published, and `site_description` describes cpp-linter. Checked with `mkdocs build --strict`, the pre-commit hooks, a request to every added URL, and in a browser at 1440, 1280, 1024 and 375 px in light and dark schemes: no horizontal overflow, search returns results, the copy button works, and the phone menu and drawer open.
1 parent 84c9bf0 commit 317f7b7

22 files changed

Lines changed: 2985 additions & 762 deletions

‎README.md‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,22 @@ This repository hosts the public site at <https://cpp-linter.github.io/>, includ
2121
- "Why cpp-linter?": how the toolchain compares with other clang-format / clang-tidy actions and hooks
2222
- Showcase of open-source projects that use cpp-linter
2323
- Blog posts and guides
24-
- Clang tools distribution guides (static binaries, Docker images, Python wheels)
25-
- Discussion and community entry points
24+
- Links to the clang tools packages (pip, Homebrew, asdf, static binaries, Docker images, wheels)
25+
- Community entry points and the sponsor page
26+
27+
## Build
28+
29+
```bash
30+
pipx run nox -s docs # build into site/
31+
pipx run nox -s docs-live # preview with live reload
32+
```
33+
34+
## Files other projects use
35+
36+
Other repositories load these files from the published site, so do not rename or remove them
37+
without updating those repositories:
38+
39+
- `docs/stylesheets/shared.css`, served at <https://cpp-linter.github.io/stylesheets/shared.css>,
40+
is loaded by the docs sites of cpp-linter-action, cpp-linter, clang-tools-pip and cpp-linter-rs.
41+
- `docs/install-wheel.sh`, served at <https://cpp-linter.github.io/install-wheel.sh>, is used by
42+
the clang-tools-wheel README and its release workflow.

‎docs/blog/author/team.md‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎docs/blog/index.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
description: Guides to running clang-format and clang-tidy with cpp-linter.
3+
---
4+
15
# Blog
26

3-
News, updates, and resources from the cpp-linter organization.
7+
Guides to running clang-format and clang-tidy with cpp-linter.

‎docs/blog/posts/2026-09-12-moving-to-cpp-linter.md‎

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ tags:
1010
- migration
1111
authors:
1212
- shenxianpeng
13+
description: >-
14+
Replace a clang-format check and a clang-tidy review job with one cpp-linter-action step, input
15+
by input.
1316
---
1417

1518
# Moving to cpp-linter from other clang-format and clang-tidy actions
@@ -30,7 +33,7 @@ jobs:
3033
format:
3134
runs-on: ubuntu-latest
3235
steps:
33-
- uses: actions/checkout@v5
36+
- uses: actions/checkout@v7
3437
- uses: jidicula/clang-format-action@v4.18.0
3538
with:
3639
clang-format-version: '17'
@@ -39,19 +42,18 @@ jobs:
3942
tidy:
4043
runs-on: ubuntu-latest
4144
steps:
42-
- uses: actions/checkout@v5
45+
- uses: actions/checkout@v7
4346
- run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
4447
- uses: ZedThree/clang-tidy-review@v0.23.1
4548
with:
4649
clang_tidy_version: '21'
4750
build_dir: build
4851
config_file: .clang-tidy
49-
- uses: ZedThree/clang-tidy-review/upload@v0.23.1
5052
```
5153
52-
The format job fails with a diff in the log; the tidy job builds a Docker image, runs, uploads an
53-
artifact, and a second workflow posts the review. Contributors see a red check for formatting and a
54-
review for clang-tidy, and still fix the formatting by hand.
54+
The format job fails with clang-format's warnings in the log; the tidy job builds a Docker image,
55+
runs clang-tidy and posts a review. Contributors see a red check for formatting and a review for
56+
clang-tidy, and still fix the formatting by hand.
5557
5658
## The replacement
5759
@@ -70,7 +72,7 @@ jobs:
7072
contents: read
7173
pull-requests: write
7274
steps:
73-
- uses: actions/checkout@v5
75+
- uses: actions/checkout@v7
7476
- run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
7577
- uses: cpp-linter/cpp-linter-action@v2
7678
id: linter
@@ -82,9 +84,8 @@ jobs:
8284
tidy-checks: ''
8385
database: build
8486
lines-changed-only: true
85-
format-review: true
8687
tidy-review: true
87-
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
88+
thread-comments: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'update' }}
8889
- name: Fail on lint errors
8990
if: steps.linter.outputs.checks-failed > 0
9091
run: exit 1
@@ -98,12 +99,22 @@ What each input replaces:
9899
| `check-path: 'src'` | default `files-changed-only: true` | Only files touched by the pull request are checked. Use `ignore` to exclude directories. |
99100
| `config_file: .clang-tidy` | `tidy-checks: ''` | Empty means "use `.clang-tidy`". `style: file` does the same for `.clang-format`. |
100101
| `build_dir: build` | `database: build` | Directory that holds `compile_commands.json`. |
101-
| the `upload` step and post workflow | `tidy-review: true` | Reviews are posted from the same job. |
102-
| the failing format job | `format-review: true` | Formatting differences become review suggestions a contributor can apply from the browser. |
102+
| the clang-tidy-review Docker build | `tidy-review: true` | The review comes from the action's own step, with no image to build. |
103+
| the failing format job | annotations, or `auto-fix: true` | See below. |
103104

104105
The `checks-failed` output plus the final `exit 1` step keeps the red check for anything not fixed.
105-
`thread-comments: update` keeps a single summary comment on the pull request and rewrites it on
106-
every push instead of adding a new one.
106+
107+
`format-review` and `tidy-review` would post suggestions on the same lines, so the action's docs
108+
recommend enabling only one of them. Here the review is for clang-tidy, and formatting is handled
109+
one of two ways:
110+
111+
- Leave it to the pre-commit hook below. The action still annotates each badly formatted file and
112+
fails the check.
113+
- Set `auto-fix: true` and give the job `contents: write`. The action commits clang-format's fixes
114+
to the pull request branch. Pull requests from forks are skipped, and a commit pushed with
115+
`GITHUB_TOKEN` does not start a new workflow run; the
116+
[permissions page](https://cpp-linter.github.io/cpp-linter-action/permissions/#auto-fix)
117+
explains how to push with a token that does.
107118

108119
## Adopting a strict `.clang-tidy` on an old code base
109120

@@ -114,15 +125,17 @@ thousands of findings in files nobody is touching. Two inputs handle that:
114125
- `lines-changed-only: true` limits reported clang-tidy findings to lines the pull request changed.
115126

116127
With both set, contributors only see findings on the lines they changed. You clean up the rest of
117-
the tree gradually, or in one pass with the `cpp-linter` CLI.
128+
the tree gradually: the `cpp-linter` CLI lists every finding in the tree, and `clang-tidy --fix`
129+
applies the fixable ones in one pass.
118130

119131
## What contributors see
120132

121-
- Formatting problems show up as review suggestions. Clicking "Commit suggestion" fixes them
122-
without a local round trip.
123-
- clang-tidy findings appear as review comments on the changed lines, with the check name, and as
124-
annotations in the "Files changed" tab.
125-
- One thread comment summarizes the run and is updated in place.
133+
- clang-tidy findings appear as review comments on the changed lines, with the check name and a
134+
suggestion where clang-tidy has a fix, and as annotations in the "Files changed" tab. Draft pull
135+
requests get no review.
136+
- Formatting problems show up as annotations, or are committed away by `auto-fix`.
137+
- One thread comment summarizes the run. It is edited on each push while there are findings and
138+
deleted once everything passes.
126139

127140
## Keep the local side in sync
128141

@@ -137,17 +150,17 @@ repos:
137150
- id: clang-format
138151
args: [--style=file, --version=21]
139152
- id: clang-tidy
140-
args: [--checks=.clang-tidy, --version=21]
153+
args: [--version=21]
141154
```
142155

143-
Contributors who use the hook never see the review suggestions, because there is nothing left to
144-
suggest. The action becomes the safety net for everyone else.
156+
Contributors who use the hook never see a formatting annotation, because there is nothing left to
157+
fix. The action becomes the safety net for everyone else.
145158

146159
## Things to check after switching
147160

148-
- The `pull-requests: write` permission is required for reviews and thread comments.
149-
Pull requests from forks get a read-only `GITHUB_TOKEN`; file annotations and the step summary
150-
still work there.
161+
- The `pull-requests: write` permission is required for reviews and thread comments. Pull requests
162+
from forks get a read-only `GITHUB_TOKEN`: annotations still appear, reviews are not posted, and
163+
posting the thread comment would fail the step, which is why the workflow leaves it off for them.
151164
- If your build needs generated headers, run the build before the action, or point `database` at
152165
a directory produced by an earlier step.
153166
- Compare the first run against the old jobs on one pull request before removing them.

‎docs/blog/posts/2026-09-12-one-clang-version-everywhere.md‎

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ tags:
1111
- clang-tools
1212
authors:
1313
- shenxianpeng
14+
description: >-
15+
Use the same LLVM major version for clang-format and clang-tidy in pre-commit, in
16+
cpp-linter-action and on your laptop, and upgrade it in one commit.
1417
---
1518

1619
# One clang-format version everywhere: pre-commit, CI and your laptop
@@ -37,13 +40,13 @@ Write it down somewhere visible, for example in `CONTRIBUTING.md`:
3740
Formatting and static analysis use LLVM 21 (clang-format 21, clang-tidy 21).
3841
```
3942

40-
Everything below pins `21`. When you move to 22, change it in all places in one commit, reformat
41-
the tree in the same commit, and the history stays clean.
43+
Everything below pins `21`. Pick a major every tool has: the clang-tidy hook covers LLVM 13 to 22,
44+
the action and clang-tools 12 to 23.
4245

4346
## Pre-commit: cpp-linter-hooks
4447

4548
[cpp-linter-hooks](https://github.com/cpp-linter/cpp-linter-hooks) installs `clang-format` and
46-
`clang-tidy` as Python wheels, so every contributor gets the same binary regardless of what their
49+
`clang-tidy` as Python wheels, so every contributor gets the same release regardless of what their
4750
distribution ships. The `rev` is the hooks release; the tool version is a separate `--version`
4851
argument:
4952

@@ -55,18 +58,21 @@ repos:
5558
- id: clang-format
5659
args: [--style=file, --version=21]
5760
- id: clang-tidy
58-
args: [--checks=.clang-tidy, --version=21]
61+
args: [--version=21]
5962
```
6063
61-
`--style=file` and `--checks=.clang-tidy` read the same `.clang-format` and `.clang-tidy` files
62-
that CI will use, so the rules, like the version, are defined in one place.
64+
`21` means the newest 21.x wheel on PyPI, looked up on each run, so the two hooks can land on
65+
different patch releases of 21. `--style=file` reads `.clang-format`, and clang-tidy finds
66+
`.clang-tidy` by itself: the hooks read the same files CI will use, so the rules, like the version,
67+
are defined in one place. The clang-tidy hook needs a `compile_commands.json`; if your build does
68+
not produce one before commit time, run clang-tidy only in CI.
6369

6470
## CI: cpp-linter-action
6571

6672
[cpp-linter-action](https://github.com/cpp-linter/cpp-linter-action) installs the requested
6773
version itself; the workflow does not need `apt-get install clang-format-21` or a matching LLVM
68-
apt repository. The `version` input takes the LLVM major version. It also accepts a path to tools
69-
you installed yourself, or an empty string for whatever the runner has; the
74+
apt repository. The `version` input takes only the LLVM major version. It also accepts a path to
75+
tools you installed yourself, or an empty string for whatever the runner has; the
7076
[input reference](https://cpp-linter.github.io/cpp-linter-action/inputs-outputs/#version) has the
7177
details.
7278

@@ -85,7 +91,7 @@ jobs:
8591
contents: read
8692
pull-requests: write
8793
steps:
88-
- uses: actions/checkout@v5
94+
- uses: actions/checkout@v7
8995
- uses: cpp-linter/cpp-linter-action@v2
9096
id: linter
9197
env:
@@ -94,23 +100,25 @@ jobs:
94100
version: '21'
95101
style: file
96102
tidy-checks: ''
97-
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
103+
thread-comments: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'update' }}
98104
- name: Fail on lint errors
99105
if: steps.linter.outputs.checks-failed > 0
100106
run: exit 1
101107
```
102108

103109
`style: file` and an empty `tidy-checks` tell the action to use `.clang-format` and
104110
`.clang-tidy` from the repository, the same files pre-commit used a minute earlier on the
105-
developer's machine. The result is a thread comment on the pull request that is updated on every
106-
push instead of a new comment each time, plus file annotations in the diff view.
111+
developer's machine. The result is file annotations in the diff view, plus a thread comment on the
112+
pull request that is edited on each push while there are findings and removed once they are fixed.
113+
Pull requests from forks get a read-only token, and posting the comment would fail the step, so
114+
the condition leaves the comment off for them.
107115

108116
## Local one-off runs: clang-tools
109117

110-
Sometimes you want the binary itself: a quick `clang-format --dry-run` over a directory, or a
118+
Sometimes you want the binary itself: a quick `clang-format --dry-run` over a few files, or a
111119
`clang-tidy` run with a hand-written compile database. [clang-tools](https://github.com/cpp-linter/clang-tools-pip)
112-
downloads a statically linked binary for the exact major version and falls back to the Python
113-
wheel when there is no binary for your platform:
120+
downloads the static binary for that LLVM major (21.1.0 for 21) unless a `clang-format-21` is
121+
already on your PATH, and falls back to the PyPI wheel if the download fails. In a virtualenv:
114122

115123
```bash
116124
pip install clang-tools
@@ -122,42 +130,39 @@ The binaries come from [clang-tools-static-binaries](https://github.com/cpp-lint
122130
which publishes a rolling window of recent LLVM majors for Linux, macOS and Windows, on x86-64 and
123131
ARM64; each release lists its exact versions in
124132
[`versions.json`](https://github.com/cpp-linter/clang-tools-static-binaries/releases/latest/download/versions.json).
125-
The same release is what cpp-linter-action downloads in CI, so the bytes match.
133+
cpp-linter-action uses the runner's package manager where it can: apt on Linux, Homebrew's
134+
`llvm@21` on macOS, these binaries on Windows. Every place runs clang-format 21, but not always the
135+
same patch release.
126136

127137
## Containers and other package managers
128138

129-
The same versions are available as
130-
[Docker images](https://github.com/cpp-linter/clang-tools-docker) tagged by major version:
139+
[Docker images](https://github.com/cpp-linter/clang-tools-docker) carry Ubuntu's clang-format and
140+
clang-tidy packages, tagged by major version up to 22:
131141

132142
```bash
133-
docker run -v "$PWD":/src xianpengshen/clang-tools:21 clang-format --dry-run --Werror /src/main.cpp
143+
docker run --rm -v "$PWD":/src xianpengshen/clang-tools:21 clang-format --dry-run --Werror /src/main.cpp
134144
```
135145

136-
The [Homebrew tap](https://github.com/cpp-linter/homebrew-tap) and the
137-
[asdf plugin](https://github.com/cpp-linter/asdf-clang-tools) are built from the same static
138-
binaries, for teams that already manage tool versions that way:
146+
On macOS, the [Homebrew tap](https://github.com/cpp-linter/homebrew-tap) (LLVM 19 to 23) installs
147+
the same static binaries; the [asdf plugin](https://github.com/cpp-linter/asdf-clang-tools) does so
148+
on every platform, for teams that already manage tool versions that way:
139149

140150
```bash
141151
brew install cpp-linter/tap/clang-format@21 cpp-linter/tap/clang-tidy@21
142152
```
143153

144154
## Upgrading
145155

146-
When LLVM 22 is the version you want:
156+
When LLVM 22 is the version you want, change it everywhere in one commit:
147157

148158
1. Change `21` to `22` in `.pre-commit-config.yaml`, the workflow and `CONTRIBUTING.md`.
149159
2. Run `pre-commit run clang-format --all-files` and commit the reformatted tree together with the
150160
version change.
151161
3. Open the pull request. cpp-linter-action runs with 22 and should report nothing, because the
152-
tree was formatted with the same version a moment ago.
162+
tree was formatted with the same major version a moment ago.
153163

154-
If the action reports differences at this point, the two tools are not on the same version, and
155-
the numbers above are the first thing to check.
156-
157-
## clang-tidy drifts more than clang-format
158-
159-
`clang-format` version drift produces noisy diffs. `clang-tidy` version drift produces different
160-
findings: checks that were added, renamed or made stricter. A pull request that passes locally and
161-
fails in CI with a check nobody has heard of is usually a version mismatch. With the hook and the
162-
action pinned to the same major version, the two numbers to compare are `--version` in
163-
`.pre-commit-config.yaml` and `version` in the workflow.
164+
If the action does report differences, compare the exact releases: the action's log prints the one
165+
it ran (`clang-format-22 --version`), and the hook uses the newest 22.x wheel. `clang-tidy` drifts
166+
more than `clang-format`: a new major adds, renames and tightens checks, so a pull request that
167+
passes locally and fails in CI with a check nobody has heard of usually means the two version
168+
numbers above differ.

0 commit comments

Comments
 (0)