diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ec563c..c697fdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - "ruff==0.7.4" - "black==24.10.0" - "docstrfmt==1.9.0" - - niquests + - "niquests>=3.10,<4" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: @@ -41,7 +41,7 @@ repos: hooks: - id: ruff args: [ --exit-non-zero-on-fix, --fix ] - files: ^(prawcore/.*)$ + files: ^(prawcore/.*.py)$ - repo: https://github.com/psf/black hooks: diff --git a/tools/generate_async.py b/tools/generate_async.py index 9fdbd00..7d8382d 100755 --- a/tools/generate_async.py +++ b/tools/generate_async.py @@ -60,7 +60,9 @@ def black_reformat(tmp_dir: str) -> list[str]: """Simply run black and retrieve which file were reformatted if any.""" - process = Popen(f"black {tmp_dir}", shell=True, stdout=PIPE, stderr=PIPE) + process = Popen( + f"black prawcore/_async", shell=True, stdout=PIPE, stderr=PIPE, cwd=tmp_dir + ) stdout, stderr = process.communicate() stdout, stderr = stdout.decode(), stderr.decode() @@ -78,7 +80,13 @@ def black_reformat(tmp_dir: str) -> list[str]: def docstrfmt_reformat(tmp_dir: str) -> list[str]: - process = Popen(f"docstrfmt {tmp_dir}", shell=True, stdout=PIPE, stderr=PIPE) + process = Popen( + f"docstrfmt prawcore/_async/*.py", + shell=True, + stdout=PIPE, + stderr=PIPE, + cwd=tmp_dir, + ) stdout, stderr = process.communicate() stdout, stderr = stdout.decode(), stderr.decode() @@ -97,7 +105,9 @@ def docstrfmt_reformat(tmp_dir: str) -> list[str]: def ruff_reformat(tmp_dir: str) -> list[str]: """Run Ruff linter and extract unfixable errors if any.""" - process = Popen(f"ruff format {tmp_dir}", shell=True, stdout=PIPE, stderr=PIPE) + process = Popen( + f"ruff check --fix", shell=True, stdout=PIPE, stderr=PIPE, cwd=tmp_dir + ) stdout, stderr = process.communicate() stdout, stderr = stdout.decode(), stderr.decode()