Skip to content

Latest commit

 

History

History
126 lines (96 loc) · 4.61 KB

CONTRIBUTING.md

File metadata and controls

126 lines (96 loc) · 4.61 KB

Contributing to gringotts

There are many ways to contribute to gringotts,

  1. Integrate a new Payment Gateway.
  2. Expanding the feature coverage of (partially) supported gateways.
  3. Moving forward on the roadmap or on tasks being tracked in the milestones.

We manage our development using milestones and issues so if you're a first time contributor, look out for the good first issue and the hotlist: community-help labels on the issues page.

The docs are hosted on hexdocs.pm and are updated for each release. You must build the docs locally using mix docs to get the bleeding edge developer docs.

The article on Gringott's Architecture explains how API calls are processed.

Please base your work on the dev branch.

Style Guidelines

We follow lexmag/elixir-style-guide and rrrene/elixir-style-guide (both overlap a lot), and use the elixir formatter.

To enforce these, and also to make it easier for new contributors to adhere to our style, we've provided a collection of handy git-hooks under the .scripts/ directory.

  • .scripts/pre-commit Runs the format --check-formatted task.
  • .scripts/post-commit Runs a customised credo check.

While we do not force you to use these hooks, you could write your very own by taking inspiration from ours 😄

To set the git-hooks as provided, go to the repo root,

cd path/to/gringotts/

and make these symbolic links:

ln -s .scripts/pre-commit .git/hooks/pre-commit
ln -s .scripts/post-commit .git/hooks/post-commit

Note that our CI will fail your PR if you dont run mix format in the project root.

General Rules

  • Keep line length below 100 characters.
  • Complex anonymous functions should be extracted into named functions.
  • One line functions, should only take up one line!
  • Pipes are great, but don't use them if they are less readable than brackets!

Writing documentation

All our docs are inline and built using ExDocs. Please take a look at how the docs are structured for the MONEI gateway for inspiration.

Writing test cases

This is WIP.

gringotts has mock and integration tests. We have currently used bypass and mock for mock tests, but we don't recommed using mock as it constrains tests to run serially. Use mox instead.
Take a look at MONEI's mock tests for inspiration.

PR submission checklist

Each PR should introduce a focussed set of changes, and ideally not span over unrelated modules.

  • Format the project with the Elixir formatter.
    cd path/to/gringotts/
    mix format
  • Run the edited files through credo with the --strict flag.
    cd path/to/gringotts/
    mix credo --strict
  • Check the test coverage by running mix coveralls. 100% coverage is not strictly required.
  • If the PR introduces a new Gateway or just Gateway specific changes, please format the title like so,
    [<gateway-name>] <the-title>

Note You can skip the first two steps if you have set up git-hooks as we have provided!


Where to next? Wanna add a new gateway? Head to our guide for that.