markdown linting

This commit is contained in:
Danglewood
2026-06-01 14:49:24 -07:00
parent d8fd8f06da
commit bf0cb48465
18 changed files with 208 additions and 165 deletions

View File

@@ -81,16 +81,55 @@ jobs:
uv pip install --system -e "./$pkg" || echo "skip $pkg (install failed)"
fi
done
- run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2
- run: |
# Run linters for openbb_platform | cli
if [ -n "${{ env.diff_files }}" ]; then
ruff format --check ${{ env.diff_files }}
ruff check ${{ env.diff_files }}
ty check ${{ env.diff_files }}
else
echo "No Python files changed in openbb_platform | cli"
fi
- name: Install openbb-core editable (resident, single identity for ty)
run: |
# Install core last and editable so the in-tree source is the resident
# `openbb_core`. A published wheel pulled in as a transitive dep above
# would otherwise shadow it and produce spurious type-identity errors.
uv pip install --system -e "./openbb_platform/core[pandas]" numpy
- name: codespell
run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2
- name: ruff + ty (per package, from each package root)
if: env.diff_files != ''
run: |
# ty must run from each package's own root. Invoked from the repo root,
# an in-tree file like openbb_platform/core/openbb_core/app/router.py
# resolves under a different module identity than the installed
# `openbb_core`, yielding false "incompatible type" errors. Grouping
# changed files by their nearest pyproject.toml ancestor makes each
# package its own ty project root, so first-party imports resolve to a
# single identity (matching how the per-package test-unit jobs run ty).
status=0
declare -A pkg_files
for f in ${{ env.diff_files }}; do
dir=$(dirname "$f")
while [ "$dir" != "." ] && [ ! -f "$dir/pyproject.toml" ]; do
dir=$(dirname "$dir")
done
if [ -f "$dir/pyproject.toml" ]; then
pkg_files["$dir"]+="${f#"$dir"/} "
else
echo "::warning::no pyproject.toml ancestor for $f; checking from repo root"
pkg_files["."]+="$f "
fi
done
for pkg in "${!pkg_files[@]}"; do
files=${pkg_files[$pkg]}
echo "::group::Linting $pkg"
(
cd "$pkg"
rc=0
ruff format --check $files || rc=1
ruff check $files || rc=1
ty check $files || rc=1
exit $rc
) || status=1
echo "::endgroup::"
done
exit $status
markdown-link-check:
name: Markdown Linting
@@ -103,6 +142,7 @@ jobs:
- name: Lint Code Base
uses: docker://avtodev/markdown-lint:v1
with:
ignore: "./openbb_platform/extensions/mcp_server/openbb_mcp_server/skills/**/*.md ./openbb_platform/providers/sec/openbb_sec/utils/STATEMENT_SCHEMA_README.md"
args: "./*.md ./changelogs/*.md ./openbb_platform/**/*.md"
json-yaml-validate: