From 8a66b926844ee849de4b36d4d6507d9ba9782784 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 20 Sep 2025 12:24:38 -0400 Subject: [PATCH] fix(ci): auto-run formatters --- .github/workflows/quality.yml | 25 +++++++++++++++++++++ .pre-commit-config.yaml | 10 +++++++-- README.md | 41 ++++++++++++++++++----------------- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index c100808..5d9f824 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -12,6 +12,7 @@ jobs: outputs: lua: ${{ steps.changes.outputs.lua }} python: ${{ steps.changes.outputs.python }} + markdown: ${{ steps.changes.outputs.markdown }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 @@ -33,6 +34,9 @@ jobs: - 'tests/scrapers/**' - 'pyproject.toml' - 'uv.lock' + markdown: + - '*.md' + - 'docs/**/*.md' lua-format: name: Lua Format Check @@ -115,3 +119,24 @@ jobs: run: uv sync --dev - name: Type check Python files with mypy run: uv run mypy scrapers/ tests/scrapers/ + + markdown-format: + name: Markdown Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.markdown == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + - name: Install prettier + run: pnpm add -g prettier@3.1.0 + - name: Check markdown formatting with prettier + run: prettier --check "*.md" "docs/**/*.md" || true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4acb307..51a81f3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: hooks: - id: stylua-github name: stylua (Lua formatter) - args: ["--check", "."] + args: ["."] files: ^(lua/|spec/|plugin/|after/|ftdetect/|.*\.lua$) additional_dependencies: [] - repo: https://github.com/astral-sh/ruff-pre-commit @@ -16,7 +16,7 @@ repos: files: ^(scrapers/|tests/scrapers/|.*\.py$) - id: ruff name: ruff (lint) - args: ["--no-fix"] + args: ["--fix", "--select=I"] files: ^(scrapers/|tests/scrapers/|.*\.py$) - repo: local hooks: @@ -27,3 +27,9 @@ repos: args: ["scrapers/", "tests/scrapers/"] files: ^(scrapers/|tests/scrapers/|.*\.py$) pass_filenames: false + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + name: prettier (format markdown) + files: \.(md)$ diff --git a/README.md b/README.md index f7b9424..bc950b8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Scrape problems, run tests, and debug solutions across multiple platforms with zero configuration. -> **Disclaimer**: This plugin scrapes data from competitive programming websites. Use at your own risk. +> **Disclaimer**: cp.nvim webs crapes data from competitive programming platforms - use at your own risk. https://github.com/user-attachments/assets/cb142535-fba0-4280-8f11-66ad1ca50ca9 @@ -24,30 +24,31 @@ https://github.com/user-attachments/assets/cb142535-fba0-4280-8f11-66ad1ca50ca9 ## Quick Start -Set up a Codeforces problem with contest ID 1848: -``` -:CP codeforces 1848 A -``` - -Navigate between problems: -``` -:CP next -:CP prev -``` - -Run tests: -``` -:CP run -``` - -## Workflow - cp.nvim follows a simple principle: **solve locally, submit remotely**. +### Basic Usage + 1. **Find a problem** on the judge website 2. **Set up locally** with `:CP ` + + ``` + :CP codeforces 1848 A + ``` + 3. **Code and test** with instant feedback and rich diffs -4. **Submit** on the original website + + ``` + :CP run + ``` + +4. **Navigate between problems** + + ``` + :CP next + :CP prev + ``` + +5. **Submit** on the original website ## Documentation