Thank you for your interest in contributing to our PowerShell module! This document provides guidelines to ensure consistency and quality across all contributions.
- Getting Started
- Development Environment Setup
- Coding Standards
- Documentation Requirements
- Testing Guidelines
- Pull Request Process
- Issue Reporting
- Community Expectations
- Fork the repository to your GitHub account
- Clone your fork to your local development environment
- Create a new branch for your contribution (use a descriptive name related to your change)
- Make your changes following our guidelines below
- Submit a pull request back to the main repository
- PowerShell 5.1 or PowerShell Core 7.x
- VS Code with PowerShell extension (recommended)
- Pester 5.x for testing
- PSScriptAnalyzer for linting
# Install required modules if you don't have them
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force
Install-Module -Name PSScriptAnalyzer -Force
# Clone the repository
git clone https://github.com/YOUR-USERNAME/powershell-module.git
cd powershell-module
# Set up pre-commit hooks (optional but recommended)
./scripts/setup-dev-environment.ps1- Use PascalCase for function names, parameter names, and variable names
- Use Approved Verbs for functions (use
Get-Verbto see the list) - Use singular nouns for cmdlet names (e.g.,
Get-UsernotGet-Users) - Use descriptive names that clearly indicate purpose
- Each function should be in its own file named after the function
- Group related functions in appropriately named subdirectories
- Use the standard PowerShell module structure
- Place internal/helper functions in a
Privatedirectory
- Use 4 spaces for indentation (not tabs)
- Follow PowerShell Best Practices
- Limit line length to 100 characters where possible
- Include a blank line between logical sections of code
- Always use
{}for script blocks, even one-liners
# Good example
function Get-Example {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$Name
)
process {
# Function logic here
}
}Every function must include comment-based help with:
- Synopsis
- Description
- At least one example
- All parameters documented
- Any outputs described
Example:
<#
.SYNOPSIS
Retrieves user information from the system.
.DESCRIPTION
The Get-UserInfo function retrieves detailed information about users
in the system based on specified filters.
.PARAMETER Username
The username to retrieve information for.
.EXAMPLE
Get-UserInfo -Username "john.doe"
Retrieves information for user john.doe.
.OUTPUTS
System.Object. Returns a custom object with user properties.
#>If your contribution adds new functionality, update the module README.md to reflect these changes.
Significant changes should be noted in the CHANGELOG.md file.
All contributions must include Pester tests that:
- Cover new functionality
- Verify bug fixes
- Maintain or improve code coverage
# Run all tests
Invoke-Pester
# Run tests for a specific function
Invoke-Pester -Path "./tests/Get-Example.Tests.ps1"- Tests should be in the
testsdirectory - Test files should be named
<FunctionName>.Tests.ps1 - Use descriptive test names that explain what is being tested
- Include both positive and negative test cases
- Ensure all tests pass locally before submitting
- Run PSScriptAnalyzer to check for style issues:
Invoke-ScriptAnalyzer -Path ./path/to/your/script.ps1
- Update documentation as needed
- Create a pull request with a clear title and description
- Link any related issues in your PR description
- Be responsive to code review feedback
## Description
[Brief description of the changes]
## Related Issue
[Link to the related issue(s)]
## Motivation and Context
[Why is this change required? What problem does it solve?]
## How Has This Been Tested?
[Description of tests that you ran]
## Types of changes
- [ ] 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 change)
When reporting issues:
- Use the issue template if provided
- Include PowerShell version (
$PSVersionTable) - Provide steps to reproduce the issue
- Include expected vs. actual behavior
- Add any error messages or screenshots
All contributors are expected to adhere to our Code of Conduct.
- Pull requests require at least one maintainer review
- Feedback should be addressed before merging
- Be patient - maintainers will review PRs as time permits
Contributors will be recognized in the project:
- Added to CONTRIBUTORS.md file
- Mentioned in release notes for significant contributions
Thank you for contributing to our community PowerShell module! Your efforts help make this tool better for everyone.