Skip to content

codecharter analyze

Analyze a solution or project against a rule set.

codecharter analyze <path> [options]

<path> is the path to a .sln, .slnx, or .csproj file.

Examples

# Default run against the solution, output to console
codecharter analyze MySolution.sln

# JSON output to a file
codecharter analyze MySolution.sln --output json --output-file findings.json

# Only errors as build blockers, GitHub annotations for PR inline comments
codecharter analyze MySolution.sln --output github-annotations --fail-on error

# Rule set from a different directory
codecharter analyze MySolution.sln --rules ./shared-rules

Options

Option Default Description
--rules <dir> ./rules Directory containing .ccr rules. Default is ./rules in the current directory, with a fallback to the sample rules next to the CLI.
--output <format> console Output format: console, json, sarif, github-annotations. See Output Formats.
--output-file <path> stdout Write output to a file instead of stdout.
--severity <level> info Minimum severity shown in output: info, warn, error.
--fail-on <level> not set Exit code 1 for findings at or above this severity: info, warn, error.
--no-color off Disable ANSI color codes in console output.
--verbose off Detailed diagnostic logs.
--workspace-root <path> not set Path prefix to strip from file paths. Useful for github-annotations.

Exit Codes

  • 0: Run successful, no findings above the --fail-on threshold.
  • 1: Findings above the --fail-on threshold found.
  • 2: Configuration or rule error.

More at Exit Codes.