Skip to content
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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ lintlify: venv
.venv/bin/python -m lintlify.main

.PHONY: lint
lint: broken-links mypy lintlify format-check
lint: broken-links check lintlify format-check

.PHONY: ci
ci: broken-links mypy lintlify format-check test
ci: broken-links check lintlify format-check test

.PHONY: format
format: venv
Expand All @@ -47,15 +47,15 @@ format: venv
format-check: venv
uv run ruff format --check

.PHONY: mypy
mypy: venv
uv run mypy --strict scripts/*.py
uv run mypy --strict --ignore-missing-imports -p lintlify
.PHONY: check
check: venv
uv run ty check

.PHONY: venv
venv: .venv

.venv: uv.lock pyproject.toml
rm -rf .venv
uv sync

.PHONY: test
Expand Down
4 changes: 2 additions & 2 deletions docs/api-reference/v4/endpoints/get-event.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
openapi: get /firework/v4/events/
openapi: firework-v4-openapi get /firework/v4/events/
---

import ModelExamples from '/snippets/event_model_examples.mdx'
Expand All @@ -8,4 +8,4 @@ import ModelExamples from '/snippets/event_model_examples.mdx'
<ResponseExample>
<ModelExamples />
</ResponseExample>
</Panel>
</Panel>
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version = "0.1.0"
authors = [
{ name = "Alexandre Viau", email="alexandre.viau@flare.io>" }
]
requires-python = ">=3.10"
requires-python = ">=3.12"
dependencies = [
"pydantic==2.12.3",
"mypy==1.18.2",
"ruff==0.14.3",
"python-frontmatter==1.1.0",
"requests==2.32.5",
"pytest==8.4.2",
"types-requests==2.32.4.20250913",
"pydantic>=2.12.3",
"ty>=0.0.15",
"ruff>=0.14.3",
"python-frontmatter>=1.1.0",
"requests>=2.32",
"pytest>=8.4.2",
"types-requests>=2.32",
"flareio>=1.2.0",
]

Expand Down
4 changes: 2 additions & 2 deletions src/lintlify/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class LintContext:
repository_root: str

@property
def mypy_path(self) -> str:
def ty_path(self) -> str:
return os.path.join(
self.repository_root,
".venv",
"bin",
"mypy",
"ty",
)

@property
Expand Down
32 changes: 18 additions & 14 deletions src/lintlify/linters/code_blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dataclasses
import re
import subprocess
import tempfile

from lintlify.context import LintContext
from lintlify.error import LintError
Expand Down Expand Up @@ -71,20 +72,23 @@ def _lint_mdx_file_code_blocks(

# Run mypy
if not is_incomplete_example:
try:
subprocess.check_output(
args=[
lint_context.mypy_path,
"--ignore-missing-imports",
"/dev/stdin",
],
input=python_block.body.encode("utf-8"),
)
except subprocess.CalledProcessError as ex:
yield LintError(
filename=filename,
message=ex.stdout.decode(),
)
with tempfile.NamedTemporaryFile() as f:
f.write(python_block.body.encode("utf-8"))
f.flush()
try:
subprocess.check_output(
args=[
lint_context.ty_path,
"check",
"--ignore=unresolved-import",
f.name,
],
)
except subprocess.CalledProcessError as ex:
yield LintError(
filename=filename,
message=ex.stdout.decode(),
)

# Run ruff check
try:
Expand Down
2 changes: 1 addition & 1 deletion src/lintlify/linters/frontmatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _lint_frontmatter_file_openapi(
mdx_file: mdx.MdxFile,
) -> t.Iterator[LintError]:
property = _FrontmatterOpenapi.from_raw(
mdx_file.post.metadata["openapi"],
str(mdx_file.post.metadata["openapi"]),
)

for reference_file in lint_context.openapi_files:
Expand Down
Loading