
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Professional CMake formatter with CLion-compatible style - Fast, zero-dependency command line tool for CMakeLists.txt formatting
Professional CMake code formatter with CLion-compatible style
💡 Looking for editor integration? Check out the VS Code extension for seamless formatting with format-on-save support!
cc-format is a command-line tool that provides professional CMake code formatting with formatting rules that match JetBrains CLion's built-in CMake formatting style. This tool is part of the CLion CMake Format project.
Perfect for: CI/CD pipelines, pre-commit hooks, terminal workflows, and automated build systems.
This CLI tool uses the same core formatting engine (@cc-format/core) as the VS Code extension, ensuring consistent formatting results across all environments.
💡 Want editor integration? Install the CLion CMake Format VS Code extension for format-on-save support and visual configuration!
# Install globally
npm install -g cc-format
# Or use with npx (no installation required)
npx cc-format --help
# Format a single file (output to stdout)
cc-format CMakeLists.txt
# Format and write back to file
cc-format -w CMakeLists.txt
# Format all CMake files in a directory
cc-format -w src/
# Check if files are formatted (for CI)
cc-format --check CMakeLists.txt
# Format from stdin
echo 'project(Test)' | cc-format --stdin
| Option | Description |
|---|---|
-w, --write | Write formatted output back to files |
-c, --check | Check if files are formatted (exit 1 if not) |
--stdin | Read from stdin and write to stdout |
--no-project-config | Ignore project-level .cc-format.jsonc files |
--command-case <case> | Set command case: unchanged, lowercase, uppercase |
--indent-size <size> | Number of spaces for indentation |
--use-tabs | Use tabs instead of spaces |
--line-length <length> | Maximum line length (0 for unlimited) |
--init | Create a .cc-format.jsonc config file in current directory |
--init-global | Create a global config file |
--config-path | Show path to global config file |
Create a .cc-format.jsonc file in your project root:
{
"indentSize": 4,
"commandCase": "lowercase",
"lineLength": 120
}
# Create global config
cc-format --init-global
# Show global config path
cc-format --config-path
# Output: ~/.config/cc-format/.cc-format.jsonc
Settings priority:
.cc-format.jsonc in project directory)~/.config/cc-format/.cc-format.jsonc)- name: Check CMake formatting
run: npx cc-format --check **/*.cmake CMakeLists.txt
#!/bin/sh
cc-format --check $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cmake|CMakeLists\.txt)$') || exit 1
# Format all CMake files in multiple directories
cc-format -w src/ tests/ cmake/
# Use globbing patterns (varies by shell)
cc-format -w src/**/*.cmake
FROM node:18-alpine
RUN npm install -g cc-format
WORKDIR /workspace
CMD ["cc-format", "-w", "."]
# Run in Docker container
docker run --rm -v $(pwd):/workspace my-cmake-formatter
Add to .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Format CMake Files",
"type": "shell",
"command": "cc-format -w .",
"problemMatcher": []
}
]
}
.PHONY: format check-format
format:
cc-format -w .
check-format:
cc-format --check $(shell find . -name '*.cmake' -o -name 'CMakeLists.txt')
Benchmark results on a typical CMake project:
| File Size | Lines | Format Time |
|---|---|---|
| Small | ~50 lines | < 5ms |
| Medium | ~500 lines | < 20ms |
| Large | ~3500 lines | < 100ms |
Tested on Apple M1, Node.js 18
| Feature | cc-format | cmake-format | gersemi |
|---|---|---|---|
| Language | TypeScript | Python | Python |
| Dependencies | 0 | Multiple | Multiple |
| CLion Compatible | ✅ | ❌ | ❌ |
| Installation | npm | pip | pip |
| Speed | ⚡ Fast | Medium | Medium |
| Config Format | JSON | YAML/Python | TOML |
code --install-extension wysaid.clion-cmake-formatMIT
FAQs
Professional CMake formatter with CLion-compatible style - Fast, zero-dependency command line tool for CMakeLists.txt formatting
We found that cc-format demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.