Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V6] Add contributing guides and improve documentation #1711

Open
wants to merge 10 commits into
base: v6
Choose a base branch
from
33 changes: 31 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Expand Up @@ -2,9 +2,38 @@
name: Bug report
about: Report an issue with this library
---
<!-- Please search existing issues and discussions to avoid creating duplicates. -->
<!--

Before creating a new bug report, please take a few moments to review the following:
- Have you searched existing issues and discussions about your problem? Your problem might be already solved, and this could avoid creating duplicates
- Could this issue cause a security vulnerability? If so, please disclose it privately following the procedure described in https://github.com/openpgpjs/openpgpjs/blob/main/SECURITY.md
- Is this an implementation or support question? If so, open a discussion here https://github.com/openpgpjs/openpgpjs/discussions/categories/q-a

Thank you for your collaboration!

-->

**Expected behavior**
<!--- Tell us what should happen -->

**Current behavior**
<!--- Tell us what happens instead of the expected behavior -->

**Possible solution**
<!--- Not obligatory, but suggest a fix/reason for the bug -->

**Specifications**

- OpenPGP.js version:
- Affected platform (Browser or Node.js version):

<!-- Describe the bug you have encountered -->
**Description**
<!--

Describe the bug you have encountered in detail. If suitable, include:
- Code snippets (so we can reproduce it). As minimal and precisely as possible. Please put these in appropriate code fences for better readability.
- Steps required to reproduce the bug
- The error stack

Also include any other information you want to share that is relevant to the issue being reported.
-->
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,19 @@
<!-- Thank you for sending a pull request! Please take a moment to review the following:

- If this is your first contribution, please read our guide for new contributors https://github.com/openpgpjs/openpgpjs/blob/main/NEW-CONTRIBUTORS.md and our general contributing guide https://github.com/openpgpjs/openpgpjs/blob/main/CONTRIBUTING.md
- Make sure that you have added or run the appropriate tests https://github.com/openpgpjs/openpgpjs/blob/main/CONTRIBUTING.md#testing
- If your PR is not finished, please mark it as a draft
-->

**Description:**
<!-- Explain what this PR does and why we need it -->

**Which issue(s) this PR fixes:**
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

**Breaking changes**
<!-- Does this PR introduce any breaking changes? If so, list which ones -->
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
contact@openpgpjs.org.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
156 changes: 156 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,156 @@
# Contributing to OpenPGP.js

Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.

Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.

As for everything else in the project, the contributions are governed by our [Code of Conduct](https://github.com/openpgpjs/openpgpjs/blob/main/CODE_OF_CONDUCT.md).

- [Contributing to OpenPGP.js](#contributing-to-openpgpjs)
- [Getting started](#getting-started)
- [Decide what you want to work on](#decide-what-you-want-to-work-on)
- [Notify your interest](#notify-your-interest)
- [Setting up the project in your local machine](#setting-up-the-project-in-your-local-machine)
- [Coding conventions](#coding-conventions)
- [Commit conventions](#commit-conventions)
- [Testing](#testing)
- [Pull requests](#pull-requests)
- [I have submitted my PR, what are the next steps?](#i-have-submitted-my-pr-what-are-the-next-steps)
- [Bug reports](#bug-reports)
- [Communication](#communication)
- [Thank you](#thank-you)

## Getting started

### Decide what you want to work on

If you are looking for something to work on, we try to maintain a list of issues that should be suitable for first time contributions, they can be found tagged [`good-first-issue`](https://github.com/openpgpjs/openpgpjs/labels/good-first-issue). You can also look through our issues and pick some you like. If you're still unsure, please [reach out](#communication) and we would help you to the best of our abilities.

### Notify your interest

Please let us know you want to work on it so we can avoid multiple people working on the same issue. Ideally, notify us via our [Gitter](https://gitter.im/openpgpjs/openpgpjs), but expressing your interest in the issue itself is also ok.

**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.

### Setting up the project in your local machine

1. [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the project, clone your fork, and configure the remotes:

```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/openpgpjs

# Navigate to the newly cloned directory
cd openpgpjs

# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/openpgpjs/openpgpjs
```

2. Install dependencies with your preferred package manager:

```bash
npm install
```

3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:

```bash
git checkout -b <topic-branch-name>
```

4. Follow our [coding conventions](#coding-conventions) while developing your changes. You can also run `npm run lint` to match our requirements.

5. Write clear and meaningful git commit messages. Please follow our [commit message conventions](#commit-conventions) while committing to your branch.

6. Make sure to update or add to the tests when appropriate. Run the appropriate testing suites to check that all tests pass after you've made changes. You can read about our different types of tests in our [Testing](#testing) section.

7. If you added or changed a feature, make sure to document it accordingly in the [README.md](https://github.com/openpgpjs/openpgpjs/blob/main/README.md) file, when appropriate.

## Coding conventions

We ensure code consistency through our [ESLint config](https://github.com/openpgpjs/openpgpjs/blob/main/.eslintrc.js). You can run `npm run lint` to lint your changes. When in doubt, follow the style of the surrounding code.

## Commit conventions

We roughly follow the Git commit guidelines in [this blog post](https://cbea.ms/git-commit/).

Additionally, please try to follow the style of the commit messages on our [main branch](https://github.com/openpgpjs/openpgpjs/commits/main).

## Testing

Tests. They are located in the root [`/test`](https://github.com/openpgpjs/openpgpjs/tree/main/test) folder.
Before running the tests, run `npm run build` to build OpenPGP.js if you've made changes since running `npm install`.

**Unit Tests:**
To run the tests in Node.js, run `npm test`.

To run the tests in a browser, run `npm run browsertest`.


**Typescript definitions**

When changing TypeScript definitions, update [the definitions.ts test file](https://github.com/openpgpjs/openpgpjs/blob/main/test/typescript/definitions.ts) accordingly.
Then, run `npm run test-type-definitions` to verify that it still type-checks.
(This is also automatically done for every PR.)

**Coverage**
We have good numbers but we could always use some help improving them!

```sh
npm run coverage
```

## Pull requests

Good pull requests - patches, improvements, new features - are sa fantastic help. They should remain focused in scope and avoid containing unrelated commits.

If you have never created a pull request before, welcome 🙂 Read the GitHub docs on [how to create a pull request from a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).

1. Update your branch to the latest changes in the upstream main branch, solving conflicts if any appear. You can do that locally with:

```bash
git pull --rebase upstream main
```

2. Push your topic branch up to your fork:

```bash
git push origin <topic-branch-name>
```

3. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and follow the instructions specified in the Pull Request template. Include a detailed description explaining the reasons for the changes, making sure there is sufficient information for the reviewer to understand your changes.

4. Check if the Github Actions workflows have passed. Address the errors if they have not.

**IMPORTANT**: By submitting a patch, you agree to license your work under the same license as that used by the project.

### I have submitted my PR, what are the next steps?

First of all, thank you for your contribution! Sit back and relax. Someone from the team will review your PR and respond with comments as soon as possible (usually within a few weeks). Once you have addressed all the comments, your PR will be approved and merged.

## Bug reports

First things first: please **do not report security vulnerabilities in public issues!** Disclose responsibly following the instructions detailed in [SECURITY.md](https://github.com/openpgpjs/openpgpjs/blob/main/SECURITY.md). Thank you.

A bug is a _demonstrable problem_ that is caused by the code in our repository. Good bug reports are extremely helpful!

Guidelines for bug reports:

1. **Use the GitHub issue search** &mdash; check if the issue has already been reported.

2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `main` branch in the repository.

3. **Isolate the problem** &mdash; ideally create a reduced test case.

A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What OS experiences the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.

To create a new bug report, go to Issues, and select the Bug Report template.

## Communication

Feel free to reach out! You can do so in our [Gitter](https://gitter.im/openpgpjs/openpgpjs) or in our [GitHub discussions](https://github.com/openpgpjs/openpgpjs/discussions)

## Thank you

Thanks to [Hoodie](https://github.com/hoodiehq/hoodie) for inspiring this contributing guide.