mirror of
https://github.com/cyclotruc/gitingest.git
synced 2026-04-28 09:29:30 +00:00
chore: switch to ruff + pydoclint, deprecate .gitingest, and perform a repo-wide quality sweep (#329)
Some checks failed
CI / test (macos-latest, 3.10) (push) Has been cancelled
CI / test (macos-latest, 3.11) (push) Has been cancelled
CI / test (macos-latest, 3.12) (push) Has been cancelled
CI / test (macos-latest, 3.13) (push) Has been cancelled
CI / test (macos-latest, 3.8) (push) Has been cancelled
CI / test (macos-latest, 3.9) (push) Has been cancelled
CI / test (ubuntu-latest, 3.10) (push) Has been cancelled
CI / test (ubuntu-latest, 3.11) (push) Has been cancelled
CI / test (ubuntu-latest, 3.12) (push) Has been cancelled
CI / test (ubuntu-latest, 3.13) (push) Has been cancelled
CI / test (ubuntu-latest, 3.8) (push) Has been cancelled
CI / test (ubuntu-latest, 3.9) (push) Has been cancelled
CI / test (windows-latest, 3.10) (push) Has been cancelled
CI / test (windows-latest, 3.11) (push) Has been cancelled
CI / test (windows-latest, 3.12) (push) Has been cancelled
CI / test (windows-latest, 3.13) (push) Has been cancelled
CI / test (windows-latest, 3.8) (push) Has been cancelled
CI / test (windows-latest, 3.9) (push) Has been cancelled
OSSF Scorecard / Scorecard analysis (push) Has been cancelled
Some checks failed
CI / test (macos-latest, 3.10) (push) Has been cancelled
CI / test (macos-latest, 3.11) (push) Has been cancelled
CI / test (macos-latest, 3.12) (push) Has been cancelled
CI / test (macos-latest, 3.13) (push) Has been cancelled
CI / test (macos-latest, 3.8) (push) Has been cancelled
CI / test (macos-latest, 3.9) (push) Has been cancelled
CI / test (ubuntu-latest, 3.10) (push) Has been cancelled
CI / test (ubuntu-latest, 3.11) (push) Has been cancelled
CI / test (ubuntu-latest, 3.12) (push) Has been cancelled
CI / test (ubuntu-latest, 3.13) (push) Has been cancelled
CI / test (ubuntu-latest, 3.8) (push) Has been cancelled
CI / test (ubuntu-latest, 3.9) (push) Has been cancelled
CI / test (windows-latest, 3.10) (push) Has been cancelled
CI / test (windows-latest, 3.11) (push) Has been cancelled
CI / test (windows-latest, 3.12) (push) Has been cancelled
CI / test (windows-latest, 3.13) (push) Has been cancelled
CI / test (windows-latest, 3.8) (push) Has been cancelled
CI / test (windows-latest, 3.9) (push) Has been cancelled
OSSF Scorecard / Scorecard analysis (push) Has been cancelled
* **Pre-commit**: replace `black` & `darglint` with `ruff-check` / `ruff-format`; add `pydoclint` for docstring quality * **Deps**: drop `tomli`; tighten `typing_extensions`; add `eval-type-backport`; remove `black`, `djlint`, `pylint` from `requirements-dev` * **Ignore files**: deprecate TOML-based `.gitingest`; introduce `.gitingestignore` (git-wildmatch, parsed via `_parse_ignore_file`) * **Config**: new unified `[tool.ruff]` (lint + format + isort); delete `[tool.black]`, keep minimal `[tool.isort]` for now * **Refactor/style**: adopt `from __future__ import annotations`, kw-only args, richer types; reorder params & `__all__`; move type-only imports under `if TYPE_CHECKING`; extract `_CLIArgs` `TypedDict`, migrate form data to `pydantic.QueryForm`; deduplicate `cli.main` / `_async_main`; use `pathlib`, avoid file-IO in async; replace magic numbers with constants; delete `is_text_file` (logic now lives in `FileSystemNode.content`) * **Bug fix**: remove silent error in `notebook_utils._process_cell` * **Docs**: refresh README badges * **Tests**: update fixtures & assertions **BREAKING**: new `.gitingestignore` file replaces (now-deprecated) `.gitingest`. No functional API or CLI changes.
This commit is contained in:
parent
b39ef5416c
commit
2f447ae632
54 changed files with 1767 additions and 1518 deletions
|
|
@ -1,22 +1,21 @@
|
|||
"""
|
||||
Tests for the gitignore functionality in Gitingest.
|
||||
"""
|
||||
"""Tests for the gitignore functionality in Gitingest."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from gitingest.entrypoint import ingest_async
|
||||
from gitingest.utils.ignore_patterns import load_gitignore_patterns
|
||||
from gitingest.utils.ignore_patterns import load_ignore_patterns
|
||||
|
||||
|
||||
@pytest.fixture(name="repo_path")
|
||||
def repo_fixture(tmp_path: Path) -> Path:
|
||||
"""
|
||||
Create a temporary repository structure with:
|
||||
- A .gitignore that excludes 'exclude.txt'
|
||||
- 'include.txt' (should be processed)
|
||||
- 'exclude.txt' (should be skipped when gitignore rules are respected)
|
||||
"""Create a temporary repository structure.
|
||||
|
||||
The repository structure includes:
|
||||
- A ``.gitignore`` that excludes ``exclude.txt``
|
||||
- ``include.txt`` (should be processed)
|
||||
- ``exclude.txt`` (should be skipped when gitignore rules are respected)
|
||||
"""
|
||||
# Create a .gitignore file that excludes 'exclude.txt'
|
||||
gitignore_file = tmp_path / ".gitignore"
|
||||
|
|
@ -33,15 +32,13 @@ def repo_fixture(tmp_path: Path) -> Path:
|
|||
return tmp_path
|
||||
|
||||
|
||||
def test_load_gitignore_patterns(tmp_path: Path):
|
||||
"""
|
||||
Test that load_gitignore_patterns() correctly loads patterns from a .gitignore file.
|
||||
"""
|
||||
def test_load_gitignore_patterns(tmp_path: Path) -> None:
|
||||
"""Test that ``load_ignore_patterns()`` correctly loads patterns from a ``.gitignore`` file."""
|
||||
gitignore = tmp_path / ".gitignore"
|
||||
# Write some sample patterns with a comment line included
|
||||
gitignore.write_text("exclude.txt\n*.log\n# a comment\n")
|
||||
|
||||
patterns = load_gitignore_patterns(tmp_path)
|
||||
patterns = load_ignore_patterns(tmp_path, filename=".gitignore")
|
||||
|
||||
# Check that the expected patterns are loaded
|
||||
assert "exclude.txt" in patterns
|
||||
|
|
@ -52,11 +49,10 @@ def test_load_gitignore_patterns(tmp_path: Path):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ingest_with_gitignore(repo_path: Path):
|
||||
"""
|
||||
Integration test for ingest_async() respecting .gitignore rules.
|
||||
async def test_ingest_with_gitignore(repo_path: Path) -> None:
|
||||
"""Integration test for ``ingest_async()`` respecting ``.gitignore`` rules.
|
||||
|
||||
When ``include_gitignored`` is ``False`` (default), the content of 'exclude.txt' should be omitted.
|
||||
When ``include_gitignored`` is ``False`` (default), the content of ``exclude.txt`` should be omitted.
|
||||
When ``include_gitignored`` is ``True``, both files should be present.
|
||||
"""
|
||||
# Run ingestion with the gitignore functionality enabled.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue