11 KiB
Contributing to PowerShell
We welcome and appreciate contributions from the community. There are many ways to become involved with PowerShell: including filing issues, joining in design conversations, writing and improving documentation, and contributing to the code. Please read the rest of this document to ensure a smooth contribution process.
New to Git?
- Make sure you have a GitHub account.
- Learning Git:
- GitHub Help: Good Resources for Learning Git and GitHub.
- Git Basics: install and getting started.
- GitHub Flow Guide: step-by-step instructions of GitHub flow.
Quick Start Checklist
- Review the Contribution License Agreement requirement.
- Get familiar with the PowerShell repository.
Contributing to Issues
- Review Issue Management.
- Check if the issue you are going to file already exists in our GitHub issues.
- If you can't find your issue already, open a new issue, making sure to follow the directions as best you can.
- If the issue is marked as
help wanted
, the PowerShell maintainers are looking for help with the issue.
Contributing to Documentation
Contributing to documentation related to PowerShell
Please see the Contributor Guide in PowerShell/PowerShell-Docs
.
Contributing to documentation related to maintaining or contributing to the PowerShell project
- When writing Markdown documentation, use semantic linefeeds. In most cases, it means "once clause / idea per line".
- Otherwise, these issues should be treated like any other issue in this repo.
Contributing to Code
Building and testing
Building PowerShell
Please see Building PowerShell.
Testing PowerShell
Please see PowerShell Testing Guidelines - Running Tests Outside of CI on how to test you build locally.
Finding or creating an issue
- Follow the instructions in Contributing to Issues to find or open an issue.
- Mention in the issue that you are working on the issue and ask
@powershell/powershell
for an assignment.
Forks and Pull Requests
GitHub fosters collaboration through the notion of pull requests. On GitHub, anyone can fork an existing repository into their own user account, where they can make private changes to their fork. To contribute these changes back into the original repository, a user simply creates a pull request in order to "request" that the changes be taken "upstream".
Additional references:
- GitHub's guide on forking
- GitHub's guide on Contributing to Open Source
- GitHub's guide on Understanding the GitHub Flow
Lifecycle of a pull request
Pull request submission
Always create a pull request to the master
branch of this repository.
-
If you're contributing in a way that changes the user or developer experience, you are expected to document those changes. See Contributing to documentation related to PowerShell.
-
Add a meaningful title of the PR describing what change you want to check in. Don't simply put: "Fixes issue #5". A better example is: "Add Ensure parameter to New-Item cmdlet", with "Fixes #5" in the PR's body.
-
When you create a pull request, fill out the pull request template, including a summary of what's included in your changes. If the changes are related to an existing GitHub issue, please reference the issue in pull request description (e.g.
Closes #11
). See this for more details. -
Include an update to the changelog in your pull request. New changes always go into the Unreleased section. Keeping the changelog up-to-date simplifies the release process for maintainers. An example:
Unreleased ---------- * `Update-Item` now supports `-FriendlyName`.
Please use the present tense and imperative mood when describing your changes:
* Instead of "Adding support for Windows Server 2012 R2", write "Add support for Windows Server 2012 R2". * Instead of "Fixed for server connection issue", write "Fix server connection issue".
This form is akin to giving commands to the code base, and is recommended by the Git SCM developers. It is also used in the Git commit messages.
Also, if change is related to a specific resource, please prefix the description with the resource name:
* Instead of "New,parameter 'ConnectionCredential' in New-SqlConnection", write "New-SqlConnection: added parameter 'ConnectionCredential'".
Pull Request - Automatic Checks
-
If this is your first contribution to PowerShell, you may be asked to sign a Contribution Licensing Agreement (CLA) before your changes will be accepted.
-
Make sure you follow the Common Engineering Practices and testing guidelines.
-
After submitting your pull request, our CI system (Travis CI and AppVeyor) will run a suite of tests and automatically update the status of the pull request.
Pull Request - Code Review
-
After a successful test pass, the area maintainers will do a code review, commenting on any changes that might need to be made.
-
Additional feedback is always welcome! Even if you are not designated as an area's maintainer, feel free to review others' pull requests anyway. Leave your comments even if everything looks good; a simple "Looks good to me" or "LGTM" will suffice. This way we know someone has already taken a look at it!
-
Once the code review is done, all merge conflicts are resolved, and the CI system build status is passing, a maintainer will merge your changes.
-
For more information on the the PowerShell maintainers' process, see the documentation.
Making Breaking Changes
When you make code changes, please pay attention to these that can affect the Public Contract. For example, changing PowerShell parameters, APIs, or protocols break the public contract. Before making changes to the code, first review the breaking changes contract and follow the guidelines to keep PowerShell backward compatible.
Making Design Changes
To add new features such as cmdlets or making design changes, please follow the PowerShell Request for Comments (RFC) process.
Common Engineering Practices
Other than the guidelines for (coding, the RFC process for design, documentation and testing) discussed above, we encourage contributors to follow these common engineering practices:
- Format commit messages following these guidelines:
Summarize change in 50 characters or less
Similar to email, this is the body of the commit message,
and the above is the subject.
Always leave a single blank line between the subject and the body
so that `git log` and `git rebase` work nicely.
The subject of the commit should use the present tense and
imperative mood, like issuing a command:
> Makes abcd do wxyz
The body should be a useful message explaining
why the changes were made.
If significant alternative solutions were available,
explain why they were discarded.
Keep in mind that the person most likely to refer to your commit message
is you in the future, so be detailed!
As Git commit messages are most frequently viewed in the terminal,
you should wrap all lines around 72 characters.
Using semantic line feeds (breaks that separate ideas)
is also appropriate, as is using Markdown syntax.
-
These are based on Tim Pope's guidelines, Git SCM submitting patches, Brandon Rhodes' semantic linefeeds, and John Gruber's Markdown syntax.
-
Don't commit code that you didn't write. If you find code that you think is a good fit to add to PowerShell, file an issue and start a discussion before proceeding.
-
Create and/or update tests when making code changes.
-
Run tests and ensure they are passing before pull request.
-
All pull requests must pass CI systems before they can be approved.
-
Avoid making big pull requests. Before you invest a large amount of time, file an issue and start a discussion with the community.
Contributor License Agreement (CLA)
To speed up the acceptance of any contribution to any PowerShell repositories,
you could sign a Microsoft Contribution Licensing Agreement (CLA) ahead of time.
If you've already contributed to PowerShell repositories in the past, congratulations!
You've already completed this step.
This a one-time requirement for the PowerShell project.
Signing the CLA process is simple and can be done in less than a minute.
You don't have to do this up-front.
You can simply clone, fork, and submit your pull request as usual.
When your pull request is created, it is classified by a CLA bot.
If the change is trivial, it's classified as cla-required
.
Once you sign a CLA, all your existing and future pull requests will be labeled as cla-signed
.