|
| 1 | +# Contributing to IoTPowerShellAgent |
| 2 | + |
| 3 | +Thank you for your interest in contributing to IoTPowerShellAgent! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +- Be respectful and inclusive |
| 8 | +- Welcome newcomers and help them learn |
| 9 | +- Focus on constructive feedback |
| 10 | +- Respect different viewpoints and experiences |
| 11 | + |
| 12 | +## Getting Started |
| 13 | + |
| 14 | +1. Fork the repository |
| 15 | +2. Clone your fork: `git clone https://github.com/Calvindd2f/IoTPowerShellAgent.git` |
| 16 | +3. Create a branch: `git checkout -b feature/your-feature-name` |
| 17 | +4. Make your changes |
| 18 | +5. Test your changes thoroughly |
| 19 | +6. Commit your changes: `git commit -m "Add feature: description"` |
| 20 | +7. Push to your fork: `git push origin feature/your-feature-name` |
| 21 | +8. Open a Pull Request |
| 22 | + |
| 23 | +## Development Setup |
| 24 | + |
| 25 | +### Prerequisites |
| 26 | + |
| 27 | +- .NET 8.0 SDK or later |
| 28 | +- Windows 10/11 or Windows Server 2016+ |
| 29 | +- PowerShell 5.1 or later |
| 30 | +- Visual Studio 2022 or VS Code (recommended) |
| 31 | + |
| 32 | +### Building |
| 33 | + |
| 34 | +```bash |
| 35 | +dotnet restore |
| 36 | +dotnet build |
| 37 | +``` |
| 38 | + |
| 39 | +### Running Tests |
| 40 | + |
| 41 | +```bash |
| 42 | +dotnet test |
| 43 | +``` |
| 44 | + |
| 45 | +## Coding Standards |
| 46 | + |
| 47 | +### C# Code Style |
| 48 | + |
| 49 | +- Use meaningful variable and method names |
| 50 | +- Follow C# naming conventions (PascalCase for public members, camelCase for private) |
| 51 | +- Use `using var` for disposable objects where appropriate |
| 52 | +- Add XML documentation comments for public APIs |
| 53 | +- Keep methods focused and single-purpose |
| 54 | + |
| 55 | +### PowerShell Code Style |
| 56 | + |
| 57 | +- Use approved verbs (Get-, Set-, New-, etc.) |
| 58 | +- Follow PowerShell naming conventions |
| 59 | +- Include help comments for functions |
| 60 | + |
| 61 | +### Error Handling |
| 62 | + |
| 63 | +- Always handle exceptions appropriately |
| 64 | +- Provide meaningful error messages |
| 65 | +- Log errors with appropriate severity levels |
| 66 | +- Use structured error details for PowerShell errors |
| 67 | + |
| 68 | +## Testing |
| 69 | + |
| 70 | +- Write unit tests for new features |
| 71 | +- Ensure existing tests pass |
| 72 | +- Test edge cases and error conditions |
| 73 | +- For PowerShell executor tests, consider using Pester integration |
| 74 | + |
| 75 | +### Running Pester Tests |
| 76 | + |
| 77 | +If you add Pester tests, run them with: |
| 78 | + |
| 79 | +```powershell |
| 80 | +Invoke-Pester -Path .\src\IoTPowerShellAgent.Tests.Pester\PowerShell\ |
| 81 | +``` |
| 82 | + |
| 83 | +## Pull Request Process |
| 84 | + |
| 85 | +1. Update documentation if needed |
| 86 | +2. Ensure all tests pass |
| 87 | +3. Update CHANGELOG.md if applicable |
| 88 | +4. Ensure your code follows the coding standards |
| 89 | +5. Request review from maintainers |
| 90 | +6. Address any feedback |
| 91 | + |
| 92 | +## Commit Messages |
| 93 | + |
| 94 | +Use clear, descriptive commit messages: |
| 95 | + |
| 96 | +- Use present tense ("Add feature" not "Added feature") |
| 97 | +- First line should be a summary (50 chars or less) |
| 98 | +- Include more details in the body if needed |
| 99 | +- Reference issues/PRs if applicable |
| 100 | + |
| 101 | +Examples: |
| 102 | + |
| 103 | +``` |
| 104 | +Add async execution with cancellation token support |
| 105 | +
|
| 106 | +Implements ExecutePowerShellAsync method with SemaphoreSlim |
| 107 | +throttling to prevent blocking IoT Hub listener thread. |
| 108 | +``` |
| 109 | + |
| 110 | +## Versioning |
| 111 | + |
| 112 | +This project uses [Semantic Versioning](https://semver.org/): |
| 113 | + |
| 114 | +- MAJOR version for incompatible API changes |
| 115 | +- MINOR version for backwards-compatible functionality |
| 116 | +- PATCH version for backwards-compatible bug fixes |
| 117 | + |
| 118 | +## Questions? |
| 119 | + |
| 120 | +If you have questions, please: |
| 121 | + |
| 122 | +- Open an issue for discussion |
| 123 | +- Check existing issues and discussions |
| 124 | +- Reach out to maintainers |
| 125 | + |
| 126 | +Thank you for contributing! |
0 commit comments