Thank you for your interest in contributing to DevSetup! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Testing
- Coding Standards
- Pull Request Process
- Reporting Issues
By participating in this project, you are expected to uphold our code of conduct. Please be respectful and constructive in all interactions.
- PowerShell 5.1+
- Pester 5.0+ for running tests
- Git for version control
- A code editor with PowerShell support (recommended: VS Code with PowerShell extension)
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/pwshdevs/devsetup.git cd devsetup
- Add the upstream repository:
git remote add upstream https://github.com/pwshdevs/devsetup.git
- Install the module in development mode:
.\install.ps1 -self
devsetup/
├── DevSetup/ # Main module directory
│ ├── DevSetup.psd1 # Module manifest
│ ├── DevSetup.psm1 # Module script
│ ├── Private/ # Private functions
│ │ ├── Commands/ # Main command implementations
│ │ ├── Providers/ # Provider-specific functions
│ │ │ ├── Chocolatey/ # Chocolatey provider
│ │ │ ├── Scoop/ # Scoop provider
│ │ │ └── ...
│ │ └── Utils/ # Utility functions
│ └── Public/ # Public functions (module exports)
├── docs/ # Documentation
├── install.ps1 # Installation script
├── runTests.ps1 # Test runner
└── runSecurity.ps1 # Security checks
# Run all tests
.\runTests.ps1
# Run tests for a specific file
Invoke-Pester -Path "DevSetup\Private\Providers\Scoop\*.Tests.ps1"
# Run tests with coverage
Invoke-Pester -Path "DevSetup\Private\Providers\Scoop\*.Tests.ps1" -CodeCoverage "DevSetup\Private\Providers\Scoop\*.ps1"# Run security analysis
.\runSecurity.ps1- Feature branches:
feature/description-of-feature - Bug fixes:
fix/description-of-fix - Documentation:
docs/description-of-change - Tests:
test/description-of-test-change
Use clear, descriptive commit messages following conventional commits:
feat: add new scoop package providerfix: resolve chocolatey installation issuedocs: update installation instructionstest: add comprehensive tests for Install-ScoopPackagerefactor: improve error handling in Uninstall-ScoopBucket
- All new functions MUST have comprehensive tests
- Aim for 100% code coverage on new code
- Follow existing test patterns in the codebase
- Test both success and failure scenarios
- Include edge cases and error handling
BeforeAll {
# Dot-source the function and dependencies
. $PSScriptRoot\YourFunction.ps1
. $PSScriptRoot\..\..\Utils\Write-StatusMessage.ps1
# Global mocks if needed
Mock Write-StatusMessage { }
}
Describe "YourFunction" {
BeforeEach {
# Reset state before each test
$global:LASTEXITCODE = 0
}
Context "When normal operation succeeds" {
It "Should return expected result" {
# Test implementation
}
}
Context "When error conditions occur" {
It "Should handle errors gracefully" {
# Test error handling
}
}
}- Use PSCustomObject for YAML data to match
Assert-DevSetupEnvValidrequirements - Mock external dependencies (commands, file operations, etc.)
- Test WhatIf/ShouldProcess functionality for functions that support it
- Verify parameter validation and edge cases
- Test exception handling with proper error logging
- Use approved verbs for function names (
Get-,Set-,Install-, etc.) - Follow PascalCase for function names and parameters
- Use full parameter names in scripts (avoid aliases)
- Include comprehensive help documentation with examples
- Use
[CmdletBinding()]for advanced functions - Implement proper error handling with try/catch blocks
- Support WhatIf/Confirm for functions that make changes
<#
.SYNOPSIS
Brief description of what the function does.
.DESCRIPTION
Detailed description with comprehensive information.
.PARAMETER ParameterName
Description of the parameter.
.OUTPUTS
[System.Type]
Description of what the function returns.
.EXAMPLE
FunctionName -Parameter "value"
Description of what this example does.
.NOTES
Additional implementation notes, requirements, or caveats.
#>
Function FunctionName {
[CmdletBinding(SupportsShouldProcess=$true)]
Param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ParameterName
)
# Implementation with proper error handling
try {
if ($PSCmdlet.ShouldProcess($target, $operation)) {
# Perform the operation
} else {
Write-StatusMessage "Skipping operation due to ShouldProcess" -Verbosity Debug
return $true
}
} catch {
Write-StatusMessage "Error message: $_" -Verbosity Error
Write-StatusMessage $_.ScriptStackTrace -Verbosity Error
return $false
}
}- Use try/catch blocks for operations that may fail
- Log both error messages and stack traces using
Write-StatusMessage - Return boolean values for success/failure indication
- Continue processing when possible (don't fail fast unless critical)
When adding new providers:
- Follow existing provider patterns (see Scoop/Chocolatey examples)
- Implement core functions: Install, Uninstall, Test-Installed, Find-Provider
- Support batch operations with comprehensive progress reporting
- Include cache management if applicable
- Handle both simple and complex object formats in configurations
- Ensure all tests pass:
.\runTests.ps1 - Run security analysis:
.\runSecurity.ps1 - Update documentation if needed
- Add tests for new functionality
- Follow coding standards
## Description
Brief description of changes made.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] Added tests for new functionality
- [ ] Code coverage maintained/improved
## Screenshots (if applicable)
## Additional Notes
Any additional information or context.- Automated checks must pass (tests, security analysis)
- Code review by at least one maintainer
- Documentation review if docs are changed
- Final approval and merge by maintainer
When reporting bugs, please include:
- PowerShell version (
$PSVersionTable) - Operating system and version
- Steps to reproduce the issue
- Expected vs actual behavior
- Error messages or stack traces
- Relevant configuration (sanitized)
For new features:
- Describe the use case and problem being solved
- Provide examples of how it would be used
- Consider implementation complexity and maintenance burden
- Check existing issues to avoid duplicates
bug: Something isn't workingenhancement: New feature or requestdocumentation: Improvements or additions to documentationgood first issue: Good for newcomershelp wanted: Extra attention is neededquestion: Further information is requested
- Use
Write-StatusMessagewith-Verbosity Debugfor debugging output - Test with
-WhatIfparameter to see what would happen without making changes - Use
Get-DevSetupEnvListto see available environments for testing
# Test Scoop provider functions
Invoke-Pester -Path "DevSetup\Private\Providers\Scoop\*.Tests.ps1" -Output Detailed
# Test with coverage
Invoke-Pester -Path "DevSetup\Private\Providers\Scoop\Install-ScoopPackage.Tests.ps1" -CodeCoverage "DevSetup\Private\Providers\Scoop\Install-ScoopPackage.ps1"- Use
Assert-DevSetupEnvValidstructure for test data - Create
PSCustomObjectstructures rather than hashtables - Test both simple strings and complex objects in configurations
If you have questions that aren't covered in this guide:
- Check existing Issues
- Start a Discussion
- Review the Documentation
Thank you for contributing to DevSetup! 🎉