freqtrade_origin/CONTRIBUTING.md

136 lines
4.7 KiB
Markdown
Raw Permalink Normal View History

2018-09-12 18:24:19 +00:00
# Contributing
## Contribute to freqtrade
2018-01-02 02:17:10 +00:00
2018-11-09 19:26:10 +00:00
Feel like our bot is missing a feature? We welcome your pull requests!
2017-12-22 12:29:31 +00:00
2018-11-09 19:26:10 +00:00
Issues labeled [good first issue](https://github.com/freqtrade/freqtrade/labels/good%20first%20issue) can be good first contributions, and will help get you familiar with the codebase.
Few pointers for contributions:
2018-09-12 18:24:19 +00:00
- Create your PR against the `develop` branch, not `stable`.
- New features need to contain unit tests, must conform to PEP8 (max-line-length = 100) and should be documented with the introduction PR.
- PR's can be declared as `[WIP]` - which signify Work in Progress Pull Requests (which are not finished).
2017-12-22 12:29:31 +00:00
If you are unsure, discuss the feature on our [discord server](https://discord.gg/p7nuUNVfP7) or in a [issue](https://github.com/freqtrade/freqtrade/issues) before a Pull Request.
2017-12-22 12:29:31 +00:00
2019-01-21 18:53:14 +00:00
## Getting started
Best start by reading the [documentation](https://www.freqtrade.io/) to get a feel for what is possible with the bot, or head straight to the [Developer-documentation](https://www.freqtrade.io/en/latest/developer/) (WIP) which should help you getting started.
## Before sending the PR
2018-01-02 02:17:10 +00:00
2018-11-09 19:26:10 +00:00
### 1. Run unit tests
2017-12-22 12:29:31 +00:00
2018-01-02 02:17:10 +00:00
All unit tests must pass. If a unit test is broken, change your code to
make it pass. It means you have introduced a regression.
2017-12-22 12:29:31 +00:00
2018-11-09 19:26:10 +00:00
#### Test the whole project
2018-09-12 18:24:19 +00:00
2017-12-22 12:29:31 +00:00
```bash
pytest
2017-12-22 12:29:31 +00:00
```
2018-11-09 19:26:10 +00:00
#### Test only one file
2018-09-12 18:24:19 +00:00
2017-12-22 12:29:31 +00:00
```bash
pytest tests/test_<file_name>.py
2017-12-22 12:29:31 +00:00
```
2018-11-09 19:26:10 +00:00
#### Test only one method from one file
2018-09-12 18:24:19 +00:00
2017-12-22 12:29:31 +00:00
```bash
pytest tests/test_<file_name>.py::test_<method_name>
2017-12-22 12:29:31 +00:00
```
2018-01-02 02:17:10 +00:00
2018-11-09 19:26:10 +00:00
### 2. Test if your code is PEP8 compliant
2018-09-12 18:24:19 +00:00
2023-02-22 20:08:17 +00:00
#### Run Ruff
2018-09-12 18:24:19 +00:00
2017-12-22 12:29:31 +00:00
```bash
2023-02-22 20:08:17 +00:00
ruff .
2017-12-22 12:29:31 +00:00
```
2023-02-22 20:08:17 +00:00
We receive a lot of code that fails the `ruff` checks.
2018-06-11 11:50:24 +00:00
To help with that, we encourage you to install the git pre-commit
2023-02-22 20:08:17 +00:00
hook that will warn you when you try to commit code that fails these checks.
you can manually run pre-commit with `pre-commit run -a`.
2018-06-11 11:50:24 +00:00
2021-11-09 07:48:25 +00:00
##### Additional styles applied
* Have docstrings on all public methods
* Use double-quotes for docstrings
* Multiline docstrings should be indented to the level of the first quote
* Doc-strings should follow the reST format (`:param xxx: ...`, `:return: ...`, `:raises KeyError: ... `)
2018-11-09 19:26:10 +00:00
### 3. Test if all type-hints are correct
2017-12-22 12:29:31 +00:00
2018-11-09 19:26:10 +00:00
#### Run mypy
``` bash
2020-02-10 12:41:09 +00:00
mypy freqtrade
```
2018-09-12 18:40:52 +00:00
2020-09-28 15:37:14 +00:00
### 4. Ensure all imports are correct
#### Run isort
``` bash
isort .
```
2018-09-12 18:40:52 +00:00
## (Core)-Committer Guide
### Process: Pull Requests
How to prioritize pull requests, from most to least important:
1. Fixes for broken tests. Broken means broken on any supported platform or Python version.
1. Extra tests to cover corner cases.
1. Minor edits to docs.
1. Bug fixes.
1. Major edits to docs.
1. Features.
Ensure that each pull request meets all requirements in the Contributing document.
### Process: Issues
If an issue is a bug that needs an urgent fix, mark it for the next patch release.
Then either fix it or mark as please-help.
For other issues: encourage friendly discussion, moderate debate, offer your thoughts.
### Process: Your own code changes
All code changes, regardless of who does them, need to be reviewed and merged by someone else.
This rule applies to all the core committers.
Exceptions:
- Minor corrections and fixes to pull requests submitted by others.
- While making a formal release, the release manager can make necessary, appropriate changes.
- Small documentation changes that reinforce existing subject matter. Most commonly being, but not limited to spelling and grammar corrections.
### Responsibilities
- Ensure cross-platform compatibility for every change that's accepted. Windows, Mac & Linux.
2018-09-14 17:56:04 +00:00
- Ensure no malicious code is introduced into the core code.
2018-09-12 18:40:52 +00:00
- Create issues for any major changes and enhancements that you wish to make. Discuss things transparently and get community feedback.
- Keep feature versions as small as possible, preferably one new feature per version.
- Be welcoming to newcomers and encourage diverse new contributors from all backgrounds. See the Python Community Code of Conduct (https://www.python.org/psf/codeofconduct/).
### Becoming a Committer
Contributors may be given commit privileges. Preference will be given to those with:
2020-02-14 18:37:20 +00:00
1. Past contributions to Freqtrade and other related open-source projects. Contributions to Freqtrade include both code (both accepted and pending) and friendly participation in the issue tracker and Pull request reviews. Quantity and quality are considered.
2018-09-12 18:40:52 +00:00
1. A coding style that the other core committers find simple, minimal, and clean.
1. Access to resources for cross-platform development and testing.
1. Time to devote to the project regularly.
Being a Committer does not grant write permission on `develop` or `stable` for security reasons (Users trust Freqtrade with their Exchange API keys).
2018-09-12 18:40:52 +00:00
2019-10-08 19:16:35 +00:00
After being Committer for some time, a Committer may be named Core Committer and given full repository access.