-
Notifications
You must be signed in to change notification settings - Fork 0
CODE_STYLE.md
This document defines the official coding standards for all CeloHT repositories.
Consistent code improves readability, maintainability, collaboration, and long-term sustainability across the CeloHT ecosystem.
Every line of code should be:
- Simple
- Readable
- Maintainable
- Secure
- Well documented
- Tested
Code is written for people first, computers second.
Always:
- Write self-explanatory code.
- Keep functions small.
- Avoid duplicated logic.
- Prefer composition over complexity.
- Follow SOLID principles.
- Keep files organized.
- Remove dead code.
Use descriptive camelCase names.
Good
const walletAddress
const courseProgress
const verifiedAgentBad
const wa
const data
const xUse UPPER_SNAKE_CASE.
const MAX_RETRY_COUNT = 3
const DEFAULT_NETWORK = "celo"Use camelCase.
connectWallet()
createProposal()
verifyCertificate()Function names should describe an action.
Use PascalCase.
WalletService
EducationManager
AgentRegistryPrefix with I only if required by the repository standard.
Example
Wallet
Agent
EducationCourseUse PascalCase.
HeroSection.tsx
EducationCard.tsx
Navbar.tsx
Use kebab-case unless framework conventions require otherwise.
Examples
wallet-service.ts
education-api.ts
agent-utils.ts
React components
HeroSection.tsx
Footer.tsx
Example
components/
hooks/
services/
utils/
contracts/
types/
docs/
scripts/
Every folder should have a clear responsibility.
Official formatter:
- Prettier
Never manually fight the formatter.
Run
npm run formatbefore submitting a Pull Request.
Official linter:
- ESLint
Run
npm run lintEvery Pull Request must pass linting.
Use strict typing whenever possible.
Avoid
anyPrefer
interface
type
unknown
genericsFunctions should:
- Do one thing.
- Be short.
- Return predictable results.
- Handle errors appropriately.
Avoid extremely long functions.
Write comments only when necessary.
Prefer
calculateTreeImpact()instead of
// Calculates tree impactGood code should explain itself.
Always handle errors gracefully.
Example
try {
await wallet.connect()
} catch (error) {
console.error(error)
}Never silently ignore errors.
Group imports.
Example
// External
import React from "react"
import { ethers } from "ethers"
// Internal
import WalletButton from "@/components/WalletButton"
import { connectWallet } from "@/lib/wallet"Remove unused imports.
Solidity contracts should:
- Follow OpenZeppelin standards.
- Include NatSpec documentation.
- Use events appropriately.
- Validate all inputs.
- Minimize gas usage.
- Include automated tests.
Every public function should include documentation when appropriate.
Example
/**
* Connects the user's wallet.
*/Use Conventional Commits.
Examples
feat:
fix:
docs:
refactor:
test:
style:
perf:
build:
ci:
chore:
Example
feat: add governance dashboard
docs: update installation guide
fix: resolve wallet connection bug
A Pull Request should:
- Solve one problem.
- Include documentation updates.
- Pass all tests.
- Follow the style guide.
- Be reviewed before merging.
Never commit:
- Private keys
- Recovery phrases
- API secrets
- Passwords
- Tokens
- Database credentials
Secrets belong only in environment variables.
Frontend code should:
- Use semantic HTML.
- Support keyboard navigation.
- Include ARIA labels where needed.
- Maintain sufficient color contrast.
- Work on desktop and mobile devices.
Developers should:
- Avoid unnecessary renders.
- Reduce bundle size.
- Optimize images.
- Lazy-load heavy components.
- Profile performance before optimizing.
Before requesting review, verify:
- Code is readable.
- Tests pass.
- Lint passes.
- Documentation updated.
- No secrets committed.
- No unnecessary dependencies.
- No duplicated logic.
The coding standards will continue evolving as the CeloHT ecosystem grows.
All contributors are encouraged to propose improvements through GitHub Discussions or Pull Requests.
Consistent coding standards strengthen collaboration, improve maintainability, and help ensure that every CeloHT repository remains secure, scalable, and welcoming to contributors from around the world.
© 2026 CeloHT - Open Source. Global Impact. Licensed under MIT.
Welcome to the official CeloHT documentation. This knowledge base provides comprehensive documentation for users, developers, contributors, partners, researchers, and ecosystem participants. Explore architecture, APIs, smart contracts, developer guides, governance, security, educational resources, roadmap, transparency reports, and community initiatives. Built with openness, collaboration, and long-term sustainability in mind, the CeloHT documentation follows international open-source documentation standards to make learning, building, and contributing accessible to everyone.