From d1e8104cc3119dad0b003c2053ec165a2e5158b9 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 1 May 2026 03:31:07 +0300 Subject: [PATCH] Improve docs onboarding --- docs/getting-started.md | 50 ++++++++ docs/index.md | 67 +---------- docs/stylesheets/extra.css | 234 +------------------------------------ mkdocs.yml | 1 + 4 files changed, 60 insertions(+), 292 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index fae91c6..1425a38 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -2,12 +2,27 @@ Welcome to cpp-linter! This guide will help you integrate C/C++ linting into your workflow quickly and efficiently. +## What is cpp-linter? + +cpp-linter connects the standard LLVM linting tools, `clang-format` and `clang-tidy`, to the places where C/C++ projects need checks: pull requests, pre-commit hooks, local scripts, and CI jobs. + +- `clang-format` checks formatting against a named style or your `.clang-format` file. +- `clang-tidy` runs static-analysis and modernization checks, usually configured by `.clang-tidy`. +- cpp-linter packages those tools into integrations with consistent defaults, reporting, and failure controls. + ## Choose Your Integration Select the method that best fits your development workflow: +| Use case | Recommended entry point | +| --- | --- | +| GitHub pull request checks | [cpp-linter-action](https://cpp-linter.github.io/cpp-linter-action/) | +| Local checks before commits | [cpp-linter-hooks](https://github.com/cpp-linter/cpp-linter-hooks) | +| Custom scripts or CI jobs | [cpp-linter CLI](https://cpp-linter.github.io/cpp-linter/) | +| High-performance local runs | [cpp-linter-rs](https://cpp-linter.github.io/cpp-linter-rs/) | +
- :material-github: **GitHub Actions** @@ -52,6 +67,41 @@ Select the method that best fits your development workflow:
+## Minimal Examples + +=== "GitHub Actions" + + ```yaml + steps: + - uses: actions/checkout@v5 + - uses: cpp-linter/cpp-linter-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + tidy-checks: "" + ``` + +=== "Pre-commit" + + ```yaml + repos: + - repo: https://github.com/cpp-linter/cpp-linter-hooks + rev: v1.2.0 + hooks: + - id: clang-format + args: [--style=file] + - id: clang-tidy + args: [--checks=-*,bugprone-*,performance-*,readability-*] + ``` + +=== "Command Line" + + ```bash + pip install cpp-linter + cpp-linter --style=file --tidy-checks='-*,bugprone-*,performance-*,readability-*' src/ + ``` + ## Clang Tools Distribution
diff --git a/docs/index.md b/docs/index.md index ba3b756..9af384c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,11 +6,7 @@ template: home.html title: C/C++ Linting --- - - -# C/C++ Linting - -## Everything you need for linting C/C++ code +
@@ -34,21 +30,13 @@ title: C/C++ Linting
-
- -
- -## Trusted by developers worldwide +## Used across open-source projects
-**Join thousands of developers and organizations using cpp-linter in production** +Examples of public GitHub organizations and projects where cpp-linter usage has been seen. This list is a discovery aid, not an endorsement.
-
- Microsoft - Microsoft -
Apache Apache @@ -93,18 +81,6 @@ title: C/C++ Linting LedgerHQ LedgerHQ
-
- LLNL - LLNL -
-
- cohere - cohere -
-
- Diasurgical - Diasurgical -
Khronos Group Khronos Group @@ -121,31 +97,8 @@ title: C/C++ Linting Cambridge ICCS Cambridge ICCS
-
- OpenMSL - OpenMSL -
-
- Xemu Project - Xemu Project -
- -
## Quick Start @@ -179,18 +132,10 @@ title: C/C++ Linting - repo: https://github.com/cpp-linter/cpp-linter-hooks rev: v1.2.0 # Use the tag or commit you want hooks: - - id: clang-format + - id: clang-format args: [--style=Google] # Other coding style: LLVM, GNU, Chromium, Microsoft, Mozilla, WebKit. - - id: clang-tidy - args: - - --checks='boost-* - - bugprone-* - - performance-* - - readability-* - - portability-* - - modernize-* - - clang-analyzer-* - - cppcoreguidelines-*' + - id: clang-tidy + args: [--checks=-*,bugprone-*,performance-*,readability-*] ``` === "Command Line" diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index cbd8753..c434056 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -11,7 +11,7 @@ th { .hero { text-align: center; padding: 4rem 0; - background: var(--md-primary-fg-color); + background: linear-gradient(135deg, var(--md-primary-fg-color) 0%, var(--cpp-linter-logo-color-green) 100%); color: var(--md-primary-bg-color); } @@ -44,7 +44,6 @@ th { background: var(--cpp-linter-logo-color-yellow); color: black; border: none; - border-radius: unset; display: inline-block; } @@ -58,12 +57,6 @@ th { color: black; } -@keyframes gradientShift { - 0% { background-position: 0% 50%; } - 50% { background-position: 100% 50%; } - 100% { background-position: 0% 50%; } -} - /* Card enhancements */ .md-typeset .grid.cards > .card-content { background: var(--md-default-bg-color); @@ -168,32 +161,6 @@ th { color: var(--md-default-fg-color--light); } -.stats-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); - gap: 2rem; - padding: 0 2rem; -} - -.stat { - text-align: center; -} - -.stat strong { - display: block; - font-size: 2rem; - font-weight: 700; - color: var(--md-primary-fg-color); - margin-bottom: 0.5rem; -} - -.stat span { - font-size: 0.9rem; - color: var(--md-default-fg-color--light); - text-transform: uppercase; - letter-spacing: 0.5px; -} - /* Mobile responsiveness for trusted by section */ @media screen and (max-width: 768px) { .logo-grid { @@ -202,30 +169,11 @@ th { padding: 0 1rem; } - .stats-grid { - grid-template-columns: repeat(2, 1fr); - padding: 0 1rem; - } - - .stat strong { - font-size: 1.5rem; + .hero p { + width: 85%; } } -/* Ensure tab items have proper contrast */ -.md-tabs__item { - background-color: transparent; -} - -.md-tabs__link { - color: rgba(255, 255, 255, 0.7); -} - -.md-tabs__link--active, -.md-tabs__link:hover { - color: white; -} - @media screen and (max-width: 76.2344em) { .md-nav--primary .md-nav__title[for="__drawer"] { background-color: #4051b5; @@ -249,164 +197,6 @@ th { background-color: #00b8d41a; } -@keyframes heart { - - 0%, - 40%, - 80%, - to { - transform: scale(1) - } - - 20%, - 60% { - transform: scale(1.15) - } -} - -.md-typeset .mdx-heart { - animation: heart 1s infinite -} - -.md-typeset .mdx-badge { - font-size: .85em -} - -.md-typeset .mdx-badge--heart { - color: #ff4281; -} - -.md-typeset .mdx-badge--heart.twemoji { - animation: heart 1s infinite -} - -.md-typeset .mdx-badge--right { - float: right; - margin-left: .35em -} - -[dir=ltr] .md-typeset .mdx-badge__icon { - border-top-left-radius: .1rem -} - -[dir=rtl] .md-typeset .mdx-badge__icon { - border-top-right-radius: .1rem -} - -[dir=ltr] .md-typeset .mdx-badge__icon { - border-bottom-left-radius: .1rem -} - -[dir=rtl] .md-typeset .mdx-badge__icon { - border-bottom-right-radius: .1rem -} - -.md-typeset .mdx-badge__icon { - background: var(--md-accent-fg-color--transparent); - padding: .2rem -} - -.md-typeset .mdx-badge__icon:last-child { - border-radius: .1rem -} - -[dir=ltr] .md-typeset .mdx-badge__text { - border-top-right-radius: .1rem -} - -[dir=rtl] .md-typeset .mdx-badge__text { - border-top-left-radius: .1rem -} - -[dir=ltr] .md-typeset .mdx-badge__text { - border-bottom-right-radius: .1rem -} - -[dir=rtl] .md-typeset .mdx-badge__text { - border-bottom-left-radius: .1rem -} - -.md-typeset .mdx-badge__text { - box-shadow: 0 0 0 1px inset var(--md-accent-fg-color--transparent); - padding: .2rem .3rem -} - -.md-typeset .mdx-social { - height: min(27rem, 80vw); - position: relative -} - -.md-typeset .mdx-social:hover .mdx-social__image { - background-color: #e4e4e40d -} - -.md-typeset .mdx-social__layer { - margin-top: 4rem; - position: absolute; - transform-style: preserve-3d; - transition: .25s cubic-bezier(.7, 0, .3, 1) -} - -.md-typeset .mdx-social__layer:hover .mdx-social__label { - opacity: 1 -} - -.md-typeset .mdx-social__layer:hover .mdx-social__image { - background-color: #7f7f7ffc -} - -.md-typeset .mdx-social__layer:hover~.mdx-social__layer { - opacity: 0 -} - -.md-typeset .mdx-social__image { - box-shadow: -.25rem .25rem .5rem #0000000d; - transform: rotate(-40deg) skew(15deg, 15deg) scale(.7); - transition: all .25s -} - -.md-typeset .mdx-social__image img { - display: block -} - -.md-typeset .mdx-social__label { - background-color: var(--md-default-fg-color--light); - color: var(--md-default-bg-color); - display: block; - opacity: 0; - padding: .2rem .4rem; - position: absolute; - transition: all .25s -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(6) { - transform: translateY(-30px) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(5) { - transform: translateY(-20px) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(4) { - transform: translateY(-10px) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(3) { - transform: translateY(0) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(2) { - transform: translateY(10px) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:first-child { - transform: translateY(20px) -} - -.md-typeset .mdx-social:hover .mdx-social__layer:nth-child(0) { - transform: translateY(30px) -} - .md-banner { color: var(--md-footer-fg-color--lighter) } @@ -447,24 +237,6 @@ th { max-height: none } -/* annotation buttons' pulse animation */ a.md-annotation__index { border-radius: 2.2ch; } - -@keyframes pulse { - 0% { - box-shadow: 0 0 0 0 var(--md-accent-fg-color); - transform: scale(.95) - } - - 75% { - box-shadow: 0 0 0 .625em transparent; - transform: scale(1) - } - - to { - box-shadow: 0 0 0 0 transparent; - transform: scale(.95) - } -} diff --git a/mkdocs.yml b/mkdocs.yml index a173f2b..48d1cde 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -66,6 +66,7 @@ markdown_extensions: emoji_generator: !!python/name:material.extensions.emoji.to_svg plugins: + - search - blog extra_css: