-
Notifications
You must be signed in to change notification settings - Fork 0
06 Entwicklung und CI
make install-devInstalliert pytest und ruff zusaetzlich zu den Runtime-Dependencies.
make test # Standard
make test-v # Verbose mit Testnamen
make test-cov # Mit Coverage-Report (erfordert pytest-cov)Coverage nachinstallieren falls noetig:
poetry add --group dev pytest-covDas Projekt nutzt Ruff als Linter und Formatter. Ruff ersetzt flake8, isort und black in einem einzigen Tool.
make lint # Pruefen
make lint-fix # Automatisch beheben
make format # Code formatieren
make format-check # Pruefen ohne AenderungKonfiguration in pyproject.toml:
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "I", "N", "UP", "B", "SIM"]Die aktivierten Regelgruppen:
| Kuerzel | Prueft |
|---|---|
| E | PEP 8 Style |
| F | Pyflakes (unbenutzte Imports, Variablen) |
| I | Import-Sortierung |
| N | Naming Conventions |
| UP | pyupgrade (veraltete Syntax) |
| B | Bugbear (haeufige Fehlerquellen) |
| SIM | Vereinfachbare Konstrukte |
make ciFuehrt lint, format-check und test hintereinander aus. Gleicher Ablauf wie in der CI-Pipeline.
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --with dev
- name: Run CI pipeline
run: make cipipeline {
agent any
stages {
stage('Setup') {
steps {
sh 'pip install poetry'
sh 'poetry install --with dev'
}
}
stage('Lint') {
steps {
sh 'make lint'
sh 'make format-check'
}
}
stage('Test') {
steps {
sh 'make test'
}
}
}
}# .github/workflows/publish.yml
name: Publish to PyPI
on:
push:
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
run: pip install poetry
- name: Build and publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
poetry install
make ci
poetry build
poetry publishMit diesem Workflow genuegt ein git push origin v0.2.0 um automatisch auf PyPI zu publizieren, sofern alle Tests bestehen.
Das Projekt nutzt Conventional Commits. Der Git-Hook unter .githooks/commit-msg validiert jede Message automatisch.
Erlaubte Typen: feat, fix, docs, style, refactor, test, chore, perf
Erlaubte Scopes: checker, sanitizer, metrics, cli, io, models
Beispiele:
feat(checker): add rule for max line length
feat(metrics): add Flesch-DE readability score
fix(sanitizer): preserve tabs in code blocks
docs: update wiki with readability analysis
chore: bump ftfy to 6.2
test(metrics): add edge cases for syllable counting
Breaking Changes:
feat(cli)!: replace ms-lint with ms-validate
BREAKING CHANGE: ms-lint has been removed. Use ms-validate instead.
Zurueck: Publishing | Weiter: FAQ