|
| 1 | +# PowerShell Coding Standards |
| 2 | +- Always use approved PowerShell verbs for function names (get, set, new, start, remove, update, etc.) |
| 3 | +- Use Pascal case for all function names, variables, and parameters |
| 4 | +- Follow OTBS (One True Brace Style) formatting |
| 5 | +- Include one blank line at the end of every script |
| 6 | +- Remove all trailing spaces |
| 7 | +- Use proper cmdlet binding and parameter validation |
| 8 | +- Always include comment-based help for functions |
| 9 | + |
| 10 | +# General Coding Guidelines |
| 11 | +- Always add meaningful comments for complex logic |
| 12 | +- Prefer explicit error handling over silent failures |
| 13 | +- Include unit tests for all new functions |
| 14 | + |
| 15 | +# Response Preferences |
| 16 | +- Include brief explanations of why a particular approach is recommended |
| 17 | +- When suggesting refactoring, explain the benefits |
| 18 | +- Provide both the solution and alternative approaches when applicable |
| 19 | + |
| 20 | +# Security Guidelines |
| 21 | +- Never hardcode credentials or API keys |
| 22 | +- Always validate input parameters |
| 23 | +- Implement proper authentication and authorization checks |
| 24 | + |
| 25 | +# PowerShell Commit Message Template |
| 26 | + |
| 27 | +Generate commit messages for PowerShell projects using this format: |
| 28 | + |
| 29 | +`<emoji><type>[optional scope]: <description>` |
| 30 | + |
| 31 | +Follow the GitMoji specifications at <https://conventional-emoji-commits.site/full-specification/specification> for |
| 32 | +commit messages. Tailor commit messages for PowerShell development, using the provided types and scopes. |
| 33 | + |
| 34 | +### PowerShell-Specific Types: |
| 35 | +- **feat**: ✨ New cmdlet, function, or module feature |
| 36 | +- **fix**: 🐛 Bug fix in PowerShell code |
| 37 | +- **docs**: 📚 Help documentation, comment-based help |
| 38 | +- **style**: 🎨 Code formatting, OTBS compliance, Pascal case fixes |
| 39 | +- **refactor**: ♻️ Code restructuring, approved verb compliance |
| 40 | +- **test**: ✅ Pester tests, unit tests |
| 41 | +- **build**: 🛠️ Module manifest, build scripts |
| 42 | +- **ci**: 🤖 Azure DevOps, GitHub Actions for PowerShell |
| 43 | +- **chore**: 🧹 Module organization, file cleanup |
| 44 | +- **perf**: ⚡ Performance improvements in cmdlets or functions |
| 45 | +- **revert**: ⏪ Reverting changes in PowerShell scripts or modules |
| 46 | +- **packaging**: 📦 Packaging changes, module version updates |
| 47 | +- **security**: 🔒 Security-related changes, input validation, authentication |
| 48 | + |
| 49 | +### PowerShell Scopes: |
| 50 | +- module: Module-level changes |
| 51 | +- cmdlet: Specific cmdlet modifications |
| 52 | +- function: Function updates |
| 53 | +- help: Documentation changes |
| 54 | +- manifest: Module manifest updates |
| 55 | +- tests: Test-related changes |
| 56 | + |
| 57 | +### Examples: |
| 58 | +✨feat(cmdlet): add Get-UserProfile with parameter validation |
| 59 | +🐛fix(function): resolve Invoke-ApiCall error handling |
| 60 | +📚docs(help): update comment-based help for Set-Configuration |
| 61 | +🎨style(module): apply OTBS formatting and Pascal case |
| 62 | +✅test(cmdlet): add Pester tests for Get-SystemInfo |
0 commit comments