Skip to content

Instantly share code, notes, and snippets.

@jairovadillo
Last active September 17, 2020 10:17
Show Gist options
  • Save jairovadillo/f25cf79bc02ada912159ebff05808252 to your computer and use it in GitHub Desktop.
Save jairovadillo/f25cf79bc02ada912159ebff05808252 to your computer and use it in GitHub Desktop.
Contributing to 21 Buttons

Contributing to iOS

Code standards

Code architecture, principles and standards can be found on CODING_PRACTICES

Code Style

We are following Ray Wenderlich's Swift Style Guide.

Code editor

The prefered code editor is Xcode. Xcode comes with a good default configuration also this repository contains all required configuration files automatically loaded by the IDE.

Commit styling

Use the present tense and imperative mood when describing your commits:

  • Instead of "Adding support for Swift", write "Add support for Swift".
  • Instead of "Fixed brand profile view", write "Fix brand profile view".

This form is akin to giving commands to the code base and is recommended by the Git SCM developers.

Git workflow

The prefered git workflow is based on GitFlow but using master branch as target for the feature branches (as it was develop).

Branches & Naming

  • master: Master is the main branch and contains code that has passed tests, QA verification and it's ready to be released.
  • feature/ABC/ABC-XXX-your-feature-title: Feature branches fork from master branch and contain work that matches directly with a task/user story on Jira.
  • subtask/ABC/ABC-XXX-your-subtask-title: Subtask branches fork from feature branches and contain small units of work necessary to accomplish the feature.
  • hotfix/ABC/ABC-XXX-your-hotfix-title: Hotfix branches fork from release branch and aim to solve bugs on the current release.
  • release/X.X.X: Release branches fork from master and contain code ready to go to production.

Pull Requests

Before submitting & recommendations

  • Avoid merge conflicts: make sure your branch is rebased on the master branch of this repository.

  • The PULL_REQUEST_TEMPLATE.md contains a checklist of tasks to do before asking for review.

  • Add a link to Jira in the PR description (not on title): Since Github Jira Plugin is installed adding: [ABC-123] on the description will automatically translate to a Jira link.

  • Clean up your commit history. Each commit should be a single complete change. This discipline is important to ease the work for the reviewers. It's always better to have something like this:

      * Add presenter A
      * Add module X
      * Add new data repo
      * Rm old data repo
    

    Instead of this:

      * add presenter A
      * fix presenter
      * add tests
      * fix tests
      * fix more tests
      * add module X !wip
    
  • (Try to) Avoid PRs with too many changes: A large PR not only stretches the review time, but also makes it much harder to spot issues. In such case, it's better to split the PR to multiple smaller ones. For large features, try to approach it in an incremental way, so that each PR won't be too big. Also, try to create new commits and don't rewrite/squash the commit history. This way it's very easy for the reviewers to see diff between iterations. If you rewrite the history in the pull request, review could be much slower.

  • Add a meaningful title on the PR describing what change you want to check in: Don't simply write: "Fix Jira issue #5". Also don't directly use the issue title as the PR title. An issue title is to briefly describe what is wrong, while a PR title is to briefly describe what is changed. A better example is: "Add Ensure parameter to New-Item cmdlet", with "Fix Jira #5" in the PR's body.

  • Include a summary about your changes in the PR description: The description is used to create change logs, so try to have the first sentence explain the benefit to end users.

  • Add your PR to your squad Github project (if any) in order to give visibility.

Work in Progress

If your pull request is not ready to merge nor review use a Draft Pull Request.

In case your PR goes from Ready to review back to Draft/WIP add the prefix WIP:, [WIP:] or 🚧 to the beginning of the title and remove the prefix when the PR is ready (Github does not allow to go back to draft). Also, remove the reviewers until the PR is ready or in exceptional cases (commit doubts etc.). Optionally use the WIP label to give even more visibility.

Automatic Checks

  • After submitting your pull request, the CI service will run a suite of tests and automatically update the status of the pull request

Merging strategy

This repository only allows squash merges. The aim of this policy is to have a cleaner commit history both for master and for the feature branches.

On master, every squash commit MUST follow gitchangelog convention. This way the changelog is easier and auto generated on the release proccess, also include the Jira ticket number, eg: new: [ABC-1234] Create Signup.

Remember to remove the aggregated commit history in the description of the squash commit, otherwise it will appear in the CHANGELOG later.

Labels

Use the following labels to give more information about your PR:

  • QA: The PR is being tested by QAs before merging to master. This is usually set when the PR is already approved.
  • Blocked: The PR can't be merged to master for some important issue.
  • Hotfix: The PR is a hotfix of current App Store version and needs to be prioritized.
  • Release: The PR is a feature that will be included on next release and needs to be prioritized.
  • Backlog: The Issue is added to our Tech Backlog.

Roles and Responsibilities

  1. Author creates the pull request
  2. Assignee is responsible for moving the PR forward to get it Approved. This includes addressing feedback within a timely period and indicating feedback has been addressed by adding a comment and mentioning the specific reviewers. Once the PR has been approved and the CI system is passing, the assignee will merge the PR.
  3. Reviewers are CODEOWNERS (if any) and anyone who wants to contribute. They are responsible for ensuring the code: addresses the issue being fixed, does not create new issues (functional, performance, reliability, or security), and implements proper design. Reviewers should use the Review changes drop down to indicate they are done with their review.
    • Request changes if you believe the PR merge should be blocked if your feedback is not addressed,
    • Approve if you believe your feedback has been addressed or the code is fine as-is, it is customary (although not required) to leave a simple "Looks good to me" (or "LGTM") as the comment for approval.
    • Comment if you are making suggestions that the assignee does not have to accept. Early in the review, it is acceptable to provide feedback on coding formatting but after the PR has been approved, it is generally not recommended to focus on formatting issues unless they go against the most basic rules (missing new lines, bad indentation etc. ). Non-critical late feedback (after PR has been approved) can be submitted as a new issue or new pull request from the reviewer.

Workflow

  1. The PR author creates a draft PR from a branch.
  2. The author ensures that their PR passes the build and changes its state to Ready for review. Otherwise, the author SHOULD continue to update the pull request until the build passes.
  3. The author MUST set an assignee: in most of cases would be himself but can be another contributor. The assignee is the one who is going to merge the PR.
  4. The author adds his teammate to the list of reviewers. Other reviewers will be automatically added by Pull Panda.
  5. Once the code review is completed, the assignee merges the pull request and ensures the correctness of the resulting merge.
  6. (case feature PR) Execute script make qa with your JIRA ticket as a parameter ABC-XXX (e.g. make qa issue=LP-1234)

Abandoned PRs

A pull request with no changes for more than two weeks without a word from the author/assignee is considered abandoned and will be deleted (jointly with the branch) periodically.

Releasing

Read RELEASE.md for more information about creating a release.

New Ideas

Go to Issues on GitHub.

  1. Create a feature request (a template is already in place).
  2. Fill all the fields of the template and assign as many member as needed.
  3. If there is an agreement, Chapter Lead will contact your Engineer Manager to add a task in your backlog.
  4. If it is a huge task, we can always add it to the Tech Backlog and prioritise it for next Quarter.

Contributing to {your repo name}

Adapt this contributing file to your project, necessities and tools. This Template is very biased by the usage of python / backend and Jira as an issue tracker

Code Editor

The prefered code editor is PyCharm. Pycharm comes with a good default configuration but Docstrings format must be changed to Google one.

Branching

The prefered flow is GitHub Flow, here is pretty well explained.

Naming

In order to help the team to find a related ticket where the feature/bug is detailed, it is recommended to include the ticket reference in the branch name, ie: feature/WIN-1934-Short-description, where WIN-1934 would be the ticket id.

Pull Requests

Before submitting

  • Avoid merge conflicts: make sure your branch is rebased on the master branch of this repository.
  • If exists, the PULL_REQUEST_TEMPLATE.md contains a checklist of tasks to do before asking for review. In case this file don't exist is highly recommended to create one with some steps such as:
    • I've updated the API documentation
    • I've created new tests to cover new changes
    • Old tests still pass
    • I've read the contributing before publishing this PR
  • (Recommended) Clean up your commit history. Each commit should be a single complete change. This discipline is important to ease the work for the reviewers.

Pull request - Recommendations

Always create a pull request to the master branch of this repository.

  • (Try to) Avoid PRs with too many changes: A large PR not only stretches the review time, but also makes it much harder to spot issues. In such case, it's better to split the PR to multiple smaller ones. For large features, try to approach it in an incremental way, so that each PR won't be too big. Also, try to create new commits and don't rewrite/squash the commit history. This way it's very easy for the reviewers to see diff between iterations. If you rewrite the history in the pull request, review could be much slower.

  • Add a meaningful title on the PR describing what change you want to check in: Don't simply write: "Fix Jira issue #5". Also don't directly use the issue title as the PR title. An issue title is to briefly describe what is wrong, while a PR title is to briefly describe what is changed. A better example is: "Add Ensure parameter to New-Item cmdlet", with "Fix Jira #5" in the PR's body.

  • Include a summary about your changes in the PR description: The description is used to create change logs, so try to have the first sentence explain the benefit to end users.

  • Use the present tense and imperative mood when describing your commits:

    • Instead of "Adding support for Python 3.7", write "Add support for Python 3.7".
    • Instead of "Fixed brand profile view bananada", write "Fix brand profile view bananada".

    This form is akin to giving commands to the code base and is recommended by the Git SCM developers.

  • Add your PR to your squad Github project (if any) in order to give visibility.

Pull Request - Work in Progress

If your pull request is not ready to merge nor review use a Draft Pull Request.

In case your PR goes from Ready to review back to WIP add the prefix WIP:, [WIP:] or 🚧 to the beginning of the title and remove the prefix when the PR is ready. Also, remove the reviewers until the PR is ready or in exceptional cases (commit doubts etc.). Optionally use the WIP label to give even more visibility.

Pull Request - Automatic Checks

  • After submitting your pull request, the CI service will run a suite of tests and automatically update the status of the pull request.

Pull Request - Workflow

  1. The PR author creates a draft PR from a branch.
  2. The author ensures that their PR passes the build and changes its state to Ready for review. Otherwise, the author SHOULD continue to update the pull request until the build passes.
  3. The author MUST set an assignee: in most of cases would be himself but can be another contributor: The assignee is the one who is going to merge the PR.
  4. If the author knows whom should participate in the review, they should add them otherwise they can add the recommended reviewers or the CODEOWNERS (sometimes automatically added).
  5. If there is not sufficient review, the assignee can add the Review needed label.
  6. Once the code review is completed, the assignee merges the pull request and ensures the correctness of the resulting merge.

Pull Request - Roles and Responsibilities

  1. Author creates the pull request
  2. Assignee is responsible for moving the PR forward to get it Approved. This includes addressing feedback within a timely period and indicating feedback has been addressed by adding a comment and mentioning the specific reviewers. Once the PR has been approved and the CI system is passing, the assignee will merge the PR.
  3. Reviewers are CODEOWNERS (if any) and anyone who wants to contribute. They are responsible for ensuring the code: addresses the issue being fixed, does not create new issues (functional, performance, reliability, or security), and implements proper design. Reviewers should use the Review changes drop down to indicate they are done with their review.
    • Request changes if you believe the PR merge should be blocked if your feedback is not addressed,
    • Approve if you believe your feedback has been addressed or the code is fine as-is, it is customary (although not required) to leave a simple "Looks good to me" (or "LGTM") as the comment for approval.
    • Comment if you are making suggestions that the assignee does not have to accept. Early in the review, it is acceptable to provide feedback on coding formatting but after the PR has been approved, it is generally not recommended to focus on formatting issues unless they go against the most basic rules (missing new lines, bad indentation etc. ). Non-critical late feedback (after PR has been approved) can be submitted as a new issue or new pull request from the reviewer.

Pull Requests - Abandoned

A pull request with no changes for more than two weeks without a word from the author/assignee is considered abandoned and will be deleted (jointly with the branch) periodically.

Pull Requests - Merging strategy

The preferred merging strategy is Squash & Merge. Here are some reasons why, but the main one is because squashing maintains the master branch history very clean, each commit corresponds to one small feature and it's very easy to revert/rollback something that is not working as expected. Also, this flow allows more flexibility on the branch commits (fixes, WIPs, etc.).

Commit styling

While individual commits on the PR have no importance after an squash merge (BUT they have importance for reviewing purposes) merge commits have a lot as they are going to be in the masters history of the repository. For this reason, remember to edit the commit message following the guidelines above mentioned, so a PR with name "Add support for Python 3.7" becomes a squash-merged commit with message: "Add support for Python 3.7 (#77)" and it's body contains links to Jira, trello, github issues, extended explanations (PR description) etc. Since single commits became useless in this step try to avoid listing them (as Github default does) on the commit body, avoid:

	* fix this
	* fix this v2
	* fix tests
	* fix more tests
	* add feature XXX

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.

In case of adding emojis to your commits follow this

References

Based on Powershell CONTRIBUTING

Contributing to Android

Code standards

Code Style

All code must follow the Kotlin Style Guide from Android with some changes:

  • Indent with 2 spaces (instead of 4)
  • Continuation indent with 2 spaces (instead of 8)

Code editor

The prefered code editor is Android Studio. Android Studio comes with a good default configuration also this repository contains all required configuration files automatically loaded by the IDE.

Commit styling

Use the present tense and imperative mood when describing your commits:

  • Instead of "Adding support for Kotlin", write "Add support for Kotlin".
  • Instead of "Fixed brand profile view bananada", write "Fix brand profile view bananada".

This form is akin to giving commands to the code base and is recommended by the Git SCM developers.

Git workflow

The prefered git workflow is based on GitFlow but using master branch as target for the feature branches (as it was develop).

Branches & Naming

  • master: Master is the main branch and contains code that has passed tests, QA verification and it's ready to be released.
  • us/ABC-XXX-your-feature-title: Feature branches fork from master branch and contain work that matches directly with a task/user story on Jira.
  • ABC-XXX-your-subtask-title: Subtask branches fork from feature branches and contain small units of work necessary to accomplish the feature.
  • release: Release branches fork from master and contain code ready to go to production.

Pull Requests

Before submitting & recommendations

  • Avoid merge conflicts: make sure your branch is rebased on the master branch of this repository.

  • The PULL_REQUEST_TEMPLATE.md contains a checklist of tasks to do before asking for review.

  • Add a link to Jira in the PR description (not on title): Since Github Jira Plugin is installed adding: [ABC-123] on the description will automatically translate to a Jira link.

  • Clean up your commit history. Each commit should be a single complete working change. This discipline is important to ease the work for the reviewers. It's always better to have something like this:

      * Add presenter A
      * Add module X
      * Add new data repo
      * Rm old data repo
    

    Instead of this:

      * add presenter A
      * fix presenter
      * add tests
      * fix tests
      * fix more tests
      * add module X !wip
    
  • (Try to) Avoid PRs with too many changes: A large PR not only stretches the review time, but also makes it much harder to spot issues. In such case, it's better to split the PR to multiple smaller ones. For large features, try to approach it in an incremental way, so that each PR won't be too big.

  • Add a meaningful title on the PR describing what change you want to check in: Don't simply write: "Fix Jira issue #5". Also don't directly use the issue title as the PR title. An issue title is to briefly describe what is wrong, while a PR title is to briefly describe what is changed. A better example is: "Add Ensure parameter to New-Item cmdlet", with "Fix Jira #5" in the PR's body.

  • Include a summary about your changes in the PR description: Help other understand what's the aim of your PR.

Work in Progress

If your pull request is not ready to merge nor review use a Draft Pull Request.

In case your PR goes from Ready to review back to Draft/WIP use the WIP label to give visibility (Github does not allow to go back to draft).

Automatic Checks

  • After submitting your pull request, the CI service will run the static code analysis, unit tests and compilation. Then the CI will automatically update the status of the pull request.

Merging strategy

The required merging strategy is Rebase & Merge for all branches. This strategy is preferred in order to preserve the commit history from the branches (since those commits are units of working code).

There is an exception for the integration of the release branch to master where Create a Merge commit is required.

Labels

Use the following labels to give more information about your PR:

  • QA: The PR is being tested by QAs before merging to master. This is usually set when the PR is already approved.
  • Blocked: The PR can't be merged to master for some important issue.
  • WIP: The PR is still Work In Progress. Also consider using draft PRs.

Roles and Responsibilities

  1. Author creates the pull request and is responsible for moving the PR forward to get it Approved. This includes addressing feedback within a timely period and indicating feedback has been addressed by adding a comment and mentioning the specific reviewers. Once the PR has been approved and the CI system is passing, the author will merge the PR.
  2. Reviewers are CODEOWNERS (if any) and anyone who wants to contribute. They are responsible for ensuring the code: addresses the issue being fixed, does not create new issues (functional, performance, reliability, or security), and implements proper design. Reviewers should use the Review changes drop down to indicate they are done with their review.
    • Request changes if you believe the PR merge should be blocked if your feedback is not addressed.
    • Approve if you believe your feedback has been addressed or the code is fine as-is, it is customary (although not required) to leave a simple "Looks good to me" (or "LGTM") as the comment for approval.
    • Comment if you are making suggestions that the author does not have to accept. Early in the review, it is acceptable to provide feedback on coding formatting but after the PR has been approved, it is generally not recommended to focus on formatting issues unless they go against the most basic rules (missing new lines, bad indentation etc. ). Non-critical late feedback (after PR has been approved) can be submitted as a new issue or new pull request from the reviewer.

Workflow

  1. The PR author creates a draft PR from a branch.
  2. The author ensures that their PR passes the build and changes its state to Ready for review. Otherwise, the author SHOULD continue to update the pull request until the build passes.
  3. The author adds the required reviewers and other reviewers will be automatically added by Pull Panda.
  4. Once the code review is completed, the author merges the pull request and ensures the correctness of the resulting merge.
  5. (case feature PR) Add changelog file into the changelog/ directory.
  6. (case PR for next release) Add PR to the next version milestone (or create milestone).

Milestones

The aim of the milestones is to provide visibility for PRs that need to be reviewed before the next release freeze. In order to give priority to your PRs simply add them to the next release milestone or, if the next release milestone does not exist, EVERYBODY is free to create it.

Abandoned PRs

A pull request with no changes for more than two weeks without a word from the author/assignee is considered abandoned and will be deleted (jointly with the branch) periodically.

Releasing

Read RELEASING.md for more information about creating a release.

Description

Write something here plz

Jira issue link

[PROJ-1234]

Watchers

@desiredTeam

Before takeoff checklist

  • I have read and followed the CONTRIBUTING document
  • My code follows the code style of this project
  • All new and existing tests passed

Conditionals

  • I have added tests to cover my changes (MANDATORY if PR has code changes)
  • I have created/updated a view:
    • I have updated the API documentation accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment