From d1bc4b43026fec8a6ba0a5537889ce481b7ee9ed Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Tue, 16 Mar 2021 19:51:48 +0100 Subject: [PATCH] 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 --- .gitignore | 2 ++ CONTRIBUTING.md | 6 +++--- README.md | 2 +- make.ps1 | 2 ++ pyproject.toml | 17 ++--------------- redbot/cogs/downloader/repos/.gitignore | 2 -- setup.py | 8 ++------ 7 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 redbot/cogs/downloader/repos/.gitignore diff --git a/.gitignore b/.gitignore index f9a7348da..193a4e7db 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ Pipfile.lock .idea/ *.iws .vscode/ +*.sublime-project +*.sublime-workspace ## Plugin-specific files: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e637926e..7b1e4c2b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 `, where `` 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 `. +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 `. ### 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: diff --git a/README.md b/README.md index c9aa0f741..225bd6418 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Red on readthedocs.org - + Code Style: Black diff --git a/make.ps1 b/make.ps1 index f03b606bd..d960a626e 100644 --- a/make.ps1 +++ b/make.ps1 @@ -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() { diff --git a/pyproject.toml b/pyproject.toml index 49a6790cc..7eb4738da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/redbot/cogs/downloader/repos/.gitignore b/redbot/cogs/downloader/repos/.gitignore deleted file mode 100644 index c96a04f00..000000000 --- a/redbot/cogs/downloader/repos/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/setup.py b/setup.py index 2297ea232..9522f43b7 100644 --- a/setup.py +++ b/setup.py @@ -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() +# Metadata and options defined in setup.cfg +setup()