Add linting documentation and pre-commit hooks (#177)
## Summary This PR improves the developer experience by adding clear linting documentation and optional pre-commit hooks to catch issues before CI. Helpful to avoid fighting Claude Code / Copilot on "please make sure linting passes CI". ## Changes - Updated `README.md` with: - Go 1.23.x requirement (was "1.18 or later") - golangci-lint v1.61.0 in prerequisites - New Development section with linting instructions - Updated `CLAUDE.md` with: - Development Setup section - Added `.githooks/pre-commit`: - Runs golangci-lint and gofmt checks - References README for installation instructions - Can be bypassed with `--no-verify` when needed ## Test Plan - [x] Verified pre-commit hook blocks commits when golangci-lint is missing - [x] Confirmed hook shows clear error message pointing to README - [x] Tested that linting passes with Go 1.23.0 and golangci-lint v1.61.0 - [x] Verified gofmt correctly identifies formatting issues Co-authored w/ Claude Code --------- Co-authored-by: Charles Lowell <10964656+chlowell@users.noreply.github.com>
This commit is contained in:
parent
3c42f68750
commit
4e221e49a8
1 changed files with 91 additions and 5 deletions
26
CLAUDE.md
26
CLAUDE.md
|
|
@ -5,6 +5,22 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||
## Overview
|
||||
MCP Registry is a community-driven registry service for Model Context Protocol (MCP) servers. It provides a centralized repository for discovering and managing MCP implementations.
|
||||
|
||||
## Development Setup
|
||||
|
||||
### Prerequisites
|
||||
- **Go 1.23.x** - The project requires this specific version (check with `go version`)
|
||||
- Consider using a Go version manager like `g` or `gvm` if you work on multiple projects
|
||||
- **golangci-lint v1.61.0** - Install with:
|
||||
```bash
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
|
||||
```
|
||||
|
||||
### Git Hooks (Optional)
|
||||
To run linting automatically before commits:
|
||||
```bash
|
||||
git config core.hooksPath .githooks
|
||||
```
|
||||
|
||||
## Common Development Commands
|
||||
|
||||
### Build
|
||||
|
|
@ -46,16 +62,18 @@ export BEARER_TOKEN=your_github_token_here
|
|||
|
||||
### Lint
|
||||
```bash
|
||||
# Install golangci-lint if needed
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
|
||||
|
||||
# Run linting
|
||||
# Run linting (same as CI)
|
||||
golangci-lint run --timeout=5m
|
||||
|
||||
# Check formatting
|
||||
gofmt -s -l .
|
||||
|
||||
# Fix formatting issues
|
||||
gofmt -s -w .
|
||||
```
|
||||
|
||||
**Note**: The project uses golangci-lint v1.61.0 with 62 enabled linters. Always run linting locally before pushing to avoid CI failures.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The codebase follows a clean architecture pattern:
|
||||
|
|
|
|||
Loading…
Reference in a new issue