Skills.MD
# PR Review
Perform a comprehensive review of pull requests for the oc repository, which is a CLI tool based on kubectl that provides kubectl commands plus OpenShift-specific functionality.
## When to Apply
Use this skill when:
- Reviewing a pull request
- User asks to review code changes
- User requests `/pr-review` or similar commands
## Review Process
Follow these steps in order:
### 1. Dependencies Verification
Ensure Go dependencies are consistent by running:
- `go mod tidy -diff`
- This command ensures that `go.mod` and `go.sum` are consistent and match the source code in the module.
### 2. Build Verification
Run the build to ensure code compiles:
```bash
make oc
```
- If build fails, report errors and stop the review
- If build succeeds, proceed to testing
- Note: Use `make oc` instead of `make build` to avoid building for all architectures (faster)
### 3. Code Verification
Run verification checks to catch style and potential issues:
```bash
make verify
```
This runs multiple verification targets including:
- `verify-gofmt` - Go formatting checks
- `verify-golint` - Linting checks
- `verify-govet` - Go vet checks
- `verify-cli-conventions` - CLI-specific conventions
- `verify-generated-completions` - Generated code verification
- Report any verification errors or warnings
- Note any patterns that need addressing
### 4. Test Execution
Run the test suite to verify functionality:
```bash
make test
```
- Report any test failures with details
- If critical tests fail, flag for immediate attention
- Proceed even if some tests fail (document them)
- **Known Issue**: Test failure in `github.com/openshift/oc/pkg/cli` (kubeconfig error) can be ignored
### 5. Code Review & Go Style Application
After running the above checks, review the changed code and apply Go best practices.
Start by:
- Load changes against the base branch by using `git diff`.
The base branch is `main` by default, but it can be overwritten by `[base-git-branch]`
argument when this skill is invoked using `pr-review` command directly.
- Understand the scope of the changes.
Then proceed to review. Follow these steps:
- **Effective Go Principles**: Apply the Effective Go skill automatically
- Use `gofmt` for formatting
- Follow Go naming conventions (MixedCaps/mixedCaps, no underscores)
- Ensure proper error handling (no ignored errors)
- Check for idiomatic Go patterns
- **oc-Specific Considerations**:
- Ensure kubectl compatibility is maintained
- Verify OpenShift-specific commands follow existing patterns
- Check that CLI output follows consistent formatting
- Validate flag definitions match kubectl conventions where applicable
- **Breaking Changes**:
- Ensure that the command line API is backwards-compatible
- Check for CLI flag removals or renames
- Check for changes in command line arguments
- **Code Quality**:
- Look for potential race conditions
- Check for resource leaks (unclosed files, connections, goroutine leaks)
- Goroutine leak patterns to watch:
- Goroutines without context cancellation handling
- Missing `select` with `ctx.Done()` case
- Unbounded channel operations without timeouts
- `go func()` without proper lifecycle management
- Use `errgroup` or `sync.WaitGroup` for coordinated goroutines
- Verify proper context propagation
- Ensure appropriate logging levels
- **Documentation**:
- All exported functions/types should have doc comments
- CLI command help text should be clear and complete
- Complex logic should have explanatory comments
### 6. Apply Fixes
Based on the review:
- Fix any linting issues automatically where safe
- Apply `gofmt` and `goimports` formatting
- Suggest or implement idiomatic Go improvements
- Document any issues that require manual review
### 7. Summary
Provide a structured summary:
- ✅ Build status
- ✅ Test results (pass/fail counts)
- ✅ Linting status
- 📝 Code quality observations
- 🔧 Changes applied (if any)
- ⚠️ Issues requiring attention
## Key Checks for oc
Since oc is built on kubectl:
- Verify upstream kubectl compatibility
- Check for proper use of kubectl libraries
- Ensure OpenShift-specific features are clearly separated
- Validate that CLI behavior matches kubectl conventions
## References
- [Effective Go](https://go.dev/doc/effective_go)
- [oc Repository](https://github.com/openshift/oc)
- [kubectl Conventions](https://kubernetes.io/docs/reference/kubectl/conventions/)
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「pr-review」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次