Skip to content

Commit 775d6b4

Browse files
committed
docs: update CONTRIBUTING.md
Signed-off-by: Fred Bricon <fbricon@gmail.com>
1 parent 9971575 commit 775d6b4

1 file changed

Lines changed: 268 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 268 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,274 @@
1-
## Contributing
1+
# Contributing to Red Hat Telemetry Collection API
22

3-
### Certificate of Origin
3+
Thank you for your interest in contributing to the Red Hat Telemetry Collection API! This document provides guidelines and instructions for contributing to this project.
4+
5+
## Table of Contents
6+
7+
- [Getting Started](#getting-started)
8+
- [Development Setup](#development-setup)
9+
- [Building the Project](#building-the-project)
10+
- [Testing](#testing)
11+
- [Commit Conventions](#commit-conventions)
12+
- [Pull Request Process](#pull-request-process)
13+
- [Certificate of Origin](#certificate-of-origin)
14+
15+
## Getting Started
16+
17+
### Prerequisites
18+
19+
Before you begin, ensure you have the following installed:
20+
21+
- **Node.js** (version 18 or higher)
22+
- **npm** (comes with Node.js)
23+
- **Git**
24+
25+
### Cloning the Repository
26+
27+
1. Fork the repository on GitHub
28+
2. Clone your fork locally:
29+
30+
```bash
31+
git clone https://github.com/YOUR_USERNAME/vscode-redhat-telemetry.git
32+
cd vscode-redhat-telemetry
33+
```
34+
35+
3. Add the upstream repository as a remote:
36+
37+
```bash
38+
git remote add upstream https://github.com/redhat-developer/vscode-redhat-telemetry.git
39+
```
40+
41+
## Development Setup
42+
43+
### Installing Dependencies
44+
45+
Install all project dependencies:
46+
47+
```bash
48+
npm install
49+
```
50+
51+
This will install:
52+
- TypeScript and build tools
53+
- Testing frameworks (Mocha, Chai)
54+
- Linting tools (ESLint)
55+
- Commit linting tools (commitlint, husky)
56+
- Webpack for bundling
57+
58+
### Project Structure
59+
60+
The project is organized as follows:
61+
62+
```
63+
src/
64+
├── common/ # Shared code for all platforms
65+
│ ├── api/ # Core telemetry API
66+
│ ├── impl/ # Implementation details
67+
│ ├── utils/ # Utility functions
68+
│ └── vscode/ # VS Code specific utilities
69+
├── node/ # Node.js specific implementations
70+
├── webworker/ # Web worker specific implementations
71+
└── tests/ # Test files
72+
```
73+
74+
## Building the Project
75+
76+
### Development Build
77+
78+
To build the project for development:
79+
80+
```bash
81+
npm run build
82+
```
83+
84+
This command will:
85+
1. Clean the `lib/` directory
86+
2. Copy configuration files
87+
3. Compile TypeScript to JavaScript
88+
89+
### Production Build
90+
91+
For a production build with webpack bundling:
92+
93+
```bash
94+
npm run package
95+
```
96+
97+
### Available Scripts
98+
99+
- `npm run clean` - Remove the `lib/` directory
100+
- `npm run copy-files` - Copy configuration files to lib
101+
- `npm run compile` - Compile TypeScript files
102+
- `npm run build` - Full build process (clean + copy + compile)
103+
- `npm run package` - Build and bundle with webpack
104+
- `npm run prepublish` - Build for publishing
105+
106+
## Testing
107+
108+
### Running Tests
109+
110+
Run the test suite:
111+
112+
```bash
113+
npm test
114+
```
115+
116+
### Running Tests with Coverage
117+
118+
Generate test coverage reports:
119+
120+
```bash
121+
npm run coverage
122+
```
123+
124+
Coverage reports will be generated in the `coverage/` directory.
125+
126+
### Test Structure
127+
128+
Tests are located in `src/tests/` and follow the naming pattern `*.test.ts`. The project uses:
129+
- **Mocha** as the test framework
130+
- **Chai** for assertions
131+
- **ts-node** for TypeScript support
132+
133+
## Commit Conventions
134+
135+
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification. All commit messages must follow this format:
136+
137+
```
138+
<type>: <description>
139+
140+
[optional body]
141+
142+
[optional footer(s)]
143+
```
144+
145+
### Commit Types
146+
147+
- `feat`: A new feature
148+
- `fix`: A bug fix
149+
- `docs`: Documentation only changes
150+
- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
151+
- `refactor`: A code change that neither fixes a bug nor adds a feature
152+
- `perf`: A code change that improves performance
153+
- `test`: Adding missing tests or correcting existing tests
154+
- `chore`: Changes to the build process or auxiliary tools and libraries
155+
156+
### Examples
157+
158+
```bash
159+
feat: add support for custom telemetry endpoints
160+
fix(api): resolve memory leak in event queue
161+
docs: update contributing guidelines
162+
test: add unit tests for telemetry service
163+
chore: update dependencies to latest versions
164+
```
165+
166+
### Commit Message Validation
167+
168+
The project uses [commitlint](https://commitlint.js.org/) to validate commit messages. This is enforced via a Git hook that runs automatically when you commit.
169+
170+
If your commit message doesn't follow the conventional format, the commit will be rejected with an error message explaining what needs to be fixed.
171+
172+
## Pull Request Process
173+
174+
1. **Create a Feature Branch**
175+
```bash
176+
git checkout -b feature/your-feature-name
177+
```
178+
179+
2. **Make Your Changes**
180+
- Write your code following the existing patterns
181+
- Add tests for new functionality
182+
- Update documentation if needed
183+
184+
3. **Test Your Changes**
185+
```bash
186+
npm test
187+
npm run build
188+
```
189+
190+
4. **Commit Your Changes**
191+
```bash
192+
git add .
193+
git commit -m "feat: add your feature description"
194+
```
195+
196+
5. **Push to Your Fork**
197+
```bash
198+
git push origin feature/your-feature-name
199+
```
200+
201+
6. **Create a Pull Request**
202+
- Go to your fork on GitHub
203+
- Click "New Pull Request"
204+
- Select your feature branch
205+
- Fill out the PR template with a clear description
206+
207+
### Pull Request Guidelines
208+
209+
- **Title**: Use a clear, descriptive title
210+
- **Description**: Explain what changes you made and why
211+
- **Tests**: Ensure all tests pass
212+
- **Documentation**: Update relevant documentation
213+
- **Breaking Changes**: Clearly mark any breaking changes
214+
215+
## Certificate of Origin
4216

5217
By contributing to this project you agree to the Developer Certificate of
6218
Origin (DCO). This document was created by the Linux Kernel community and is a
7219
simple statement that you, as a contributor, have the legal right to make the
8220
contribution. See the [DCO](DCO) file for details.
221+
222+
### Signing Your Commits
223+
224+
Each commit must be signed off to indicate your agreement with the DCO. You can do this by adding the `-s` flag when committing:
225+
226+
```bash
227+
git commit -s -m "feat: add new telemetry feature"
228+
```
229+
230+
Or by adding the sign-off line manually:
231+
232+
```
233+
feat: add new telemetry feature
234+
235+
Signed-off-by: Your Name <your.email@example.com>
236+
```
237+
238+
## Development Tips
239+
240+
### VS Code Setup
241+
242+
For the best development experience, we recommend:
243+
244+
1. Install the recommended VS Code extensions
245+
2. Use the provided TypeScript configuration
246+
3. Enable format on save
247+
248+
### Debugging
249+
250+
To debug telemetry during development, set the environment variable:
251+
252+
```bash
253+
export VSCODE_REDHAT_TELEMETRY_DEBUG=true
254+
```
255+
256+
This will log telemetry events to the console instead of sending them to Red Hat servers.
257+
258+
### Code Style
259+
260+
The project uses ESLint for code formatting and style enforcement. Run the linter:
261+
262+
```bash
263+
npx eslint src/
264+
```
265+
266+
## Getting Help
267+
268+
- **Issues**: Use GitHub Issues for bug reports and feature requests
269+
- **Discussions**: Use GitHub Discussions for questions and general discussion
270+
- **Documentation**: Check the README.md for usage examples
271+
272+
## License
273+
274+
By contributing, you agree that your contributions will be licensed under the Apache-2.0 license.

0 commit comments

Comments
 (0)