-
Notifications
You must be signed in to change notification settings - Fork 10
Contributing
Sebastian F. Markdanner edited this page Jul 30, 2025
·
2 revisions
Welcome to the comprehensive contributing guide for PIMActivation. This document provides detailed technical information for developers.
- Development Environment Setup
- Project Structure
- Coding Standards
- Testing Guidelines
- Pull Request Process
- Release Process
- AI-Assisted Development
- Windows 10/11 or Windows Server 2016+
- PowerShell 7+ (Download)
- Visual Studio Code with PowerShell extension (recommended)
- Git for version control
- GitHub account
# Fork and clone the repository
git clone https://github.com/Noble-Effeciency13/PIMActivation.git
cd PIMActivation
# Create development branch
git checkout -b feature/your-feature-name
# Install development dependencies
Install-Module -Name Pester -Scope CurrentUser -Force
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force
Install-Module -Name platyPS -Scope CurrentUser -Force
Install-Module -Name Az.Accounts -Scope CurrentUser -Force
# Import module for development
Import-Module .\PIMActivation.psd1 -Force
# Verify setup
$PSVersionTable.PSVersion # Should be 7.0 or higher
Get-Module PIMActivation- PowerShell (ms-vscode.powershell)
- GitLens (eamodio.gitlens)
- Markdown All in One (yzhang.markdown-all-in-one)
- Todo Tree (Gruntfuggly.todo-tree)
PIMActivation/
βββ PIMActivation.psd1 # Module manifest
βββ PIMActivation.psm1 # Root module
βββ Public/ # Exported functions
β βββ Start-PIMActivation.ps1 # Main entry point
βββ Private/ # Internal functions
β βββ Authentication/ # Auth handling
β βββ RoleManagement/ # PIM role operations
β βββ UI/ # GUI components
β βββ Utilities/ # Helper functions
β βββ Profiles/ # User profiles
βββ docs/ # Documentation
βββ Tests/ # Pester tests
βββ Resources/ # Icons, images
βββ .github/ # GitHub specific files
-
Public functions β
Public/directory (will be exported) -
Private functions β
Private/[Category]/directory (internal use)
function New-PIMFeature {
<#
.SYNOPSIS
Brief description (one line)
.DESCRIPTION
Detailed description of what the function does,
why it exists, and when to use it.
.PARAMETER ParameterName
Description of the parameter
.EXAMPLE
New-PIMFeature -ParameterName "Value"
Description of what this example does
.NOTES
Author: Your Name
Date: Current Date
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, HelpMessage = "Helpful message")]
[ValidateNotNullOrEmpty()]
[string]$ParameterName
)
begin {
Write-Verbose "Starting $($MyInvocation.MyCommand.Name)"
}
process {
try {
# Implementation
}
catch {
Write-Error "Failed to execute feature: $_"
throw
}
}
end {
Write-Verbose "Completed $($MyInvocation.MyCommand.Name)"
}
}-
Cmdlet Naming
- Use approved verbs:
Get-Verb | Sort-Object Verb - Follow Noun-Verb pattern:
Verb-PIMNoun
- Use approved verbs:
-
Parameter Guidelines
- Use parameter validation attributes
- Provide helpful parameter descriptions
- Include parameter help messages
-
Error Handling
try { # Risky operation } catch [System.Net.WebException] { Write-Error "Network error: $_" -ErrorAction Continue } catch { Write-Error "Unexpected error: $_" throw }
-
Output and Verbosity
- Use
Write-Verbosefor debug information - Use
Write-Warningfor important notices - Use
Write-Errorfor errors (notWrite-Host) - Return objects, not formatted text
- Use
- Indentation: 4 spaces (not tabs)
- Brace Style: Opening brace on same line
- Line Length: Max 120 characters
- Comments: Above the code, not beside
- Variable Names: PascalCase for parameters, camelCase for variables
# Control naming convention
$btnActivate # Button prefix: btn
$txtJustification # TextBox prefix: txt
$lblStatus # Label prefix: lbl
$chkSelectAll # CheckBox prefix: chk
$lstRoles # ListBox prefix: lst
# Event handler naming
$btnActivate.Add_Click({...}) # Add_EventNameCreate test file: Tests/Unit/FunctionName.Tests.ps1
BeforeAll {
# Load the module
$ModulePath = "$PSScriptRoot\..\..\PIMActivation.psd1"
Import-Module $ModulePath -Force
# Mock external dependencies
Mock Connect-MgGraph { }
}
Describe 'New-PIMFeature' {
Context 'Parameter Validation' {
It 'Should require mandatory parameters' {
{ New-PIMFeature } | Should -Throw
}
It 'Should validate parameter types' {
{ New-PIMFeature -ParameterName 123 } | Should -Throw
}
}
Context 'Core Functionality' {
BeforeEach {
# Setup for each test
}
It 'Should return expected results' {
$result = New-PIMFeature -ParameterName "Test"
$result | Should -Not -BeNullOrEmpty
$result.Property | Should -Be "ExpectedValue"
}
It 'Should handle errors gracefully' {
Mock Some-Dependency { throw "Error" }
{ New-PIMFeature -ParameterName "Test" } | Should -Throw
}
}
}
AfterAll {
# Cleanup
Remove-Module PIMActivation -Force
}Describe 'PIM Integration Tests' -Tag 'Integration' {
BeforeAll {
# Requires actual connection
Connect-MgGraph -Scopes "RoleAssignmentSchedule.ReadWrite.Directory"
}
It 'Should activate a role successfully' {
# Integration test with real API
}
}# Run all tests
Invoke-Pester -Path .\Tests
# Run specific test file
Invoke-Pester -Path .\Tests\Unit\New-PIMFeature.Tests.ps1
# Run with code coverage
Invoke-Pester -CodeCoverage .\Public\*, .\Private\*
# Run only unit tests
Invoke-Pester -Tag Unit-
Update your fork
git checkout main git pull upstream main git checkout feature/your-feature git rebase main
-
Run quality checks
# PSScriptAnalyzer Invoke-ScriptAnalyzer -Path . -Recurse -ExcludeRule PSUseSingularNouns # Tests Invoke-Pester -Path .\Tests # Module manifest Test-ModuleManifest -Path .\PIMActivation.psd1
-
Update documentation
- Update README.md if adding user-facing features
- Update CHANGELOG.md with your changes
- Add/update help documentation
- Update wiki if needed
- Code follows PowerShell best practices
- All tests pass
- Documentation updated
- CHANGELOG.md updated
- No sensitive information included
- Tested on PowerShell 7+
- PSScriptAnalyzer passes
- Commits are logical and well-described
Use conventional commit format:
feat: add bulk deactivation supportfix: handle authentication timeout correctlydocs: update installation instructionsrefactor: simplify role enumeration logictest: add unit tests for role activationchore: update dependencies
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix (non-breaking change)
- [ ] New feature (non-breaking change)
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Unit tests pass
- [ ] Manual testing completed
- [ ] Tested on PowerShell 7+
## AI Assistance
- [ ] No AI assistance used
- [ ] AI used for: [describe what parts]
## Screenshots (if applicable)
Add screenshots for UI changesFollow Semantic Versioning:
- MAJOR.MINOR.PATCH (e.g., 1.2.3)
- MAJOR: Breaking changes
- MINOR: New features, backward compatible
- PATCH: Bug fixes, backward compatible
-
Update version
Update-ModuleManifest -Path PIMActivation.psd1 -ModuleVersion "1.1.0"
-
Update CHANGELOG.md
- Add new version section
- List all changes
- Credit contributors
-
Update documentation
- README.md if needed
- Wiki pages
- Help documentation
-
Create release branch
git checkout -b release/v1.1.0 git push origin release/v1.1.0
-
Tag release
git tag -a v1.1.0 -m "Release version 1.1.0" git push origin v1.1.0
This project embraces modern development practices including AI-assisted programming.
β Good Use Cases:
- Generating boilerplate code
- Writing comprehensive documentation
- Creating test cases
- Suggesting error handling patterns
- Refactoring for readability
β Avoid AI For:
- Security-sensitive code without review
- Complex business logic without understanding
- Copy-pasting without comprehension
- Always review and understand AI-generated code
- Test thoroughly - AI can make subtle mistakes
- Security review - Check for vulnerabilities
- Maintain consistency - Ensure AI code matches project style
- Document AI usage in PR descriptions
This PR adds support for bulk role deactivation.
## Changes
- Added `Invoke-BulkDeactivation` function
- Updated UI with deactivation options
- Added progress tracking
## AI Assistance
- GitHub Copilot used for:
- Initial function structure
- Error handling patterns
- Test case generation
- All code reviewed and tested manually-
priority-critical: Security issues, data loss -
priority-high: Major functionality broken -
priority-medium: Important but not urgent -
priority-low: Nice to have
-
bug: Something isn't working -
enhancement: New feature or request -
documentation: Documentation improvements -
performance: Performance improvements -
refactor: Code improvement without functionality change
-
help-wanted: Community help needed -
good-first-issue: Good for newcomers -
blocked: Waiting on something -
in-progress: Currently being worked on
- PowerShell Best Practices
- Git Commit Guidelines
- Semantic Versioning
- Microsoft Graph API Documentation
- PIM API Reference
- π¬ GitHub Discussions - Community Q&A
- π GitHub Issues - Bug reports
- π Project Wiki - Documentation
- π Blog Post - Detailed walkthrough
Thank you for contributing to PIMActivation! Your efforts help make PIM management better for the entire community. π
Version: 1.1.0
Last Updated: July 2025