Skip to content

Convention Packs

Caliper ships with curated convention packs for TypeScript, Python, and Go. When you run caliper init and select a framework, these checks are activated automatically — no configuration required.

Each check runs deterministically on every commit or PR. They catch the patterns that slip through in review: forgotten debug logging, mutable defaults, hardcoded secrets, and more.


TypeScript

Security

CheckDetectsFix
No execSync with template stringsexecSync called with a template literal, risking shell injectionUse execFileSync with array args to prevent shell injection
No eval() callsUsage of eval()Avoid eval — use safer alternatives like JSON.parse or Function constructor
No hardcoded API keys or secretsStrings assigned to variables named api_key, secret, password, token, etc.Use environment variables for secrets, never hardcode them

Type Safety

CheckDetectsFix
No explicit 'any' type annotations: any, as any, or <any> in TypeScript filesUse a specific type, unknown, or a generic instead of any
No @ts-ignore without explanation@ts-ignore comments that lack a reasonUse @ts-expect-error with a reason comment, or fix the type error
No non-null assertions on lookupsNon-null assertion (!) on .get() or bracket access resultsProvide a fallback value instead of using ! on map/object lookups

Code Quality

CheckDetectsFix
Functions under 50 linesFunctions exceeding 50 lines (AST-based)Extract named helpers to keep functions focused and under 50 lines
Functions have at most 4 parametersFunctions with more than 4 parameters (AST-based)Use an options object instead of many positional parameters
Cyclomatic complexity under 15Functions with cyclomatic complexity above 15 (AST-based)Reduce branching by extracting conditions into named functions or using early returns
No console.log in production codeconsole.log() calls in src/ filesUse a proper logger or remove debug logging before committing
Files under 500 linesSource files exceeding 500 linesSplit large files into focused modules with single responsibilities

Architecture

CheckDetectsFix
No process.env reads at module levelTop-level const/let/var assignments from process.envRead environment variables inside functions, not at module scope

Python

Security

CheckDetectsFix
No hardcoded API keys or secretsStrings assigned to variables named api_key, secret, password, token, etc.Use environment variables for secrets, never hardcode them
No eval() or exec() callsUsage of eval() or exec()Avoid eval/exec — use safer alternatives like ast.literal_eval
No f-string or .format() in SQL queriesf-strings or .format() in execute() calls with SQL keywordsUse parameterized queries to prevent SQL injection

Error Handling

CheckDetectsFix
No bare except clausesexcept: without a specific exception typeCatch a specific exception type instead of using bare except

Type Safety

CheckDetectsFix
No type: ignore without explanation# type: ignore without a specific error codeUse type: ignore[specific-error] with a reason, or fix the type error

Code Quality

CheckDetectsFix
No wildcard importsfrom module import * statementsImport specific names instead of using wildcard imports
No mutable default arguments[] or {} used as default parameter valuesUse None as default and create the mutable object inside the function
No print() in production codeprint() calls in src/ filesUse the logging module instead of print statements
Files under 500 linesSource files exceeding 500 linesSplit large files into focused modules

Testing

CheckDetectsFix
Source files have corresponding test filesSource files in src/ without a matching _test.py companionCreate a test file for each source module

Go

Security

CheckDetectsFix
No hardcoded API keys or secretsStrings assigned to variables named apiKey, secret, password, token, etc.Use environment variables for secrets, never hardcode them
No string concatenation in SQL queriesString concatenation or fmt.Sprintf in Query/Exec calls with SQL keywordsUse parameterized queries to prevent SQL injection

Error Handling

CheckDetectsFix
No ignored error returnsFunction calls whose error return value is discardedAlways check error return values — don't ignore them
No panic() in library codeUsage of panic()Return errors instead of panicking — panic is for unrecoverable situations only

Architecture

CheckDetectsFix
Avoid init() functionsfunc init() declarationsUse explicit initialization instead of init() to make dependencies clear
No mutable global variablesPackage-level var declarations (excluding sync primitives)Avoid mutable globals — pass dependencies explicitly or use sync primitives

Code Quality

CheckDetectsFix
Files under 500 linesSource files exceeding 500 linesSplit large files into focused packages

Testing

CheckDetectsFix
Source files have corresponding test filesSource files without a matching _test.go companionCreate a test file for each source package

Extending with Custom Checks

The packs above are just the starting point. Run caliper refresh to scan your project's CLAUDE.md files and automatically compile additional checks tailored to your team's conventions. Custom checks are added to .caliper/checks.js alongside the pack checks.

© 2026 Caliper AI. All rights reserved.