Skip to content

Commit 8553b29

Browse files
authored
Merge pull request #144 from TotallyNotRobots/pre-commit
Add pre-commit configs
2 parents bff030a + bcaa306 commit 8553b29

File tree

5 files changed

+125
-55
lines changed

5 files changed

+125
-55
lines changed

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
args: ['--markdown-linebreak-ext=md,markdown']
7+
- id: end-of-file-fixer
8+
- id: check-yaml
9+
- id: check-added-large-files
10+
- id: check-ast
11+
- id: check-byte-order-marker
12+
- id: check-merge-conflict
13+
- id: debug-statements
14+
- id: detect-private-key
15+
exclude: 'tests/data/.*'
16+
- id: check-builtin-literals
17+
- id: check-case-conflict
18+
- id: check-docstring-first
19+
- id: check-executables-have-shebangs
20+
- id: check-json
21+
- id: pretty-format-json
22+
args:
23+
- '--indent'
24+
- '4'
25+
- '--autofix'
26+
- '--no-sort-keys'
27+
- id: check-toml
28+
- id: fix-encoding-pragma
29+
args:
30+
- '--remove'
31+
- repo: https://github.com/psf/black
32+
rev: 19.10b0
33+
hooks:
34+
- id: black
35+
- repo: https://github.com/asottile/blacken-docs
36+
rev: v1.7.0
37+
hooks:
38+
- id: blacken-docs
39+
additional_dependencies:
40+
- black==19.10b0
41+
- repo: https://github.com/asottile/seed-isort-config
42+
rev: v2.1.1
43+
hooks:
44+
- id: seed-isort-config
45+
- repo: https://github.com/timothycrosley/isort
46+
rev: 4.3.21
47+
hooks:
48+
- id: isort
49+
additional_dependencies:
50+
- toml==0.10.0
51+
- repo: https://github.com/pre-commit/pygrep-hooks
52+
rev: v1.5.1
53+
hooks:
54+
- id: python-no-eval
55+
- id: python-no-log-warn

CONTRIBUTING.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
11
# How to contribute
2-
3-
Heya, Luke here. It's awesome that you want to help contribute to CloudBot!
4-
This should be as easy as possible for you but there are a few things to consider when contributing.
5-
6-
The following guidelines for contribution should be followed if you want to submit a pull request. If you have any troubles, just come and ask us for help on our IRC channel.
2+
The following guidelines for contribution should be followed if you want to
3+
submit a pull request.
74

85
## Basic Overview
9-
10-
* Read [Github documentation](http://help.github.com/) and [Pull Request documentation](http://help.github.com/send-pull-requests/)
11-
* Fork the repository
12-
* Edit the files, add new files
13-
* Check the files with [`pep8`](https://pypi.python.org/pypi/pep8), fix any reported errors
14-
* Check that the files work as expected in CloudBot
15-
* Create a new branch with a descriptive name for your feature (optional)
16-
* Commit changes, push to your fork on GitHub
17-
* Create a new pull request, provide a short summary of changes in the title line, with more information in the description field.
18-
* After submitting the pull request, join the IRC channel (irc.esper.net #cloudbot) and give us a link so we know you submitted it.
19-
* After discussion, your pull request will be accepted or rejected.
20-
21-
## How to prepare
22-
23-
* You need a [GitHub account](https://github.com/signup/free)
24-
* Submit an [issue ticket](https://github.com/ClouDev/CloudBot/issues) for your issue if there is no one yet.
25-
* Try to describe the issue and include steps to reproduce if it's a bug.
26-
* If you are able and want to fix this, fork the repository on GitHub
27-
28-
## Make Changes
29-
30-
* In your forked repository, create a topic branch for your upcoming patch. (optional)
31-
* Make sure you stick to the coding style that is used already.
32-
* Make use of the [`.editorconfig`](http://editorconfig.org/) file.
33-
* Make commits that make sense and describe them properly.
34-
* Check for unnecessary whitespace with `git diff --check` before committing.
35-
* Check your changes with [`pep8`](https://pypi.python.org/pypi/pep8). You can usually ignore messages about line length, but we like to keep lines shorter then 120 characters if at all possible.
6+
1. Read [Github documentation](http://help.github.com/) and [Pull Request documentation](http://help.github.com/send-pull-requests/)
7+
2. Fork the repository
8+
3. Create a new branch with a descriptive name for your feature
9+
4. Edit the files, add new files
10+
5. Add tests for your changes or new feature
11+
6. [Use pre-commit] to check that your changes follow the coding style
12+
7. Add an entry in the [CHANGELOG]
13+
8. Commit changes, push to your fork on GitHub
14+
9. Create a new pull request, provide a short summary of changes in the title line, with more information in the description field.
15+
16+
## Use pre-commit
17+
This project uses [pre-commit]
18+
1. [Install pre-commit]
19+
2. Run `pre-commit install` to add it as a git precommit hook to run checks on each `git commit` in the repository
20+
3. Run `pre-commit run` before commiting, to check your changes easily
3621

3722
## Submit Changes
38-
39-
* Push your changes to a topic branch in your fork of the repository.
40-
* Open a pull request to the original repository and choose the `python3.4` branch.
41-
_Advanced users may use [`hub`](https://github.com/defunkt/hub#git-pull-request) gem for that._
42-
* If not done in commit messages (which you really should do) please reference and update your issue with the code changes. But _please do not close the issue yourself_.
43-
_Notice: You can [turn your previously filed issues into a pull-request here](http://issue2pr.herokuapp.com/)._
23+
1. Push your changes to a topic branch in your fork of the repository.
24+
2. Open a pull request to the original repository and choose the `gonzobot` branch.
25+
3. Correct any issues shown by the automated checks
26+
4. Join the [IRC channel] if you have any questions or concerns, or if you just want to talk with other devs
4427

4528
# Additional Resources
46-
4729
* [General GitHub documentation](http://help.github.com/)
4830
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
4931
* [Read the Issue Guidelines by @necolas](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md) for more details
5032
* [This CONTRIBUTING.md from here](https://github.com/anselmh/CONTRIBUTING.md)
33+
34+
[pre-commit]: https://pre-commit.com/
35+
[Install pre-commit]: https://pre-commit.com/#install
36+
[Use pre-commit]: #use-pre-commit
37+
[CHANGELOG]: CHANGELOG.md
38+
[IRC channel]: README.md#support

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ CloudBot is a simple, fast, expandable open-source Python IRC Bot!
88

99
## Getting CloudBot
1010

11-
There are currently four different branches of this repository, each with a different level of stability:
12-
- **gonzobot** *(stable)*: This branch contains everything in the **master** branch plus additional plugins added for Snoonet IRC. This branch is the currently maintained branch which will also contain many fixes for various bugs from the master branch.
13-
- **gonzobot-dev** *(unstable)*: This branch is based off of the **gonzobot** branch and includes new plugins that are not fully tested.
14-
- **master** *(stable (old))*: This branch contains stable, tested code. This branch is based directly on the upstream master branch and is not currently maintained.
15-
- **python3.4** *(unstable (old))*: This is the outdated testing branch from the upstream repo.
11+
You have a few options for getting the bot, you can:
12+
* Clone the `gonzobot` branch of this repository, using `git pull` to update
13+
* Download the [latest source]
14+
* Download the [latest release]
1615

1716
## Installing CloudBot
1817

@@ -33,28 +32,26 @@ Once you have installed the required dependencies and renamed the config file, y
3332
python3 -m cloudbot
3433
```
3534

36-
Note that you can also run the `cloudbot/__main__.py` file directly, which will work from any directory.
37-
```
38-
python3 CloudBot/cloudbot/__main__.py
39-
```
40-
Specify the path as /path/to/repository/cloudbot/__main__.py, where `cloudbot` is inside the repository directory.
41-
4235
## Getting help with CloudBot
4336

4437
### Documentation
4538

46-
The CloudBot documentation is currently somewhat outdated and may not be correct. If you need any help, please visit our [IRC channel](https://webchat.snoonet.org/#gonzobot-dev) and we will be happy to assist you.
39+
The CloudBot documentation is currently somewhat outdated and may not be correct. If you need any help, please visit our [IRC channel](#support) and we will be happy to assist you.
4740

48-
To write your own plugins, visit the [Plugins Wiki Page](https://github.com/CloudBotIRC/CloudBot/wiki/Writing-your-first-command-plugin).
41+
To write your own plugins, visit the [Plugins Wiki Page](https://github.com/TotallyNotRobots/CloudBot/wiki/Writing-your-first-command-plugin).
4942

50-
More at the [Wiki Main Page](https://github.com/CloudBotIRC/CloudBot/wiki).
43+
More at the [Wiki Main Page](https://github.com/TotallyNotRobots/CloudBot/wiki).
5144

5245
### Support
5346

5447
The developers reside in [#gonzobot-dev](https://webchat.snoonet.org/#gonzobot-dev) on [Snoonet](https://snoonet.org) and would be glad to help you.
5548

5649
If you think you have found a bug/have a idea/suggestion, please **open a issue** here on Github and contact us on IRC!
5750

51+
## Contributing
52+
53+
See [CONTRIBUTING.md](CONTRIBUTING.md)
54+
5855
## Changelog
5956

6057
See [CHANGELOG.md](CHANGELOG.md)
@@ -90,3 +87,6 @@ This product includes GeoLite2 data created by MaxMind, available from
9087
Translations are Powered by [Yandex.Translate](https://translate.yandex.com)
9188

9289
This product uses data from <a href="http://wordnik.com">http://wordnik.com</a> in accordance with the wordnik.com API <a href="http://developer.wordnik.com/#!/terms">terms of service</a>.
90+
91+
[latest source]: https://github.com/TotallyNotRobots/CloudBot/archive/gonzobot.zip
92+
[latest release]: https://github.com/TotallyNotRobots/CloudBot/releases/latest

cloudbot/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
os.chdir(str(install_dir))
1717

1818
# import bot
19-
from cloudbot.bot import CloudBot
20-
from cloudbot.util import async_util
19+
from cloudbot.bot import CloudBot # isort:skip
20+
from cloudbot.util import async_util # isort:skip
2121

2222

2323
def main():

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[tool.isort]
2+
line_length=88
3+
multi_line_output=3
4+
include_trailing_comma=true
5+
use_parentheses=true
6+
7+
[tool.black]
8+
line-length = 88
9+
target-version = ['py35']
10+
include = '\.pyi?$'
11+
exclude = '''
12+
(
13+
/(
14+
\.eggs # exclude a few common directories in the
15+
| \.git # root of the project
16+
| \.hg
17+
| \.mypy_cache
18+
| \.tox
19+
| \.venv
20+
| _build
21+
| buck-out
22+
| build
23+
| dist
24+
| venv
25+
)/
26+
)
27+
'''

0 commit comments

Comments
 (0)