Skip to content

First Pull Request

Camila Maia edited this page Jul 30, 2021 · 17 revisions

How to submit a pull request:

1. Create a GitHub Account

Make sure you have a GitHub account

2. Install Git

Make sure you have Git installed

3. Fork the Project

Fork the ScanAPI repository

4. Clone your Fork

Clone your fork locally

5. Create a New Branch

Go into the ScanAPI folder:

$ cd scanapi

And create a new branch:

$ git checkout -b <issue_number>

6. Run ScanAPI locally

Run ScanAPI locally

7. Make your changes

Now is the step where you can implement your changes in the code.

It is important to notice that we document our code using docstrings. Modules, classes, functions, and methods should be documented. Your changes should also be well documented and should reflect updated docstrings if any of the params were changed for a class/attributes or even functions.

We follow the given pattern below to keep consistency in the docstrings:

class Example:
    """Explain the purpose of the class

    Attributes:
        spec[dict]: Short explanation here
        parent[type, optional]: Short explanation here 

    """

    def __init__(self, spec, parent=None):
        self.spec = spec
        self.parent = parent
    
    def foobar(self, field_name):
        """Purpose if the function

        Args:
            field_name[str]: Short explanation here

        Returns:
            value[str]: Short explanation here

        """
        value = field_name.get('node')
        return value

One last thing to keep in mind while self-documenting code with docstrings that you can ignore docstrings in property decorators and magic methods.

8. Test your changes

8.1 Write new tests

Make sure you have created the necessary tests for every new change you made. Please, visit the page Writing Tests to find the instructions of how to create tests

8.2 Make sure all tests passed

Run all the tests and make sure that they all passed.

PRs will not be merged if there is any test missing or failing.

9. Commit and push your changes

Commit the changes:

$ git commit -a -m "<commit_message>"

We encourage you to follow these rules to write great commit messages: https://www.conventionalcommits.org/en/v1.0.0/

Push your commit to GitHub

$ git push --set-upstream origin <issue_number>

Create the number of changes/commits you need and push them.

10. Add changelog entries

Add a CHANGELOG entry

11. Create a GitHub PR

Create a GitHub PR.

12. Update your branch if needed.

Make sure your branch is updated with master