Skip to content

Commit 01ac6d4

Browse files
authored
linting: run format, ignore specific imports (#195)
1 parent bb4d013 commit 01ac6d4

5 files changed

Lines changed: 26 additions & 4 deletions

File tree

docs/changelog/overview.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Release notes for the Flare Platform can be found on the [product documentation
118118
```python
119119
from flareio import FlareApiClient
120120

121+
121122
client = FlareApiClient.from_env()
122123
```
123124

docs/guides/tenant-events.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ These are end-to-end examples in various programming languages.
9797

9898
<Accordion title="Python SDK Example">
9999
```python
100-
import time
101-
102100
from flareio import FlareApiClient
103101
from flareio.ratelimit import Limiter
104102

docs/sdk/python.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export FLARE_TENANT_ID="<tenant-id>"
5151
```python
5252
from flareio import FlareApiClient
5353

54+
5455
client = FlareApiClient.from_env()
5556

5657
resp = client.get("/tokens/test")

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ combine-as-imports = true
4141
forced-separate = [
4242
"typing",
4343
]
44+
45+
[tool.ty.analysis]
46+
allowed-unresolved-imports = [
47+
"taxii2client.**",
48+
]

src/lintlify/linters/code_blocks.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def _lint_mdx_file_code_blocks(
8080
args=[
8181
lint_context.ty_path,
8282
"check",
83-
"--ignore=unresolved-import",
8483
f.name,
8584
],
8685
)
@@ -90,7 +89,25 @@ def _lint_mdx_file_code_blocks(
9089
message=ex.stdout.decode(),
9190
)
9291

93-
# Run ruff check
92+
# Ruff: check
93+
try:
94+
subprocess.check_output(
95+
args=[
96+
lint_context.ruff_path,
97+
"check",
98+
"--diff",
99+
"--stdin-filename",
100+
filename,
101+
],
102+
input=python_block.body.encode("utf-8"),
103+
)
104+
except subprocess.CalledProcessError as ex:
105+
yield LintError(
106+
filename=filename,
107+
message=ex.stdout.decode(),
108+
)
109+
110+
# Ruff: format check
94111
try:
95112
subprocess.check_output(
96113
args=[

0 commit comments

Comments
 (0)