choco/CONTRIBUTING.md at develop · chocolatey/choco (original) (raw)

The Chocolatey team has very explicit information here regarding the process for contributions, and we will be sticklers about the way you write your commit messages (yes, really), so to save yourself some rework, please make sure you read over this entire document prior to contributing. See this Pull Request as an example of what we consider to be a great contribution.

Are You In the Right Place?

Chocolatey is a large ecosystem and each component has their own location for submitting issues and enhancement requests. While the website (the community package repository) may be all you know for packages, it represents only a tiny fraction of existing packages (organizations typically maintain and host their own packages internally). This is the repository for choco.exe (the client CLI tool) for Chocolatey, which spans multiple types of environments.

Please follow these decision criteria to see if you are in the right location or if you should head to a different location to submit your request.

Reporting an Issue/Bug?

submitting issues

Submitting an Issue (or a Bug)? See the Submitting Issues section in the README.

SolutionVersion.cs

Do not submit issues for missing SolutionVersion.cs. Please see Compiling / Building Source.

Package Issue?

Please see Request Package Fixes or Updates / Become a maintainer of an existing package.

Package Request? Package Missing?

If you are looking for packages to be added to the community feed (aka https://community.chocolatey.org/packages), please see Package Requests.

Submitting an Enhancement / Feature Request?

If this is for choco (the CLI tool), this is the right place. See below. Otherwise see Submitting Issues for enhancements to the website, enhancements to the ChocolateyGUI, etc.

Submitting an Enhancement For Choco

Log a github issue. There are fewer constraints on this versus reporting issues.

Code Contributions

The process for contributions is roughly as follows:

Prerequisites

Definition of Trivial Contributions

It's hard to define what is a trivial contribution. Sometimes even a 1 character change can be considered significant. Unfortunately because it can be subjective, the decision on what is trivial comes from the committers of the project and not from folks contributing to the project. It is generally safe to assume that you may be subject to signing the CLA and be prepared to do so. Ask in advance if you are not sure and for reasons are not able to sign the CLA.

What is generally considered trivial:

What is generally not considered trivial:

Is the CLA Really Required?

Yes, and this aspect is not up for discussion. If you would like more resources on understanding CLAs, please see the following articles:

Overall, the flexibility and legal protections provided by a CLA make it necessary to require a CLA. As there is a company and a licensed version behind Chocolatey, those protections must be afforded. We understand this means some folks won't be able to contribute and that's completely fine. We prefer you to know up front this is required so you can make the best decision about contributing.

If you work for an organization that does not allow you to contribute without attempting to own the rights to your work, please do not sign the CLA.

Contributing Process

Start with Prerequisites and make sure you can sign the Contributor License Agreement (CLA).

Get Buyoff Or Find Open Community Issues/Features

Set Up Your Environment

Code Format / Design

CSharp

These standards are enforced via the .editorconfig file in the repository.

PowerShell

Debugging / Testing

When you want to manually verify your changes and run Choco, you have some options.

NOTE: Chocolatey behaves differently when built with Debug and Release configurations. Release is always going to seek out the machine installation ($env:ChocolateyInstall), where Debug just runs right next to wherever the choco.exe file is.

Visual Studio

When you are using Visual Studio, ensure the following:

Automated Tests

Chocolatey Build

NOTE: When you are doing this, we almost always recommend you take the output of the build to another machine to do the testing, like the Chocolatey Test Environment.

Prepare Commits

This section serves to help you understand what makes a good commit.

A commit should observe the following:

A commit message should observe the following (based on "A Note About Git Commit Messages"):

A good example of a commit message is as follows:

(#7) Installation Adds All Required Folders

Previously the installation script worked for the older version of Chocolatey. It does not work similarly for the newer version of choco due to location changes for the newer folders. Update the install script to ensure all folder paths exist.

Without this change the install script will not fully install the new choco client properly.

Submit Pull Request (PR)

See this Pull Request as an example of what we consider to be a great contribution.

Prerequisites:

Submitting PR:

Respond to Feedback on Pull Request

We may have feedback for you in the form of requested changes or fixes. We generally like to see that pushed against the same topic branch (it will automatically update the PR). You can also fix/squash/rebase commits and push the same topic branch with --force (while it is generally acceptable to do this on topic branches not in the main repository, a force push should be avoided at all costs against the main repository).

If we have comments or questions when we do evaluate it and receive no response, it will probably lessen the chance of getting accepted. Eventually this means it will be closed if it is not accepted. Please know this doesn't mean we don't value your contribution, just that things go stale. If in the future you want to pick it back up, feel free to address our concerns/questions/feedback and reopen the issue/open a new PR (referencing old one).

Sometimes we may need you to rebase your commit against the latest code before we can review it further. If this happens, you can do the following:

The only reasons a pull request should be closed and resubmitted are as follows:

Other General Information

The helpers/utility functions that are available to the packages are what we consider the API. If you are working in the API, please note that you will need to maintain backwards compatibility. If you plan to rename a function or make it more generic, you must provide an alias in the chocolateyInstaller.psm1 as part of what gets exported. You should not remove or reorder parameters, only add optional parameters to the end. They should be named and not positional (we are moving away from positional parameters as much as possible).

If you reformat code or hit core functionality without an approval from a person on the Chocolatey Team, it's likely that no matter how awesome it looks afterwards, it will probably not get accepted. Reformatting code makes it harder for us to evaluate exactly what was changed.

If you do these things, it will be make evaluation and acceptance easy. Now if you stray outside of the guidelines we have above, it doesn't mean we are going to ignore your pull request. It will just make things harder for us. Harder for us roughly translates to a longer SLA for your pull request.