Skip to content

Commit 895ada9

Browse files
authored
docs: Added contributing tools (#10)
* docs: Added CONTRIBUTING * docs: Updated README
1 parent 18389bc commit 895ada9

4 files changed

Lines changed: 296 additions & 5 deletions

File tree

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
fg-feedback@protonmail.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Contributing to validate-python-headers
2+
3+
Everything you need to know to contribute efficiently to the project!
4+
5+
Whatever the way you wish to contribute to the project, please respect the [code of conduct](CODE_OF_CONDUCT.md).
6+
7+
8+
9+
## Codebase structure
10+
11+
- [src](https://github.com/frgfm/validate-python-headers/blob/main/src) - The actual script used for header verification
12+
- [action.yml](https://github.com/frgfm/validate-python-headers/blob/main/tests) - The marketplace action configuration file
13+
- [Dockerfile](https://github.com/frgfm/validate-python-headers/blob/main/Dockerfile) - The dockerfile of the action
14+
- [entrypoint.sh](https://github.com/frgfm/validate-python-headers/blob/main/entrypoint.sh) - The bash script executed by the Docker container
15+
16+
17+
## Continuous Integration
18+
19+
This project uses the following integrations to ensure proper codebase maintenance:
20+
21+
- [Github Worklow](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow) - run jobs for package build and coverage
22+
- [Codacy](https://www.codacy.com/) - analyzes commits for code quality
23+
24+
As a contributor, you will only have to ensure coverage of your code by adding appropriate unit testing of your code.
25+
26+
27+
28+
## Feedback
29+
30+
### Feature requests & bug report
31+
32+
Whether you encountered a problem, or you have a feature suggestion, your input has value and can be used by contributors to reference it in their developments. For this purpose, we advise you to use Github [issues](https://github.com/frgfm/validate-python-headers/issues).
33+
34+
First, check whether the topic wasn't already covered in an open / closed issue. If not, feel free to open a new one! When doing so, use issue templates whenever possible and provide enough information for other contributors to jump in.
35+
36+
### Questions
37+
38+
If you are wondering how to do something with this action, or a more general question, you should consider checking out Github [discussions](https://github.com/frgfm/validate-python-headers/discussions). See it as a Q&A forum, or the project-specific StackOverflow!
39+
40+
41+
42+
## Submitting a Pull Request
43+
44+
### Preparing your local branch
45+
46+
1 - Fork this [repository](https://github.com/frgfm/validate-python-headers) by clicking on the "Fork" button at the top right of the page. This will create a copy of the project under your GitHub account (cf. [Fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo)).
47+
48+
2 - [Clone your fork](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) to your local disk and set the upstream to this repo
49+
```shell
50+
git clone git@github.com:<YOUR_GITHUB_ACCOUNT>/validate-python-headers.git
51+
cd validate-python-headers
52+
git remote add upstream https://github.com/frgfm/validate-python-headers.git
53+
```
54+
55+
3 - You should not work on the `main` branch, so let's create a new one
56+
```shell
57+
git checkout -b a-short-description
58+
```
59+
60+
4 - You only have to set your development environment now, using the following command:
61+
```shell
62+
make build
63+
```
64+
65+
### Developing your feature
66+
67+
#### Commits
68+
69+
- **Code**: ensure to provide docstrings to your Python code. In doing so, please follow [Google-style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) so it can ease the process of documentation later.
70+
- **Commit message**: please follow [Udacity guide](http://udacity.github.io/git-styleguide/)
71+
72+
#### Action sanity check
73+
74+
In order to run the same checks as the CI workflows, you can run tests locally:
75+
76+
```shell
77+
make test
78+
```
79+
80+
#### Code quality
81+
82+
To run all quality checks together
83+
84+
```shell
85+
make quality
86+
```
87+
88+
##### Lint verification
89+
90+
To ensure that your incoming PR complies with the lint settings, you need to install [flake8](https://flake8.pycqa.org/en/latest/) and run the following command from the repository's root folder:
91+
92+
```shell
93+
flake8 ./
94+
```
95+
This will read the `.flake8` setting file and let you know whether your commits need some adjustments.
96+
97+
##### Import order
98+
99+
In order to ensure there is a common import order convention, run [isort](https://github.com/PyCQA/isort) as follows:
100+
101+
```shell
102+
isort .
103+
```
104+
This will reorder the imports of your local files.
105+
106+
##### Annotation typing
107+
108+
Additionally, to catch type-related issues and have a cleaner codebase, annotation typing are expected. After installing [mypy](https://github.com/python/mypy), you can run the verifications as follows:
109+
110+
```shell
111+
mypy
112+
```
113+
The `pyproject.toml` file will be read to check your typing.
114+
115+
##### Code formatting
116+
117+
Finally, code formatting is a good practice for shareable projects. After installing [black](https://github.com/psf/black), you can run the verifications as follows:
118+
119+
```shell
120+
black .
121+
```
122+
123+
### Submit your modifications
124+
125+
Push your last modifications to your remote branch
126+
```shell
127+
git push -u origin a-short-description
128+
```
129+
130+
Then [open a Pull Request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) from your fork's branch. Follow the instructions of the Pull Request template and then click on "Create a pull request".

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# this target runs checks on all files
2+
quality:
3+
isort . -c
4+
flake8 ./
5+
mypy
6+
black --check .
7+
8+
# this target runs checks on all files and potentially modifies some of them
9+
style:
10+
isort .
11+
black .
12+
13+
# Build the docker image
14+
build:
15+
docker build . -t header-validator:py3.8.13-alpine
16+
17+
# Run tests for the library
18+
test:
19+
docker build . -t header-validator:py3.8.13-alpine
20+
docker run --workdir /github/workspace -v src:/github/workspace/src header-validator:py3.8.13-alpine Apache-2.0 'François-Guillaume Fernandez' 2022 src/ __init__.py

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ This action checks the copyright and license notices in the headers of your Pyth
1818

1919
## Inputs
2020

21-
## `license`
21+
### `license`
2222

2323
**Required** Identifier of the license for your project (cf. [SPDX identifiers](https://spdx.org/licenses/)).
2424

25-
## `owner`
25+
### `owner`
2626

2727
**Required** The copyright owner.
2828

29-
## `starting-year`
29+
### `starting-year`
3030

3131
**Required** The starting year of your project.
3232

33-
## `folders`
33+
### `folders`
3434

3535
The folders to inspect, separated by a comma. Default `"."`.
3636

37-
## `ignores`
37+
### `ignores`
3838

3939
The files to ignore, separated by a comma. Default `"__init__.py"`.
4040

@@ -52,3 +52,16 @@ with:
5252
starting-year: 2022
5353
ignores: 'version.py,__init__.py'
5454
```
55+
56+
57+
## Contributing
58+
59+
Any sort of contribution is greatly appreciated!
60+
61+
You can find a short guide in [`CONTRIBUTING`](CONTRIBUTING) to help grow this project!
62+
63+
64+
65+
## License
66+
67+
Distributed under the Apache 2.0 License. See [`LICENSE`](LICENSE) for more information.

0 commit comments

Comments
 (0)