|
| 1 | +# Contributing to StackRox MCP |
| 2 | + |
| 3 | +Thank you for your interest in contributing to StackRox MCP! This document provides guidelines and instructions for contributing to the project. |
| 4 | + |
| 5 | +## Development Guidelines |
| 6 | + |
| 7 | +### Code Quality Standards |
| 8 | + |
| 9 | +All code must pass the following checks before being merged: |
| 10 | + |
| 11 | +- **Formatting:** Run `go fmt ./...` to format your code |
| 12 | +- **Linting:** Run `golint ./...` to check for style issues |
| 13 | +- **Vetting:** Run `go vet ./...` to check for suspicious constructs |
| 14 | +- **Testing:** All tests must pass with `go test ./...` |
| 15 | + |
| 16 | +These checks are automatically run in CI for all pull requests. |
| 17 | + |
| 18 | +### Testing |
| 19 | + |
| 20 | +- Write unit tests for all new functionality |
| 21 | +- Aim for 80% code coverage |
| 22 | +- All error paths tested |
| 23 | +- Run tests with coverage: |
| 24 | + ```bash |
| 25 | + go test -cover ./... |
| 26 | + ``` |
| 27 | +- Generate detailed coverage report: |
| 28 | + ```bash |
| 29 | + go test -coverprofile=coverage.out ./... |
| 30 | + go tool cover -html=coverage.out |
| 31 | + ``` |
| 32 | + |
| 33 | +## Pull Request Guidelines |
| 34 | + |
| 35 | +### Creating a PR |
| 36 | + |
| 37 | +- **Title:** |
| 38 | + - The title of your PR should be clear and descriptive. |
| 39 | + - It should be short enough to fit into the title box. |
| 40 | + - **PR addresses JIRA ticket:** `ROX-1234: Add feature ABC` |
| 41 | + - **Otherwise use conventional commit style:** `<type>(<scope>): <description>` |
| 42 | + - Types: `fix`, `docs`, `test`, `refactor`, `chore`, `ci` |
| 43 | + - Example: `fix(builds): Fix builds for ABC architecture` |
| 44 | + |
| 45 | +- **Description:** |
| 46 | + - Describe the motivation for this change, or why some things were done a certain way. |
| 47 | + - Focus on what cannot be extracted from the code, e.g., alternatives considered and dismissed (and why), performance concerns, non-evident edge cases. |
| 48 | + |
| 49 | +- **Validation:** |
| 50 | + - Provide information that can help the PR reviewer test changes and validate they are correct. |
| 51 | + - In some cases, it will be sufficient to mention that unit tests are added and they cover the changes. |
| 52 | + - In other cases, testing may be more complex, and providing steps on how to set up and test everything will be very valuable for reviewers. |
| 53 | + |
| 54 | +### Merging a PR |
| 55 | + |
| 56 | +- Make sure that **all CI statuses are green**. |
| 57 | +- Always use `Squash and merge` as the merging mode (default). |
| 58 | +- Double-check that the title of the commit ("subject line") is **your PR title**, followed by the PR number prefixed with a `#` in parentheses. |
| 59 | +- Merge commit message example: `ROX-1234: Add feature ABC (#5678)`. |
| 60 | +- The body of the commit message should be empty. If GitHub pre-populates it, delete it. |
| 61 | + |
| 62 | +## Code Review Process |
| 63 | + |
| 64 | +- All PRs require at least one approval before merging |
| 65 | +- Address all reviewer comments and suggestions |
| 66 | +- Keep PRs focused and reasonably sized |
| 67 | +- Respond to feedback in a timely manner |
| 68 | + |
| 69 | +## License |
| 70 | + |
| 71 | +By contributing to StackRox MCP, you agree that your contributions will be licensed under the Apache License 2.0. |
0 commit comments