Thank you for your interest in contributing! This document provides guidelines for making edits, submitting pull requests, and scaling the project.
- Getting Started
- Making Edits
- Code Organization
- Adding New Modules
- Testing Guidelines
- Submitting Pull Requests
- Scaling the Project
- Fork the Repository: Start by forking the repository to your GitHub account.
- Clone Your Fork: Clone your fork locally to make changes.
git clone https://github.com/YourUsername/WindowsTelemetryBlocker.git cd WindowsTelemetryBlocker - Create a Branch: Create a new branch for your changes.
git checkout -b feature/your-feature-name
- Use Regions: Organize code into clear regions using
#regionand#endregion - Consistent Naming: Use PascalCase for functions, camelCase for variables
- Comments: Add clear comments explaining complex logic
- Error Handling: Always use try-catch blocks for operations that can fail
- Logging: Use
Write-LogorWrite-ModuleLogfor all operations
- Main Script:
windowstelemetryblocker.ps1- Core execution logic - Modules:
modules/*.ps1- Individual functionality modules - Rollback Scripts:
modules/*-rollback.ps1- Rollback functionality - v1.0 Features:
v1.0/- GUI, scheduler, monitor features
# ============================================================================
# Module Name
# ============================================================================
# Description: Brief description of what this module does
# Dependencies: List dependencies (e.g., telemetry)
# Rollback: Available/Manual/Not Available
# ============================================================================
param()
. "$PSScriptRoot/common.ps1"
#region Configuration
# Configuration variables and arrays
#endregion
#region Functions
# Function definitions
#endregion
#region Module Execution
# Main execution logic
#endregionAll scripts should have:
- Header: Description, dependencies, rollback info
- Parameters: If needed
- Common Import: Dot-source common.ps1
- Regions: Organized into clear sections
- Error Handling: Try-catch blocks
- Logging: Write-ModuleLog calls
Create modules/yourmodule.ps1 following the template above.
function Disable-Feature {
Write-ModuleLog "Disabling feature..."
try {
# Your code here
Write-ModuleLog "Feature disabled."
return $true
} catch {
Write-ModuleLog "Error disabling feature: $_" 'ERROR'
return $false
}
}Update windowstelemetryblocker.ps1:
-
Add to
$moduleList:$moduleList = @('telemetry','services','apps','misc','yourmodule')
-
Add dependencies:
$moduleDependencies = @{ 'yourmodule' = @('telemetry') # If it depends on telemetry }
Create modules/yourmodule-rollback.ps1:
# ============================================================================
# YourModule Rollback
# ============================================================================
# Description: Restores settings changed by yourmodule.ps1
# ============================================================================
#region Rollback Execution
# Rollback logic here
#endregion- Update
README.mdwith module information - Add to module table
- Document dependencies
-
Syntax Check: Run PowerShell syntax validation
$errors = $null [System.Management.Automation.PSParser]::Tokenize((Get-Content yourfile.ps1 -Raw), [ref]$errors)
-
Dry-Run Test: Test with
-DryRunparameter.\windowstelemetryblocker.ps1 -Modules yourmodule -DryRun
-
VM Test: Always test on a VM before production use
-
Rollback Test: Verify rollback works correctly
- Script runs without errors
- Dry-run mode works
- Actual execution works
- Rollback works (if applicable)
- Logging works correctly
- Error handling works
- No hardcoded secrets
- Code follows style guidelines
- Code follows style guidelines
- All tests pass
- Documentation updated
- No hardcoded secrets
- Error handling implemented
- Logging added
- Rollback script created (if needed)
- Dependencies documented
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Code refactoring
## Testing
Describe how you tested your changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Tests pass
- [ ] Documentation updated- Single Responsibility: Each module should do one thing well
- Dependency Management: Clearly document and manage dependencies
- Rollback Support: Always provide rollback when possible
- Error Isolation: Module failures shouldn't break the entire script
When adding new v1.0 features:
- GUI Components: Add to
v1.0/gui/ - Scheduler Features: Add to
v1.0/scheduler/ - Monitoring: Add to
v1.0/monitor/ - Shared Utilities: Add to
v1.0/shared/
- Use
v1.0/config/profiles.jsonfor profile definitions - Keep configuration separate from code
- Support environment-specific configs
- Update script version in
windowstelemetryblocker.ps1 - Update
CHANGELOG.mdwith changes - Tag releases appropriately
- Use
-ErrorAction SilentlyContinuefor non-critical operations - Batch registry operations when possible
- Minimize external command calls
- Cache frequently accessed data
- Keep README.md up to date
- Document all public functions
- Include examples in documentation
- Update CHANGELOG.md for all changes
- Automated Checks: All PRs must pass CI/CD checks
- Security Scan: Security workflow validates code
- Manual Review: Maintainers review code quality
- Testing: Changes must be tested before merge
- Open an issue for questions
- Check existing issues first
- Follow the code of conduct
Thank you for contributing to Windows Telemetry Blocker!