Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set warn_unused_ignores mypy config to true #1694

Merged
merged 10 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ services:

networks:
faststream-network:
name: "${USER}-faststream-network"
name: "${USER}-faststream-network"
2 changes: 1 addition & 1 deletion .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ uv venv .venv

uv pip install -e ".[dev]"

source .venv/bin/activate
source .venv/bin/activate
38 changes: 13 additions & 25 deletions .github/workflows/pr_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,24 @@ concurrency:
cancel-in-progress: true

jobs:
static_analysis:
pre-commit-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install Dependencies and library
shell: bash
run: |
set -ux
python -m pip install uv
uv pip install --system .[lint]

- name: Run ruff
shell: bash
run: ruff check

- name: Run mypy
shell: bash
run: mypy

- name: Run bandit
shell: bash
run: bandit -c pyproject.toml -r faststream

- name: Run Semgrep
shell: bash
run: semgrep scan --config auto --error
python-version: |
3.8
3.9
3.10
- name: Set $PY environment variable
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/[email protected]

test-basic:
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -481,7 +469,7 @@ jobs:
if: github.event.pull_request.draft == false

needs:
- static_analysis
- pre-commit-check
- coverage-combine
- test-macos-latest
- test-windows-latest
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -17,7 +17,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: [--ignore-words=.codespell-whitelist.txt]
Expand Down Expand Up @@ -60,7 +60,7 @@ repos:
verbose: true

- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
Expand Down
41 changes: 28 additions & 13 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.4.0",
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand All @@ -26,6 +26,9 @@
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
Expand All @@ -36,6 +39,9 @@
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
Expand All @@ -49,9 +55,15 @@
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
Expand All @@ -67,6 +79,9 @@
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
Expand Down Expand Up @@ -112,6 +127,16 @@
}
],
"results": {
"docs/docs/en/confluent/security.md": [
{
"type": "Secret Keyword",
"filename": "docs/docs/en/confluent/security.md",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 88,
"is_secret": false
}
],
"docs/docs/en/getting-started/config/index.md": [
{
"type": "Basic Auth Credentials",
Expand All @@ -128,7 +153,7 @@
"filename": "docs/docs/en/release.md",
"hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450",
"is_verified": false,
"line_number": 1423,
"line_number": 1550,
"is_secret": false
}
],
Expand All @@ -151,17 +176,7 @@
"line_number": 15,
"is_secret": false
}
],
"faststream/rabbit/broker.py": [
{
"type": "Basic Auth Credentials",
"filename": "faststream/rabbit/broker.py",
"hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450",
"is_verified": false,
"line_number": 69,
"is_secret": false
}
]
},
"generated_at": "2024-07-23T21:38:30Z"
"generated_at": "2024-08-20T07:41:38Z"
}
4 changes: 2 additions & 2 deletions docs/docs/en/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Just a hotfix for the following case:
@broker.subscriber(...)
async def handler():
return NatsResponse(...)

await broker.publish(..., rpc=True)
```

Expand All @@ -58,7 +58,7 @@ await broker.publish(..., rpc=True)

### What's Changed

Well, seems like it is the biggest patch release ever 😃
Well, seems like it is the biggest patch release ever 😃

#### Detail Responses

Expand Down
4 changes: 2 additions & 2 deletions faststream/broker/fastapi/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


class StreamRoute(
BaseRoute, # type: ignore[misc]
BaseRoute,
Generic[MsgType, P_HandlerParams, T_HandlerReturn],
):
"""A class representing a stream route."""
Expand Down Expand Up @@ -123,7 +123,7 @@ def __init__(
)


class StreamMessage(Request): # type: ignore[misc]
class StreamMessage(Request):
"""A class to represent a stream message."""

scope: "AnyDict"
Expand Down
4 changes: 2 additions & 2 deletions faststream/broker/fastapi/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def after_processed(
exc_tb: Optional["TracebackType"] = None,
) -> Optional[bool]:
if not exc_type and (
background := cast( # type: ignore[redundant-cast]
background := cast(
Optional[BackgroundTasks],
getattr(context.get_local("message"), "background", None),
)
Expand All @@ -80,7 +80,7 @@ async def after_processed(


class StreamRouter(
APIRouter, # type: ignore[misc]
APIRouter,
AsyncAPIApplication,
Generic[MsgType],
):
Expand Down
2 changes: 1 addition & 1 deletion faststream/cli/supervisors/watchfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from faststream.types import DecoratedCallable


class ExtendedFilter(watchfiles.PythonFilter): # type: ignore[misc]
class ExtendedFilter(watchfiles.PythonFilter):
"""A class that extends the `watchfiles.PythonFilter` class."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ no_implicit_optional = true
check_untyped_defs = true
warn_return_any = true
show_error_codes = true
warn_unused_ignores = false
warn_unused_ignores = true

disallow_incomplete_defs = true
disallow_untyped_decorators = true
Expand Down Expand Up @@ -339,5 +339,5 @@ omit = [
[tool.bandit]

[tool.codespell]
skip = "./venv,./docs/site/*"
skip = "./venv*,./docs/site/*,./htmlcov"
ignore-words = ".codespell-whitelist.txt"
Loading