Skip to content
cccskills
FreePublished on GitHub

be-code-style

Format C++ code in the BE and Cloud modules using the project's clang-format v16 rules. Use the provided scripts to fix formatting or check for violations without changing files, then review the resulting differences before committing.

OriginalShow the original description

Fix BE (C++) code formatting issues using clang-format

See how to install

Good for

  • Format BE or Cloud C++ code before committing
  • Fix formatting failures reported by CI
  • Check formatting without modifying files
  • Find the required clang-format v16 executable

Files included (1)

  • SKILL.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

What I do

Fix C++ code formatting issues in the BE and Cloud modules using the project's clang-format configuration (v16).

When to use me

  • Before committing BE/Cloud C++ code changes
  • When CI reports clang-format failures
  • When you need to check or fix C++ code style

Prerequisites

You need to confirm that the major version of the called clang-format is 16. If the current environment's default does not meet this requirement, try the following:

  1. If .vscode/settings.json exists, use the clang-format.executable item in it.
  2. If it is a worktree directory, use the .vscode/settings.json from the main directory.
  3. Check the path to the compiler toolchain by trying to find it from the PATH environment variable, the current directory, and the main directory's custom_env.sh. Look for a clang-format with the major version number 16 in that path and its parent directory.

Procedure

Step 1: Auto-fix formatting

Run the project's formatting script, which enforces clang-format v16:

build-support/clang-format.sh

This formats all C++ files under be/src, be/test, cloud/src, cloud/test in-place, respecting .clang-format and .clang-format-ignore.

Important: Always use this script instead of invoking clang-format directly. The script checks that clang-format version 16 is installed and exits with an error if the wrong version is found. Using a different version will produce inconsistent formatting.

Step 2: Check-only (no modification)

To verify formatting without modifying files:

build-support/check-format.sh

This outputs a diff of any formatting violations and exits non-zero if there are any.

Step 3: Review and commit

After running clang-format.sh, review the changes with git diff to verify only formatting was changed, then stage and commit.

Key Configuration

FilePurpose
.clang-formatMain formatting rules (Google-based, 100 col, 4-space indent)
.clang-format-ignoreFiles excluded from formatting (third-party, generated)
build-support/run_clang_format.pyPython wrapper for parallel execution

Excluded Directories

The following are excluded from formatting (see .clang-format-ignore):

  • be/src/apache-orc/*, be/src/clucene/*, be/src/gutil/*
  • be/src/glibc-compatibility/*
  • Specific third-party vendored files (mustache, sse2neon, utf8_check)
  • cloud/src/common/defer.h

Troubleshooting

ProblemSolution
clang-format not foundInstall clang-format v16 or set CLANG_FORMAT_BINARY env var
version is not 16Install clang-format v16; on macOS: brew install llvm@16
Files not being formattedCheck .clang-format-ignore for exclusions

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

clang-tidy-check

FreeSummary

Run clang-tidy static analysis, which checks code without executing it, on added or modified BE and Cloud C++ files. Focus diagnostics on changed lines, investigate bug, performance, and readability warnings, and verify fixes with another check.

  • Check changed C++ code before committing
  • Investigate clang-tidy warnings reported by CI
  • Review changes against a specific branch
apache/doris16.1KUpdated Oct 18, 2026

code-review

FreeSummary

Review Doris code changes using project-specific checklists for data correctness, concurrency, memory safety, compatibility, performance, and tests. Trace related code paths and explain findings with concrete failure scenarios, using query plan trees when reviewing optimizer behavior.

  • Review newly completed Doris code changes
  • Check concurrency and memory management in related code paths
  • Assess compatibility and test coverage before merging
apache/doris16.1KUpdated Oct 18, 2026

Prepare a clean Doris package and run Docker regression tests, which check whether changes break existing behavior. Restore configuration and startup files from Git, build the test image, and investigate failures using configuration checks and runtime logs.

  • Run Docker regression tests before submitting Doris changes
  • Test without local configuration changes affecting results
  • Investigate missing test suites or startup failures
apache/doris16.1KUpdated Oct 18, 2026

fe-code-style

FreeSummary

Diagnoses and fixes Java style violations in the FE module using Checkstyle, a tool that checks coding rules. It interprets errors, applies the project's formatting and import restrictions, and reruns checks to verify fixes.

  • Checking FE Java changes before committing
  • Fixing build failures caused by Checkstyle violations
  • Understanding project-specific style and import rules
apache/doris16.1KUpdated Oct 18, 2026

See all skills by apache

Report a problem with this skill