Contribution guidelines (#103)

* Contribution guidelines
* Code of conduct
* Templates for issues and PRs
This commit is contained in:
Jonathan Lange 2018-01-05 11:24:08 +00:00 committed by GitHub
parent 503137c655
commit c2b93d0ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 120 additions and 0 deletions

11
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,11 @@
<!--
Hi, thank you for opening an issue! We really appreciate you taking the time to give us feedback.
-->
## What you expected to happen?
## What happened?
<!-- Error message, actual behaviour, etc. Full stack traces much appreciated. -->
## How to reproduce it?
<!-- Specific steps, as minimally and precisely as possible. -->

22
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,22 @@
<!--
Hi, thanks for this PR! We are really grateful, and deeply appreciate the work and effort involved.
It might take a little while for us to get around to reviewing it. Sorry for the delay.
To help things go as quickly as possible, please:
- update the CHANGELOG in your PR
- keep the PR as small and focused as you can
- follow the coding guidelines found in CONTRIBUTING.rst
-->
## What does this do?
<!-- brief explanation of the functionality this provides -->
## Why is it a good idea?
<!-- how does it help grafanalib users / maintainers? -->
## Context
<!-- any background that might help the reviewer understand what's going on -->
## Questions
<!-- things you're uncertain about that you want the reviewer to focus on -->

12
docs/CODE_OF_CONDUCT.rst Normal file
View File

@ -0,0 +1,12 @@
=========================
Community Code of Conduct
=========================
Weaveworks follows the `CNCF Community Code of Conduct v1.0`_.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
a Weaveworks project maintainer,
or
Alexis Richardson <alexis@weave.works>.
.. _`CNCF Community Code of Conduct v1.0`: https://github.com/cncf/foundation/blob/0ce4694e5103c0c24ca90c189da81e5408a46632/code-of-conduct.md

75
docs/CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,75 @@
==========================
Contributing to grafanalib
==========================
Thank you for contributing to grafanalib!
Here are some notes to help you get your PR merged as quickly as possible,
and to help us remember how to review things properly.
If something comes up during a code review or on a ticket that you think should be part of these guidelines, please say so, or even file a PR to make this doc better!
Code of conduct
===============
We have a `code of conduct`_, and we enforce it. Please take a look!
Coding guidelines
=================
* Python 3 all the way
* Must be `flake8`_ compliant
* We use `attrs`_ everywhere
* Avoid inheritance as much as possible
* Avoid mutation as much as possible—keep things purely functional
* Docstrings are great, let's have more of those
* Link to official Grafana docs in comments as much as possible
Conventions
-----------
* Classes are ``StudlyCaps``
* Attributes are ``camelCased``
* Methods are ``snake_cased``
* Local variables are ``snake_cased``
* We're kind of fussy about indentation:
4 spaces everywhere, follow the examples in `core.py`_ if you're uncertain
Testing
-------
Lots of grafanalib is just simple data structures, so we aren't fastidious about test coverage.
However, tests are strongly encouraged for anything with non-trivial logic.
Please try to use `hypothesis`_ for your tests.
Gotchas
-------
* Do **not** use mutable values as default values for attributes.
Mutable values include lists (e.g. ``default=[RED, GREEN]``) and other grafanalib objects (e.g. ``default=Annotations()``).
Instead, use `attr.Factory`_.
e.g. ``default=attr.Factory(Annotations)`` or ``default=attr.Factory(lambda: [RED, GREEN])``.
Submitting a PR
===============
* We are very grateful for all PRs, and deeply appreciate the work and effort involved!
* We try to review PRs as quickly as possible, but it might take a couple of weeks to get around to reviewing your PR—sorry, we know that sucks
* Please add an entry to the `CHANGELOG`_ in your PR
* It helps a lot if the PR description provides some context on what you are trying to do and why you think it's a good idea
* The smaller the PR, the more quickly we'll be able to review it
Filing a bug
============
* Please say what you saw, what you expected to see, and how someone else can reproduce the bug
* If it comes with a test case, even better!
.. _`flake8`: http://flake8.pycqa.org/en/latest/
.. _`attrs`: http://www.attrs.org/en/stable/
.. _`CHANGELOG`: ../CHANGELOG.rst
.. _`attr.Factory`: http://www.attrs.org/en/stable/api.html#attr.Factory
.. _`hypothesis`: http://hypothesis.works/
.. _`core.py`: ../grafanalib/core.py
.. _`code of conduct`: ./CODE_OF_CONDUCT.rst