How to Give Back to Drupal Community
Let’s start with answering why most of companies/developers do not contribute?
We all might know real problems, but I believe the most important is the awareness.
In 2008 Dries wrote a blog Contributing back to Drupal for inviting new ideas to increase companies participation. Not sure how many could adapt into the culture of contribution. Later in 2014, another idea launched here.
A method for giving credit to organizations that contribute code to Open Source.
This idea really worked. Now the developer can tag certain checks that are required by the organization to their contribution.
This actually converted into a competition in the market among companies and developers, to attain more credits.
If you are first time contributor or wondering how to contribute, this blog will help you.
Why contribute on Drupal.org?
1. Build your company Profile:
When a developer contributes to Drupal.org or any other open source community, it will slowly build developer & company’s profile like https://www.drupal.org/to-the-new. Such page increases the brand value of the company, adds to SEO as well.
This page includes:
- Supported Modules
- Supported Themes
- List of issues fixed by the developer of the company.
2. Enhancement in Programming Experience:
Contributing to Drupal.org enhances developers programming skills. This enables them to write more stable code which follows coding standards. Drupal 8 follows PSR-4 standard so, the developer must be aware of PSR-4 coding standard when contributing to Drupal.org.
When one provides a patch to fix an issue, this patch gets en-queued for an auto review program. If that patch did not meet community’s expectation, it would be auto rejected. So no one will review it.
When a developer works on any module or issue, it might be possible that someone else is also doing similar work. For example, two or more developer provides a patch to fix one issue.
Even a beginner can contribute to the community. When contribution gets submitted, it awaits approval by the owner of module/association. If it works, it doesn’t matter who wrote the code & contributed.
3. Build Resume on Drupal.org community:
Contribution can build a strong resume of a developer. Which can be a great addendum to the developer as well as for his company. Every contribution is accessible to all creating a big impact on company & developer’s profile. A good profile can help a company to grab important projects.
4. Encourage Open Source Culture:
Usage statistics for Drupal says currently 1,164,843 web applications are running on Drupal. And Drupal was free to them. So companies, who are consuming Drupal as free open source project, should certainly give back. They should appreciate the value of helping each other and also appreciates others.
The Drupal environment comprises a core (means all files that come with Drupal, when downloaded from project page) & contributed (installation profiles, themes, modules, etc.) projects.
What to contribute?
There are many sections where an individual can contribute inside Drupal Community like Content, Maintenance, Code, Infrastructure, but here we are considering only code contribution. Patches are the ways with which contributions can be made to existing projects.
Patch:
A patch is a file that contains code differences between two set of files. Developers make use of patches for deletion, addition and code level changes.
By using patches, the development cycle becomes very easy as instead of replacing an entire file with a new file that may contain a huge number of lines of code, a patch file will only replace the changes that were made.
How to create a patch?
Before we proceed further for creating a patch, some requirements need to be there. For contributing, each user must have the following:
- A valid/activated Drupal account.
- Git knowledge (basics).
For creating a patch follow the link
Contributing First Patch
- Go to project page like module, theme, installation profile, etc. for ex: https://www.drupal.org/project/role_based_theme_switcher
- Click on version control tab just under the title, copy the git clone command for specific release for which you want to add a patch.
- Go to your terminal (Ubuntu, Linux, Mac), cd to specific docroot like: /var/www/html/d8/modules, and paste git clone command on the terminal. This will download the code from git to your modules directory.
- Now, make changes to the downloaded code as per your need.
- Now, cd into module folder like cd role_based_theme_switcher. And run git diff, this will show you the difference in the code before and after the changes.
- After reviewing your changes here is the command to create a patch: git diff > [description]-[issue-number]-[comment-number].patch.
- Here the description is the short patch description, issue-number is node number of the issue, comment-number is a comment on the node to be posted like for a comment https://www.drupal.org/node/2875678, 2875678 is the issue-number & there are 3 comments on the node then, comment-number will 4. So the patch command will be “git diff > xyz-2875678-4.patch“.
How to contribute a module or theme or installation Profile.
First, create your project either manually or by using Drupal Console. Add your functionalities within the project folder.
After you finish coding, there are two ways in which you can contribute to Drupal.org.
- Full Projects: Which is ready to download & use.
- Sandbox Projects: These are the experimental piece of codes or codes from new contributors, which have not gone under vetting process.
How to promote sandbox project to a full project under security advisory policy.
Find more information about Security Advisory Policy. Once a project is created in a sandbox account, there are certain checks that need to be done before promoting a sandbox project to a full project.
Steps to promote a project from sandbox to an entire project:
- After completing the code in sandbox mode, test code at pareview.sh. Fix all bugs listed by pareview.sh until there are zero bugs/warning/notices in your code.
- Then create an issue under project application for the review process.
- After creating the issue you need to follow review bonus process. In this process, you need to review other users project in the issue queue.
- Reviewers are needed for new project applications, and the details can be found at code-review.
Review Bonus Program
- Manual reviews of 3 other projects in the main issue queue.
- Point those 3 reviews in your own project application by editing your post & creating a new section “Manual reviews of other projects” & paste those 3 links like https://www.drupal.org/node/2850757#comment-11925087.
- And add PAReview: review bonus tag in your application.
After completing all above steps your application is listed under prioritised ‘Review Bonus” issue queue and will be reviewed accordingly. If a reviewer found any bugs in your code & sets the application status to “Needs Work”, then PAReview: review bonus will be removed automatically & you have to do 3 manual reviews of other projects again. However, you can do 6 reviews in the beginning to avoid second-time reviewal process.
Once you follow all above steps, 6 manual reviews, your application is prioritized until your project application is finished.
However, according to the new policy, you can directly promote your sandbox project to full project, but there will be a message shown on your project page that “This project is not covered by Drupal’s security advisory policy.” And you have to follow above process to opt into Drupal’s security advisory policy.