|
| 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 | +## Getting Started |
| 6 | + |
| 7 | +Before contributing, get the project running locally: |
| 8 | + |
| 9 | +### Initial Setup |
| 10 | + |
| 11 | +Clone the repository: |
| 12 | +```bash |
| 13 | +git clone https://github.com/stackrox/stackrox-mcp.git |
| 14 | +cd stackrox-mcp |
| 15 | +``` |
| 16 | + |
| 17 | +Build the project: |
| 18 | +```bash |
| 19 | +make build |
| 20 | +``` |
| 21 | + |
| 22 | +Run the server: |
| 23 | +```bash |
| 24 | +./stackrox-mcp |
| 25 | +``` |
| 26 | + |
| 27 | +Once you have the project running, familiarize yourself with the development workflow below. |
| 28 | + |
| 29 | +## Development Guidelines |
| 30 | + |
| 31 | +### Code Quality Standards |
| 32 | + |
| 33 | +All code must pass the following checks before being merged: |
| 34 | + |
| 35 | +- **Formatting:** Run `make fmt` to format your code |
| 36 | +- **Format Check:** Run `make fmt-check` to verify code is formatted |
| 37 | +- **Linting:** Run `make lint` to check for style issues |
| 38 | +- **Testing:** All tests must pass with `make test` |
| 39 | + |
| 40 | +These checks are automatically run in CI for all pull requests. |
| 41 | + |
| 42 | +### Available Make Targets |
| 43 | + |
| 44 | +View all available make commands: |
| 45 | +```bash |
| 46 | +make help |
| 47 | +``` |
| 48 | + |
| 49 | +Common development commands: |
| 50 | +- `make build` - Build the binary |
| 51 | +- `make test` - Run unit tests with coverage |
| 52 | +- `make coverage-html` - Generate and view HTML coverage report |
| 53 | +- `make fmt` - Format code |
| 54 | +- `make fmt-check` - Check code formatting (fails if not formatted) |
| 55 | +- `make lint` - Run golangci-lint |
| 56 | +- `make clean` - Clean build artifacts and coverage files |
| 57 | + |
| 58 | +### Testing |
| 59 | + |
| 60 | +- Write unit tests for all new functionality |
| 61 | +- Aim for 80% code coverage |
| 62 | +- All error paths should be tested |
| 63 | +- Run tests with coverage: |
| 64 | + ```bash |
| 65 | + make test |
| 66 | + ``` |
| 67 | +- Generate and view detailed coverage report: |
| 68 | + ```bash |
| 69 | + make coverage-html |
| 70 | + ``` |
| 71 | + |
| 72 | +## Pull Request Guidelines |
| 73 | + |
| 74 | +### Creating a PR |
| 75 | + |
| 76 | +- **Title:** |
| 77 | + - The title of your PR should be clear and descriptive. |
| 78 | + - It should be short enough to fit into the title box. |
| 79 | + - **PR addresses JIRA ticket:** `ROX-1234: Add feature ABC` |
| 80 | + - **Otherwise use conventional commit style:** `<type>(<scope>): <description>` |
| 81 | + - Types: `fix`, `docs`, `test`, `refactor`, `chore`, `ci` |
| 82 | + - Example: `fix(builds): Fix builds for ABC architecture` |
| 83 | + |
| 84 | +- **Description:** |
| 85 | + - Describe the motivation for this change, or why some things were done a certain way. |
| 86 | + - Focus on what cannot be extracted from the code, e.g., alternatives considered and dismissed (and why), performance concerns, non-evident edge cases. |
| 87 | + |
| 88 | +- **Validation:** |
| 89 | + - Provide information that can help the PR reviewer test changes and validate they are correct. |
| 90 | + - In some cases, it will be sufficient to mention that unit tests are added and they cover the changes. |
| 91 | + - 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. |
| 92 | + |
| 93 | +### Merging a PR |
| 94 | + |
| 95 | +- Make sure that **all CI statuses are green**. |
| 96 | +- Always use `Squash and merge` as the merging mode (default). |
| 97 | +- Double-check that the title of the commit ("subject line") is **your PR title**, followed by the PR number prefixed with a `#` in parentheses. |
| 98 | +- Merge commit message example: `ROX-1234: Add feature ABC (#5678)`. |
| 99 | +- The body of the commit message should be empty. If GitHub pre-populates it, delete it. |
| 100 | + |
| 101 | +## Code Review Process |
| 102 | + |
| 103 | +- All PRs require at least one approval before merging |
| 104 | +- Address all reviewer comments and suggestions |
| 105 | +- Keep PRs focused and reasonably sized |
| 106 | +- Respond to feedback in a timely manner |
| 107 | + |
| 108 | +## License |
| 109 | + |
| 110 | +By contributing to StackRox MCP, you agree that your contributions will be licensed under the Apache License 2.0. |
0 commit comments