Complete reference for all CodeGuard configuration options.
- Configuration Methods
- Basic Settings
- Analyzer Settings
- AI Settings
- Cache Settings
- Privacy Settings
- Performance Settings
- Advanced Settings
- Configuration Examples
User Settings (global):
- File → Preferences → Settings (Ctrl+,)
- Search for "CodeGuard"
- Or edit
settings.json
Workspace Settings (project-specific):
- File → Preferences → Settings (Ctrl+,)
- Switch to "Workspace" tab
- Or edit
.vscode/settings.json
Create .codeguardrc.json in workspace root:
{
"version": "1.0",
"enabled": true,
"debounceMs": 500,
"analyzers": {
"security": { "enabled": true },
"performance": { "enabled": true },
"secrets": { "enabled": true },
"codeSmells": { "enabled": true }
}
}Settings are merged in this order (highest priority first):
.codeguardrc.jsonin workspace root- Workspace settings (
.vscode/settings.json) - User settings (
settings.json) - Default configuration
Type: boolean
Default: true
Description: Enable or disable CodeGuard analysis globally.
{
"codeguard.enabled": true
}Use cases:
- Temporarily disable CodeGuard
- Disable for specific workspaces
- Toggle via command palette
Type: number
Default: 500
Range: 100 - 5000
Description: Delay in milliseconds before triggering analysis after typing stops.
{
"codeguard.debounceMs": 500
}Recommendations:
- Fast typers: Increase to
1000ms - Immediate feedback: Decrease to
300ms - Large files: Increase to
1000ms - Default:
500ms works for most users
Type: number
Default: 5000
Range: 1000 - 30000
Description: Maximum time in milliseconds for analysis before timeout.
{
"codeguard.maxAnalysisTimeMs": 5000
}Recommendations:
- Large files: Increase to
10000ms - Fast machines: Keep at
5000ms - Slow machines: Increase to
15000ms
Type: boolean
Default: true
Description: Enable security vulnerability detection.
{
"codeguard.analyzers.security.enabled": true
}Detects:
- SQL injection
- XSS (Cross-Site Scripting)
- Command injection
- Path traversal
- Unsafe deserialization
Configure severity levels for specific rules:
{
"analyzers": {
"security": {
"enabled": true,
"severity": {
"sql-injection": "error",
"xss": "error",
"command-injection": "error",
"path-traversal": "warning",
"unsafe-deserialization": "warning"
}
}
}
}Severity levels:
error: Red squiggly, blocks (if configured)warning: Yellow squigglyinfo: Blue squigglyhint: Subtle underline
Type: boolean
Default: true
Description: Enable performance issue detection.
{
"codeguard.analyzers.performance.enabled": true
}Detects:
- Nested loops (O(n³)+)
- Blocking operations in async contexts
- Memory leaks
- Inefficient string operations
- Unnecessary re-computations
{
"analyzers": {
"performance": {
"enabled": true,
"severity": {
"nested-loops": "warning",
"blocking-async": "warning",
"memory-leak": "error",
"inefficient-string": "info",
"unnecessary-recompute": "info"
}
}
}
}Type: boolean
Default: true
Description: Enable secret scanning.
{
"codeguard.analyzers.secrets.enabled": true
}Detects:
- AWS access keys
- API keys
- Hardcoded passwords
- JWT tokens
- Private keys
{
"analyzers": {
"secrets": {
"enabled": true,
"severity": {
"aws-access-key": "error",
"api-key": "warning",
"password": "error",
"jwt-token": "warning",
"private-key": "error"
},
"customRules": {
"minEntropy": 4.0,
"excludePatterns": [
"test_key_*",
"example_*"
]
}
}
}
}Custom rules:
minEntropy: Minimum Shannon entropy for detection (0-8)excludePatterns: Patterns to exclude from scanning
Type: boolean
Default: true
Description: Enable code smell detection.
{
"codeguard.analyzers.codeSmells.enabled": true
}Detects:
- Long functions
- High cyclomatic complexity
- Duplicate code
- Too many parameters
- Deep nesting
{
"analyzers": {
"codeSmells": {
"enabled": true,
"severity": {
"long-function": "info",
"high-complexity": "warning",
"duplicate-code": "info",
"too-many-params": "info",
"deep-nesting": "warning"
},
"customRules": {
"maxFunctionLines": 50,
"maxComplexity": 10,
"maxParameters": 5,
"maxNestingDepth": 4,
"minDuplicateLines": 6
}
}
}
}Thresholds:
maxFunctionLines: Maximum lines per function (default: 50)maxComplexity: Maximum cyclomatic complexity (default: 10)maxParameters: Maximum function parameters (default: 5)maxNestingDepth: Maximum nesting levels (default: 4)minDuplicateLines: Minimum lines for duplicate detection (default: 6)
Type: boolean
Default: false
Description: Enable AI-powered fix suggestions.
{
"codeguard.ai.enabled": true
}Type: string
Default: "none"
Options: "openai", "claude", "ollama", "none"
Description: AI service provider for fix suggestions.
{
"codeguard.ai.provider": "ollama"
}Providers:
ollama: Local AI (free, private)openai: OpenAI GPT (requires API key)claude: Anthropic Claude (requires API key)none: Disable AI features
Type: string
Default: ""
Description: API key for AI service (OpenAI or Claude).
{
"codeguard.ai.apiKey": "sk-..."
}Security:
- Store in user settings (not workspace)
- Never commit to version control
- Use environment variables for CI/CD
Type: string
Default: ""
Description: AI model to use.
{
"codeguard.ai.model": "gpt-4"
}OpenAI models:
gpt-4: Most capable (recommended)gpt-4-turbo: Faster, cheapergpt-3.5-turbo: Fastest, cheapest
Claude models:
claude-3-opus-20240229: Most capableclaude-3-sonnet-20240229: Balanced (recommended)claude-3-haiku-20240307: Fastest, cheapest
Ollama models:
codellama: Meta's Code Llamadeepseek-coder: DeepSeek Coderphind-codellama: Phind's Code Llamawizardcoder: WizardCoder
Type: number
Default: 1000
Range: 100 - 4000
Description: Maximum tokens for AI responses.
{
"codeguard.ai.maxTokens": 1000
}Recommendations:
- Simple fixes:
500tokens - Complex fixes:
1500tokens - Default:
1000tokens
Type: number
Default: 0.2
Range: 0.0 - 2.0
Description: AI creativity level (0 = deterministic, 2 = creative).
{
"codeguard.ai.temperature": 0.2
}Recommendations:
- Code fixes:
0.1-0.3(deterministic) - Explanations:
0.5-0.7(balanced) - Creative suggestions:
0.8-1.0(creative)
Type: number
Default: 3000
Range: 1000 - 30000
Description: Timeout for AI requests in milliseconds.
{
"codeguard.ai.timeout": 3000
}{
"codeguard.ai.enabled": true,
"codeguard.ai.provider": "openai",
"codeguard.ai.apiKey": "sk-...",
"codeguard.ai.model": "gpt-4",
"codeguard.ai.maxTokens": 1000,
"codeguard.ai.temperature": 0.2,
"codeguard.ai.timeout": 3000
}Type: boolean
Default: true
Description: Enable result caching for performance.
{
"codeguard.cache.enabled": true
}Benefits:
- Instant results for unchanged files
- Reduced CPU usage
- Faster analysis
Disable if:
- Memory constrained
- Debugging cache issues
- Stale results appearing
Type: number
Default: 50
Range: 10 - 500
Description: Maximum memory cache size in MB.
{
"codeguard.cache.maxMemoryMB": 50
}Recommendations:
- Low memory:
25MB - Normal:
50MB - High memory:
100MB
Type: number
Default: 500
Range: 100 - 5000
Description: Maximum disk cache size in MB.
{
"codeguard.cache.maxDiskMB": 500
}Recommendations:
- Limited disk:
250MB - Normal:
500MB - Ample disk:
1000MB
Type: number
Default: 3600
Range: 300 - 86400
Description: Cache entry time-to-live in seconds.
{
"codeguard.cache.ttlSeconds": 3600
}Recommendations:
- Short-lived:
1800(30 minutes) - Normal:
3600(1 hour) - Long-lived:
86400(24 hours)
Type: boolean
Default: false
Description: Disable all network features (AI, telemetry, updates).
{
"codeguard.privacy.disableNetworkFeatures": true
}Disables:
- AI fix suggestions
- Telemetry and error reporting
- Update checks
Result: CodeGuard runs completely offline.
Type: boolean
Default: true
Description: Disable telemetry and error reporting.
{
"codeguard.privacy.disableTelemetry": true
}Privacy guarantees:
- No code transmission
- No usage tracking
- No error reporting to external services
Type: number
Default: 5000
Range: 1000 - 50000
Description: File size in lines before incremental analysis activates.
{
"codeguard.incrementalThreshold": 5000
}Recommendations:
- Fast machines:
10000lines - Normal:
5000lines - Slow machines:
2000lines
Type: number
Default: 4
Range: 1 - 16
Description: Number of worker threads for analysis.
{
"codeguard.workerThreads": 4
}Recommendations:
- Single core:
1thread - Dual core:
2threads - Quad core:
4threads - 8+ cores:
8threads
Type: string
Default: "info"
Options: "error", "warn", "info", "debug"
Description: Logging level for Output panel.
{
"codeguard.logLevel": "debug"
}Levels:
error: Only errorswarn: Errors and warningsinfo: Normal operation (default)debug: Verbose logging
Type: array
Default: []
Description: Glob patterns for files to exclude from analysis.
{
"codeguard.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/*.min.js"
]
}Type: array
Default: []
Description: Glob patterns for files to include (overrides exclude).
{
"codeguard.includePatterns": [
"src/**/*.ts",
"lib/**/*.js"
]
}{
"codeguard.enabled": true
}{
"codeguard.enabled": true,
"codeguard.ai.enabled": false,
"codeguard.privacy.disableNetworkFeatures": true,
"codeguard.privacy.disableTelemetry": true
}{
"codeguard.enabled": true,
"codeguard.debounceMs": 300,
"codeguard.cache.enabled": true,
"codeguard.cache.maxMemoryMB": 100,
"codeguard.workerThreads": 8
}{
"codeguard.enabled": true,
"codeguard.ai.enabled": true,
"codeguard.ai.provider": "openai",
"codeguard.ai.apiKey": "sk-...",
"codeguard.ai.model": "gpt-4",
"codeguard.ai.maxTokens": 1000,
"codeguard.ai.temperature": 0.2
}{
"codeguard.enabled": true,
"codeguard.ai.enabled": true,
"codeguard.ai.provider": "ollama",
"codeguard.ai.model": "codellama"
}{
"version": "1.0",
"enabled": true,
"debounceMs": 500,
"analyzers": {
"security": {
"enabled": true,
"severity": {
"sql-injection": "error",
"xss": "error",
"command-injection": "error"
}
},
"performance": {
"enabled": true,
"severity": {
"nested-loops": "warning",
"blocking-async": "warning",
"memory-leak": "error"
}
},
"secrets": {
"enabled": true,
"severity": {
"aws-access-key": "error",
"api-key": "warning",
"password": "error"
}
},
"codeSmells": {
"enabled": true,
"severity": {
"long-function": "warning",
"high-complexity": "warning",
"too-many-params": "info"
},
"customRules": {
"maxFunctionLines": 100,
"maxComplexity": 15,
"maxParameters": 4
}
}
},
"cache": {
"enabled": true,
"maxMemoryMB": 50,
"maxDiskMB": 500
},
"privacy": {
"disableNetworkFeatures": false,
"disableTelemetry": true
}
}{
"codeguard.enabled": true,
"codeguard.analyzers.security.enabled": true,
"codeguard.analyzers.secrets.enabled": true,
"codeguard.analyzers.performance.enabled": false,
"codeguard.analyzers.codeSmells.enabled": false,
"analyzers": {
"security": {
"severity": {
"sql-injection": "error",
"xss": "error",
"command-injection": "error",
"path-traversal": "error",
"unsafe-deserialization": "error"
}
},
"secrets": {
"severity": {
"aws-access-key": "error",
"api-key": "error",
"password": "error",
"jwt-token": "error",
"private-key": "error"
}
}
}
}Need help? See TROUBLESHOOTING.md or open an issue on GitHub.