Skip to content

Commit 7f6c892

Browse files
authored
docs: improve contributing guide (#1334)
* contributing guide improved
1 parent 7179713 commit 7f6c892

File tree

4 files changed

+95
-26
lines changed

4 files changed

+95
-26
lines changed

CONTRIBUTING.md

+95-26
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,128 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
# Table of contents <!-- omit in toc -->
3+
4+
- [Contributing Guidelines](#contributing-guidelines)
5+
- [Reporting Bugs/Feature Requests](#reporting-bugsfeature-requests)
6+
- [Contributing via Pull Requests](#contributing-via-pull-requests)
7+
- [Dev setup](#dev-setup)
8+
- [Local documentation](#local-documentation)
9+
- [Conventions](#conventions)
10+
- [General terminology and practices](#general-terminology-and-practices)
11+
- [Testing definition](#testing-definition)
12+
- [Finding contributions to work on](#finding-contributions-to-work-on)
13+
- [Code of Conduct](#code-of-conduct)
14+
- [Security issue notifications](#security-issue-notifications)
15+
- [Troubleshooting](#troubleshooting)
16+
- [Licensing](#licensing)
17+
118
# Contributing Guidelines
219

3-
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4-
documentation, we greatly value feedback and contributions from our community.
20+
<!-- markdownlint-disable MD013 -->
21+
Thank you for your interest in contributing to our project. Whether it's a [bug report](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=bug%2C+triage&projects=&template=bug_report.md&title=Bug%3A+TITLE), [new feature](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=feature-request%2C+triage&projects=&template=feature_request.md&title=Feature+request%3A+TITLE) or [additional documentation](https://github.com/aws-powertools/powertools-lambda-java/issues/new?assignees=&labels=documentation%2Ctriage&projects=&template=documentation_improvements.yml&title=Docs%3A+TITLE), we greatly value feedback and contributions from our community.
22+
<!-- markdownlint-enable MD013 -->
523

624
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
725
information to effectively respond to your bug report or contribution.
826

9-
1027
## Reporting Bugs/Feature Requests
1128

12-
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13-
14-
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
15-
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16-
17-
* A reproducible test case or series of steps
18-
* The version of our code being used
19-
* Any modifications you've made relevant to the bug
20-
* Anything unusual about your environment or deployment
29+
We welcome you to use the GitHub issue tracker to report bugs, suggest features, or documentation improvements.
2130

31+
<!-- markdownlint-disable MD013 -->
32+
[When filing an issue](https://github.com/aws-powertools/powertools-lambda-java/issues/new/choose), please check [existing open](https://github.com/aws-powertools/powertools-lambda-java/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc), or [recently closed](https://github.com/aws-powertools/powertools-lambda-java/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed) issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can.
33+
<!-- markdownlint-enable MD013 -->
2234

2335
## Contributing via Pull Requests
36+
2437
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
2538

26-
1. You are working against the latest source on the *main* branch.
27-
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28-
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
39+
1. You are working on a fork. [Fork the repository](https://github.com/aws-powertools/powertools-lambda-java/fork).
40+
2. You are working against the latest source on the **main** branch.
41+
3. You've checked existing open, and recently merged pull requests to make sure someone else hasn't addressed the problem already.
42+
4. You've opened an [issue](https://github.com/aws-powertools/powertools-lambda-java/issues/new/choose) before you begin any implementation. We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
43+
44+
### Dev setup
45+
46+
We recommend using [IntelliJ IDEA](https://www.jetbrains.com/idea/) from JetBrains.
47+
A community version is available and largely enough for our purpose.
48+
49+
#### Code Formatting
50+
51+
We strongly recommend installing the CheckStyle-IDEA plugin and apply the provided [checkstyle.xml](checkstyle.xml) in order to comply with our formatting rules:
52+
53+
1. Install the [CheckStyle-IDEA plugin](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea) and restart IntelliJ.
54+
55+
2. After installing the plugin, open the preferences (`⌘,` on macOS, or `Ctrl+Alt+S` on Windows/Linux) and search for _Code Style_. Click on the gear icon near the scheme and import checkstyle configuration. Click on "Apply" and "OK".
56+
![](docs/media/intellij_checkstyle_1.png)
57+
58+
3. Select the code you've created (module, package, class) and reformat code: `⌘⌥L` (macOS), or `Ctrl+Alt+L` (Windows/Linux):
59+
![](docs/media/intellij_checkstyle_2.png)
60+
61+
4. Apply the reformat, optimize imports, rearrange and cleanup to your code and only to java files:
62+
![](docs/media/intellij_checkstyle_3.png)
63+
64+
#### License headers
65+
All the java files should contain the licence/copyright header. You can copy paste it from the [license-header](license-header) file.
2966

30-
To send us a pull request, please:
67+
### Creating the pull request
3168

32-
1. Fork the repository.
33-
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34-
3. Ensure local tests pass: `mvn clean test`
35-
4. Ensure your code is formatted with the provided [checkstyle.xml](https://github.com/aws-powertools/powertools-lambda-java/blob/main/checkstyle.xml): `mvn clean verify`
36-
5. Commit to your fork using clear commit messages.
37-
6. Send us a pull request, answering any default questions in the pull request interface.
38-
7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
69+
To send us a pull request, please follow these steps:
70+
71+
1. Create a new branch to focus on the specific change you are contributing e.g. `improv/logger-debug-sampling`
72+
2. Run all tests, and code baseline checks: `mvn clean verify -P build-with-spotbugs`
73+
3. Commit to your fork using clear commit messages.
74+
4. Send us a pull request with a [conventional semantic title](.github/semantic.yml), and answering any default questions in the pull request interface.
75+
5. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
3976

4077
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4178
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4279

80+
### Local documentation
81+
82+
If you work on the documentation, you may find useful to display it locally while editing, using the following command:
83+
84+
- **Docs website**: `make docs-local-docker`
85+
86+
## Conventions
87+
88+
### General terminology and practices
89+
90+
| Category | Convention |
91+
|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
92+
| **Style guide** | We use Checkstyle and Sonar to enforce beyond good practices. |
93+
| **Exceptions** | Specific exceptions live within the utilities themselves and use `Exception` suffix e.g. `IdempotencyKeyException`. |
94+
| **Git commits** | We follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). We do not enforce conventional commits on contributors to lower the entry bar. Instead, we enforce a conventional PR title so our label automation and changelog are generated correctly. |
95+
| **API documentation** | API reference docs are generated from Javadoc which should have examples to allow developers to have what they need within their own IDE. Documentation website covers the wider usage, tips, and strive to be concise. |
96+
| **Documentation** | We treat it like a product. We sub-divide content aimed at getting started (80% of customers) vs advanced usage (20%). We also ensure customers know how to unit test their code when using our features. |
97+
98+
### Testing definition
99+
100+
We group tests in different categories
101+
102+
| Test | When to write | Notes | Speed |
103+
| ----------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
104+
| Unit tests | Verify the smallest possible unit works. | Networking access is prohibited. Prefer Functional tests given our complexity. | Lightning fast (nsec to ms) |
105+
| End-to-end tests | Gain confidence that a Lambda function with our code operates as expected. | It simulates how customers configure, deploy, and run their Lambda function - Event Source configuration, IAM permissions, etc. | Slow (minutes) |
106+
107+
**NOTE**: Unit tests are mandatory. End-to-end tests should be created for new modules.
108+
We apply the principle of the [test pyramid](https://martinfowler.com/articles/practical-test-pyramid.html), having a majority of unit tests to cover most cases (standard, edge, errors, ...) and generally one end-to-end test to verify the standard case in the target environment.
43109

44110
## Finding contributions to work on
45-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
46111

112+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), [looking at any 'good first issue' issues is a great place to start](https://github.com/aws-powertools/powertools-lambda-java/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
47113

48114
## Code of Conduct
115+
49116
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
50117
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
51-
[email protected] with any additional questions or comments.
52-
118+
<[email protected]> with any additional questions or comments.
53119

54120
## Security issue notifications
121+
55122
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
56123

124+
## Troubleshooting
125+
57126

58127
## Licensing
59128

docs/media/intellij_checkstyle_1.png

537 KB
Loading

docs/media/intellij_checkstyle_2.png

450 KB
Loading

docs/media/intellij_checkstyle_3.png

99.3 KB
Loading

0 commit comments

Comments
 (0)