Skip to content

Conversation

@AdekunleBamz
Copy link

Summary

This PR adds developer experience tooling to help contributors be more productive and maintain code quality across the monorepo.

Changes

Pre-commit Hook (ops/scripts/pre-commit.sh)

  • Go formatting (gofmt) and imports organization (goimports)
  • Go vet static analysis
  • Debug statement detection (prevents accidental commits)
  • TODO format validation
  • TypeScript type checking
  • Solidity formatting via forge fmt
  • Modes: --install (setup as git hook), --quick (fast checks only)

Dev Environment Check (ops/scripts/check-dev-environment.sh)

  • Validates required tools: git, go, node, pnpm, make, jq, foundry
  • Checks version compatibility with project requirements
  • Optional tools check: docker, direnv, golangci-lint, slither
  • Modes: --fix (auto-remediation), --json (CI output)

Performance Profiling (op-service/perf/)

  • Timer with configurable thresholds and structured logging
  • Aggregated metrics collection (count, min, max, avg)
  • Thread-safe concurrent access
  • Comprehensive test coverage

Makefile Targets

  • make dev-setup - Full onboarding (check env + install hooks)
  • make dev-check - Validate development environment
  • make pre-commit - Run pre-commit checks manually

Testing

  • All shell scripts tested manually
  • Go package includes unit tests and benchmarks

Why This Matters

  • Reduces onboarding friction for new contributors
  • Catches issues before they reach CI
  • Provides consistent development environment validation

This contribution adds several developer experience improvements to help
contributors be more productive and maintain code quality:

## Pre-commit Hook Script (ops/scripts/pre-commit.sh)
- Automated code quality checks before commits
- Go formatting (gofmt) and imports organization (goimports)
- Go vet static analysis for common mistakes
- Debug statement detection (prevents accidental commits)
- TODO format validation (matches existing todo-checker patterns)
- TypeScript type checking for packages
- Solidity formatting via forge fmt
- Install mode (--install) to set up as git hook
- Quick mode (--quick) for fast checks without tests

## Dev Environment Check Script (ops/scripts/check-dev-environment.sh)
- Validates all required development tools are installed
- Checks tool versions match project requirements
- Core tools: git, go, node, pnpm, make, jq
- Blockchain tools: foundry (forge/cast/anvil) with version pinning
- Optional tools: docker, direnv, golangci-lint, slither
- Environment validation: .nvmrc, go modules, npm deps, submodules
- Disk space validation
- JSON output mode (--json) for CI integration
- Auto-fix mode (--fix) for common issues

## Performance Profiling Utility (op-service/perf)
- Timer with configurable thresholds and structured logging
- Aggregated metrics collection (count, min, max, avg, total)
- Thread-safe concurrent access
- Generic helper functions for measuring any function
- Context-aware timing with cancellation support
- Comprehensive test coverage with benchmarks

## Makefile Targets
- make dev-check: Validate development environment
- make dev-check-ci: JSON output for CI pipelines
- make dev-check-fix: Auto-fix common issues
- make install-hooks: Install pre-commit hook
- make pre-commit: Run pre-commit checks manually
- make pre-commit-quick: Fast checks only
- make dev-setup: Full onboarding (check + install hooks)
@cb-heimdall
Copy link
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants