-
Notifications
You must be signed in to change notification settings - Fork 7
chore: add CI pipeline, linting, and quality infrastructure #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba8f26f
639684d
01556b4
cc6d5a2
15ed4d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "pip" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
|
|
||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6 | ||
| - run: uv python install 3.12 | ||
| - run: uv sync --extra dev | ||
| - run: uv run ruff check src/ tests/ | ||
| - run: uv run ruff format --check src/ tests/ | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| needs: lint | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff # v6 | ||
| - run: uv python install 3.12 | ||
| - run: uv sync --extra dev | ||
| - run: uv run pytest -v --cov=src --cov-report=term-missing --cov-fail-under=60 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,13 @@ venv/ | |
| .coverage | ||
| htmlcov/ | ||
|
|
||
| # Linting | ||
| .ruff_cache/ | ||
|
|
||
| # Environment | ||
| .env | ||
| .envrc | ||
|
|
||
| # IDEs | ||
| .idea/ | ||
| .vscode/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.8.6 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] | ||
| - id: ruff-format | ||
|
|
||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.21.2 | ||
| hooks: | ||
| - id: gitleaks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Security Policy | ||
|
|
||
| ## Reporting a Vulnerability | ||
|
|
||
| If you find a potential security vulnerability in this project, please report it responsibly. | ||
|
|
||
| ### Use the GitHub Security Tab | ||
|
|
||
| This repository is set up to allow vulnerability reports through GitHub's Security Advisories feature. To report a vulnerability: | ||
|
|
||
| 1. Navigate to the repository's main page. | ||
| 2. Select the [**Security**](https://github.com/redhat-community-ai-tools/code-to-docs/security) tab. | ||
| 3. Select **Advisories** from the left-hand sidebar. | ||
| 4. Click on **Report a vulnerability**. | ||
| 5. Fill in the required details and submit the report. | ||
|
|
||
| Following this process will create a private advisory for our maintainers to review. | ||
|
|
||
| ### Do Not Open Public Pull Requests, Issues, or Discussions | ||
|
|
||
| Please **do not** discuss the issue, create PRs, or start discussions about the vulnerability. This ensures the vulnerability is not widely exploited before a fix is provided. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| [project] | ||
| name = "code-to-docs" | ||
| version = "0.0.0" | ||
| description = "GitHub Action that generates documentation suggestions from code changes using LLMs" | ||
| requires-python = ">=3.12" | ||
| license = {text = "MIT"} | ||
| dependencies = [ | ||
| "openai", | ||
| "mcp", | ||
| "mcp-atlassian", | ||
| "markdown", | ||
| "docutils", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest>=8.0", | ||
| "pytest-cov>=4.0", | ||
| "ruff>=0.4", | ||
| "pre-commit>=4.0", | ||
| ] | ||
|
|
||
| [tool.pytest.ini_options] | ||
| testpaths = ["tests"] | ||
| pythonpath = ["src"] | ||
|
|
||
| [tool.ruff] | ||
| target-version = "py312" | ||
| line-length = 100 | ||
| src = ["src", "tests"] | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["E", "F", "I", "UP", "B"] | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "tests/**" = ["E501", "E402"] | ||
| # E501 suppressed for src: 52 existing violations in prompt strings; ruff format still enforces line length for code | ||
| "src/**" = ["E501", "E402"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] pattern-inconsistency The per-file-ignores suppress E501 and E402 for both src/** and tests/**. Suppressing E501 for production code effectively nullifies the line-length = 100 setting for ruff check (ruff format still enforces it). This is overly broad for production code. |
||
|
|
||
| [tool.coverage.run] | ||
| source = ["src"] | ||
|
|
||
| [tool.coverage.report] | ||
| fail_under = 60 | ||
| show_missing = true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[medium] Dependency pinning — supply-chain risk
Production dependencies (openai, mcp, mcp-atlassian, markdown, docutils) are declared without any version constraints. This could introduce breaking changes or supply-chain risk.
Suggested fix: Add lower-bound version pins for production dependencies (e.g., openai>=1.0). For stronger reproducibility, generate and commit a lockfile.