Skip to content

Commit

Permalink
Implement pre-commit (Pycord-Development#1664)
Browse files Browse the repository at this point in the history
* Add pre-commit

* Fix docstring formatter

* Fix docstring formatter even more

* Add black configuration

* Run pre-commit formatting
  • Loading branch information
BobDotCom authored Oct 4, 2022
1 parent 9cd72bc commit 30e0de4
Show file tree
Hide file tree
Showing 188 changed files with 9,326 additions and 6,574 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
min_python_version = 3.8
ignore =
E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315

max-line-length=120
max-complexity=39
138 changes: 65 additions & 73 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,124 +2,116 @@

## 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, religion, or sexual identity
and orientation.
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, 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.
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:
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
- 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
- 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.
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.
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 e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
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 e-mail 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
Our Discord server.
All complaints will be reviewed and investigated promptly and fairly.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to
the community leaders responsible for enforcement at Our Discord server. 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.
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:
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.
**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.
**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.
**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.
**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.
**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.
**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.
**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.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

Expand Down
73 changes: 51 additions & 22 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## Contributing to Pycord

First off, thanks for taking the time to contribute. It makes the library substantially better. :+1:
First off, thanks for taking the time to contribute. It makes the library substantially
better. :+1:

The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules.
The following is a set of guidelines for contributing to the repository. These are
guidelines, not hard rules.

## This is too much to read! I want to ask a question!

Expand All @@ -12,44 +14,71 @@ Generally speaking questions are better suited in our resources below.
- [The FAQ in the documentation](https://docs.pycord.dev/en/master/faq.html)
- [StackOverflow's `pycord` tag](https://stackoverflow.com/questions/tagged/pycord)

Please try your best not to ask questions in our issue tracker. Most of them don't belong there unless they provide value to a larger audience.
Please try your best not to ask questions in our issue tracker. Most of them don't
belong there unless they provide value to a larger audience.

## Good Bug Reports

Please be aware of the following things when filing bug reports.

1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process but they are enumerated here as well:
- A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
- Guidance on **how to reproduce the issue**. Ideally, this should have a small code sample that allows us to run and see the issue for ourselves to debug. **Please make sure that the token is not displayed**. If you cannot provide a code snippet, then let us know what the steps were, how often it happens, etc.
- Tell us **what you expected to happen**. That way we can meet that expectation.
- Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an exception? Does it hang? How are the expectations different from reality?
- Tell us **information about your environment**. What version of Pycord are you using? How was it installed? What operating system are you running on? These are valuable questions and information that we use.

If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.
1. Don't open duplicate issues. Please search your issue to see if it has been asked
already. Duplicate issues will be closed.
2. When filing a bug about exceptions or tracebacks, please include the _complete_
traceback. Without the complete traceback the issue might be **unsolvable** and you
will be asked to provide more information.
3. Make sure to provide enough information to make the issue workable. The issue
template will generally walk you through the process but they are enumerated here as
well:
- A **summary** of your bug report. This is generally a quick sentence or two to
describe the issue in human terms.
- Guidance on **how to reproduce the issue**. Ideally, this should have a small code
sample that allows us to run and see the issue for ourselves to debug. **Please
make sure that the token is not displayed**. If you cannot provide a code snippet,
then let us know what the steps were, how often it happens, etc.
- Tell us **what you expected to happen**. That way we can meet that expectation.
- Tell us **what actually happens**. What ends up happening in reality? It's not
helpful to say "it fails" or "it doesn't work". Say _how_ it failed, do you get an
exception? Does it hang? How are the expectations different from reality?
- Tell us **information about your environment**. What version of Pycord are you
using? How was it installed? What operating system are you running on? These are
valuable questions and information that we use.

If the bug report is missing this information then it'll take us longer to fix the
issue. We will probably ask for clarification, and barring that if no response was given
then the issue will be closed.

## Submitting a Pull Request

Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 120.
Submitting a pull request is fairly simple, just make sure it focuses on a single aspect
and doesn't manage to have scope creep and it's probably good to go. It would be
incredibly lovely if the style is consistent to that found in the project. This project
follows PEP-8 guidelines (mostly) with a column limit of 120.

## Use of "type: ignore" comments
In some cases, it might be necessary to ignore type checker warnings for one reason or another.
If that is that case, it is **required** that a comment is left explaining why you are
deciding to ignore type checking warnings.

In some cases, it might be necessary to ignore type checker warnings for one reason or
another. If that is that case, it is **required** that a comment is left explaining why
you are deciding to ignore type checking warnings.

### Licensing

By submitting a pull request, you agree that; 1) You hold the copyright on all submitted code inside said pull request; 2) You agree to transfer all rights to the owner of this repository, and; 3) If you are found to be in fault with any of the above, we shall not be held responsible in any way after the pull request has been merged.
By submitting a pull request, you agree that; 1) You hold the copyright on all submitted
code inside said pull request; 2) You agree to transfer all rights to the owner of this
repository, and; 3) If you are found to be in fault with any of the above, we shall not
be held responsible in any way after the pull request has been merged.

## Git Commit Styling

Not following this guideline could lead to your pull being squashed for a cleaner commit history
Not following this guideline could lead to your pull being squashed for a cleaner commit
history

Some style guides we would recommend using in your pulls:

The [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style is a very widely used style and a good style to start with.
The [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style is a
very widely used style and a good style to start with.

The [gitmoji](https://gitmoji.dev) style guide would make your pull look more lively and different to others.
The [gitmoji](https://gitmoji.dev) style guide would make your pull look more lively and
different to others.

We don't limit nor deny your pulls when you're using another style although, please make sure it is appropriate and makes sense in this library.
We don't limit nor deny your pulls when you're using another style although, please make
sure it is appropriate and makes sense in this library.
1 change: 1 addition & 0 deletions .github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Developer Certificate of Origin (DCO)

```
Version 1.1
Expand Down
15 changes: 8 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ body:
- type: markdown
attributes:
value: >
Thanks for taking the time to fill out a bug.
If you want real-time support, consider joining our Discord at https://pycord.dev/discord instead.
Thanks for taking the time to fill out a bug. If you want real-time support,
consider joining our Discord at https://pycord.dev/discord instead.
Please note that this form is for bugs only!
- type: input
Expand All @@ -19,7 +19,7 @@ body:
attributes:
label: Reproduction Steps
description: >
What you did to make it happen.
What you did to make it happen.
validations:
required: true
- type: textarea
Expand All @@ -46,8 +46,8 @@ body:
attributes:
label: Intents
description: >
What intents are you using for your bot?
This is the `discord.Intents` class you pass to the client.
What intents are you using for your bot? This is the `discord.Intents` class you
pass to the client.
validations:
required: true
- type: textarea
Expand All @@ -56,8 +56,9 @@ body:
description: >
Run `python -m discord -v` and paste this information below.
This command required v1.1.0 or higher of the library. If this errors out then show some basic
information involving your system such as operating system and Python version.
This command required v1.1.0 or higher of the library. If this errors out then
show some basic information involving your system such as operating system and
Python version.
validations:
required: true
- type: checkboxes
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ body:
attributes:
label: The Problem
description: >
What problem is your feature trying to solve?
What becomes easier or possible when this feature is implemented?
What problem is your feature trying to solve? What becomes easier or possible
when this feature is implemented?
validations:
required: true
- type: textarea
attributes:
label: The Ideal Solution
description: >
What is your ideal solution to the problem?
What would you like this feature to do?
What is your ideal solution to the problem? What would you like this feature to
do?
validations:
required: true
- type: textarea
Expand Down
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
- [ ] This PR fixes an issue.
- [ ] This PR adds something new (e.g. new method or parameters).
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed).
- [ ] This PR is **not** a code change (e.g. documentation, README, typehinting, examples, ...).
- [ ] This PR is **not** a code change (e.g. documentation, README, typehinting,
examples, ...).

## Checklist

Expand Down
Loading

0 comments on commit 30e0de4

Please sign in to comment.