Small meta cleanups (#4893)

* Remove the unneeded pytest options from pyproject.toml

* Clean up setup.py from old readthedocs.org workaround

* Removes unused folder

* Simplify list of excluded files in black's configuration

* Fix returned exit codes in `make.ps1`

* Add Sublime's project files to `.gitignore`

* Update the link to Black in README and contributing guidelines
This commit is contained in:
jack1142 2021-03-16 19:51:48 +01:00 committed by GitHub
parent 6c903aacff
commit d1bc4b4302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 27 deletions

2
.gitignore vendored
View File

@ -15,6 +15,8 @@ Pipfile.lock
.idea/
*.iws
.vscode/
*.sublime-project
*.sublime-workspace
## Plugin-specific files:

View File

@ -83,7 +83,7 @@ We're using [tox](https://github.com/tox-dev/tox) to run all of our tests. It's
Currently, tox does the following, creating its own virtual environments for each stage:
- Runs all of our unit tests with [pytest](https://github.com/pytest-dev/pytest) on python 3.8 (test environment `py38`)
- Ensures documentation builds without warnings, and all hyperlinks have a valid destination (test environment `docs`)
- Ensures that the code meets our style guide with [black](https://github.com/ambv/black) (test environment `style`)
- Ensures that the code meets our style guide with [black](https://github.com/psf/black) (test environment `style`)
To run all of these tests, just run the command `tox` in the project directory.
@ -92,9 +92,9 @@ To run a subset of these tests, use the command `tox -e <env>`, where `<env>` is
Your PR will not be merged until all of these tests pass.
### 4.3 Style
Our style checker of choice, [black](https://github.com/ambv/black), actually happens to be an auto-formatter. The checking functionality simply detects whether or not it would try to reformat something in your code, should you run the formatter on it. For this reason, we recommend using this tool as a formatter, regardless of any disagreements you might have with the style it enforces.
Our style checker of choice, [black](https://github.com/psf/black), actually happens to be an auto-formatter. The checking functionality simply detects whether or not it would try to reformat something in your code, should you run the formatter on it. For this reason, we recommend using this tool as a formatter, regardless of any disagreements you might have with the style it enforces.
Use the command `black --help` to see how to use this tool. The full style guide is explained in detail on [black's GitHub repository](https://github.com/ambv/black). **There is one exception to this**, however, which is that we set the line length to 99, instead of black's default 88. This is already set in `pyproject.toml` configuration file in the repo so you can simply format code with Black like so: `black <src>`.
Use the command `black --help` to see how to use this tool. The full style guide is explained in detail on [black's GitHub repository](https://github.com/psf/black). **There is one exception to this**, however, which is that we set the line length to 99, instead of black's default 88. This is already set in `pyproject.toml` configuration file in the repo so you can simply format code with Black like so: `black <src>`.
### 4.4 Make
You may have noticed we have a `Makefile` and a `make.bat` in the top-level directory. For now, you can do a few things with them:

View File

@ -32,7 +32,7 @@
<a href="http://red-discordbot.readthedocs.io/en/stable/?badge=stable">
<img src="https://readthedocs.org/projects/red-discordbot/badge/?version=stable" alt="Red on readthedocs.org">
</a>
<a href="https://github.com/ambv/black">
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style: Black">
</a>
<a href="http://makeapullrequest.com">

View File

@ -46,10 +46,12 @@ function reformat() {
function stylecheck() {
& $script:venvPython -m black --check $PSScriptRoot
Exit $LASTEXITCODE
}
function stylediff() {
& $script:venvPython -m black --check --diff $PSScriptRoot
Exit $LASTEXITCODE
}
function newenv() {

View File

@ -2,22 +2,9 @@
line-length = 99
target-version = ['py38']
include = '\.py$'
exclude = '''
force-exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| redbot\/vendored
redbot\/vendored
)/
'''
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--import-mode=importlib"

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,8 +1,4 @@
from setuptools import setup
import os
if os.getenv("READTHEDOCS", False):
setup(python_requires=">=3.7")
else:
# Metadata and options defined in setup.cfg
setup()