Skip to content

Commit bed0bd1

Browse files
committed
Add precommit
1 parent c3849b6 commit bed0bd1

17 files changed

+137
-91
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# But not these files...
55
!/.gitignore
6+
!/.pre-commit-config.yaml
67

78
!*.go
89
!go.sum

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# See https://pre-commit.com for more information
2+
repos:
3+
# Built-in hooks
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-case-conflict
12+
- id: check-merge-conflict
13+
- id: check-json
14+
15+
# Go-specific hooks - using TekWizely (maintained alternative)
16+
- repo: https://github.com/TekWizely/pre-commit-golang
17+
rev: v1.0.0-rc.1
18+
hooks:
19+
# Go formatting (gofmt is built into Go)
20+
- id: go-fmt
21+
22+
# Go vet (static analysis) - using repo-based to avoid package context issues
23+
- id: go-vet-repo-mod
24+
25+
# Go mod tidy
26+
- id: go-mod-tidy-repo
27+
28+
# Go build
29+
- id: go-build-repo-mod
30+
31+
# Go tests
32+
- id: go-test-repo-mod
33+
34+
# Comprehensive linting with golangci-lint (includes import formatting)
35+
- id: golangci-lint-repo-mod
36+
args: [--timeout=5m]
37+
38+
# Exclude patterns
39+
exclude: |
40+
(?x)^(
41+
\.git/|
42+
vendor/|
43+
.*\.pb\.go$|
44+
.*_generated\.go$
45+
)$

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test-mcp-memory:
5959
.PHONY: security-scan gosec
6060
security-scan: gosec nancy
6161

62-
gosec:
62+
gosec:
6363
docker run --rm -w /mcp-lsp-bridge/ -v $$(pwd):/mcp-lsp-bridge securego/gosec /mcp-lsp-bridge/...
6464
nancy:
6565
go list -json -deps ./... | docker run --rm -i sonatypecommunity/nancy:latest sleuth
@@ -93,22 +93,22 @@ vet:
9393
build-all: clean
9494
@echo "Building for multiple platforms..."
9595
@mkdir -p $(DIST_DIR)
96-
96+
9797
# Linux amd64
9898
GOOS=linux GOARCH=amd64 go build -o $(DIST_DIR)/$(BINARY_NAME)-linux-amd64 -ldflags "-X main.version=$(VERSION)" .
99-
99+
100100
# Linux arm64
101101
GOOS=linux GOARCH=arm64 go build -o $(DIST_DIR)/$(BINARY_NAME)-linux-arm64 -ldflags "-X main.version=$(VERSION)" .
102-
102+
103103
# macOS amd64
104104
GOOS=darwin GOARCH=amd64 go build -o $(DIST_DIR)/$(BINARY_NAME)-darwin-amd64 -ldflags "-X main.version=$(VERSION)" .
105-
105+
106106
# macOS arm64
107107
GOOS=darwin GOARCH=arm64 go build -o $(DIST_DIR)/$(BINARY_NAME)-darwin-arm64 -ldflags "-X main.version=$(VERSION)" .
108-
108+
109109
# Windows amd64
110110
GOOS=windows GOARCH=amd64 go build -o $(DIST_DIR)/$(BINARY_NAME)-windows-amd64.exe -ldflags "-X main.version=$(VERSION)" .
111-
111+
112112
# Windows arm64
113113
GOOS=windows GOARCH=arm64 go build -o $(DIST_DIR)/$(BINARY_NAME)-windows-arm64.exe -ldflags "-X main.version=$(VERSION)" .
114114

@@ -117,15 +117,15 @@ build-all: clean
117117
dist: build-all
118118
@echo "Creating distribution packages..."
119119
@mkdir -p $(DIST_DIR)/packages
120-
120+
121121
# Create tar.gz for Linux and macOS
122122
for binary in $(DIST_DIR)/$(BINARY_NAME)-linux-* $(DIST_DIR)/$(BINARY_NAME)-darwin-*; do \
123123
if [ -f "$$binary" ]; then \
124124
basename=$$(basename $$binary); \
125125
tar -czf $(DIST_DIR)/packages/$$basename.tar.gz -C $(DIST_DIR) $$basename; \
126126
fi \
127127
done
128-
128+
129129
# Create zip for Windows
130130
for binary in $(DIST_DIR)/$(BINARY_NAME)-windows-*.exe; do \
131131
if [ -f "$$binary" ]; then \

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ When adding new tool documentation:
5151
1. Add detailed guides to `tools/`
5252
2. Update `tools/tools-reference.md` with basic info
5353
3. Update this README if adding new categories
54-
4. Link from relevant overview documents
54+
4. Link from relevant overview documents

docs/analysis-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Quick overview of the main analysis and exploration tools in MCP-LSP Bridge.
88
The most powerful analysis tool with 9 different analysis types:
99

1010
- **File Analysis**: Complexity metrics, code quality, recommendations
11-
- **Pattern Analysis**: Error handling, naming conventions, architecture patterns
11+
- **Pattern Analysis**: Error handling, naming conventions, architecture patterns
1212
- **Workspace Analysis**: Project-wide overview and health metrics
1313
- **Symbol Analysis**: References, definitions, relationships
1414
- **Text Search**: Find patterns across codebase
@@ -72,4 +72,4 @@ Smart symbol search with context-aware filtering:
7272
- **`format_document`**: Format code with preview/apply modes
7373
- **`rename`**: Safely rename symbols across codebase
7474

75-
See [tools-reference.md](tools/tools-reference.md) for complete tool list.
75+
See [tools-reference.md](tools/tools-reference.md) for complete tool list.

docs/codebase-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Comprehensive overview of the MCP-LSP Bridge codebase structure and functionalit
127127

128128
## 🔄 Key Data Flow
129129

130-
1. **MCP Request**`mcpserver/tools/*.go`
130+
1. **MCP Request**`mcpserver/tools/*.go`
131131
2. **Tool Processing**`bridge/bridge.go`
132132
3. **LSP Communication**`lsp/client.go`
133133
4. **Analysis (if needed)**`analysis/engine.go`

docs/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
A valid `lsp_config.json` file is required for the bridge to function. The bridge needs:
66

77
- Language server definitions (gopls, pyright-langserver, etc.)
8-
- File extension to language mappings
8+
- File extension to language mappings
99
- LSP server connection parameters
1010

1111
## Command-Line Options
@@ -132,4 +132,4 @@ COPY lsp_config.json /home/user/.config/mcp-lsp-bridge/lsp_config.json
132132

133133
# Set the command to run when the container starts
134134
CMD ["mcp-lsp-bridge"]
135-
```
135+
```

docs/tools/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Complete documentation for all MCP-LSP Bridge tools.
1616
- Symbol relationships and impact analysis
1717
- Complete examples and sample outputs
1818

19-
**[symbol-exploration-guide.md](symbol-exploration-guide.md)** - Guide for the `symbol_explore` tool
19+
**[symbol-exploration-guide.md](symbol-exploration-guide.md)** - Guide for the `symbol_explore` tool
2020
- Intelligent symbol search
2121
- Context-aware filtering
2222
- Progressive detail levels
@@ -33,7 +33,7 @@ New to the tools? Start here:
3333
## 🏗️ Tool Categories
3434

3535
- **Analysis & Discovery**: `project_analysis`, `symbol_explore`, `get_range_content`, `analyze_code`
36-
- **Language Detection**: `detect_project_languages`, `infer_language`
36+
- **Language Detection**: `detect_project_languages`, `infer_language`
3737
- **Connection Management**: `lsp_connect`, `lsp_disconnect`
3838
- **Code Intelligence**: `hover`, `signature_help`, `semantic_tokens`, `workspace_diagnostics`
3939
- **Safe Refactoring**: `code_actions`, `format_document`, `rename` (with preview/apply modes)
@@ -43,4 +43,4 @@ New to the tools? Start here:
4343
## 📚 Other Documentation
4444

4545
- **[../configuration.md](../configuration.md)** - Setup and configuration
46-
- **[../README.md](../../README.md)** - Main project documentation
46+
- **[../README.md](../../README.md)** - Main project documentation

docs/tools/project-analysis-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,4 @@ The analysis automatically detects and works with multiple programming languages
331331
Example with Python file:
332332
```bash
333333
● project_analysis (MCP)(analysis_type: "file_analysis", query: "scripts/test_mcp_tools.py")
334-
```
334+
```

docs/tools/symbol-exploration-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ Finds symbols in test files or test directories.
228228
● symbol_explore (MCP)(query: "Service", file_context: "service")
229229
```
230230

231-
The `symbol_explore` tool is designed to be your first stop when exploring unfamiliar codebases or when you need to quickly locate and understand symbols across your project.
231+
The `symbol_explore` tool is designed to be your first stop when exploring unfamiliar codebases or when you need to quickly locate and understand symbols across your project.

0 commit comments

Comments
 (0)