This guide assumes you have both:
- An active account — see Registration and trial, two minutes.
- The CLI available locally — see Windows installer or Standalone CLI, allow about ten minutes for the initial setup including license configuration.
From there the run described here takes about five minutes.
We will walk through this once using a real solution. Custom rules are not required — the included default packages are enough for the first run.
1. Test the CLI
codecharter --version
If this outputs a version number, the CLI is available. If you get "command not found", the CLI is not yet installed — see Installation.
2. Navigate to your solution directory
cd ~/code/your-solution
ls *.sln
CodeCharter analyzes at solution level. If there is no .sln or .slnx file
you can point it at a single project, but solution is the default case.
3. Activate the default rule package
Without a .codecharter directory in the repo, the CLI loads a default configuration
with the built-in rule packages. If you have your own configuration,
it typically lives under .codecharter/ in the repo root.
For the first run you do not need to prepare anything — the default packages are built in.
4. Start the analysis
codecharter analyze . --output console
This scans your solution against the built-in rules. On a medium-sized codebase the first run takes 20–60 seconds; subsequent runs with cache take a few seconds.
You will see something like:
CodeCharter 1.4.0
Analyzing src/Acme.Web/Acme.Web.sln (124 projects)
Acme.Web/Controllers/ProductsController.cs:42
[warn] Async-Method-Without-CancellationToken
Add 'CancellationToken cancellationToken = default' as the last parameter
Acme.Web/Services/PriceCalculator.cs:18
[warn] DateTime-Direct-Usage
Inject TimeProvider via constructor and call GetUtcNow()
...
Done in 28.4s. 17 findings (3 errors, 14 warnings)
If the exit code is 0 (only warnings, no errors), the run was successful.
5. JSON output for further processing
codecharter analyze . --output json --output-file findings.json
This writes a machine-readable file. Format details under Output formats.
What's next
- Write your first custom rule: see First custom rule
- Fix a finding: see First finding fix
- Add it to CI: see GitHub Actions