chore: apply ruff formatting and fix whitespace issues

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 09:12:11 +00:00
parent 43bc58770d
commit b03ebab747
96 changed files with 991 additions and 993 deletions
+1 -2
View File
@@ -10,10 +10,9 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "npm"
directory: "/frontend/static"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
@@ -177,8 +177,8 @@ Example:
```markdown
### OPENAI_API_KEY
**Type:** String
**Required:** Yes
**Type:** String
**Required:** Yes
**Default:** None
Your OpenAI API key for metadata extraction.
@@ -22,13 +22,13 @@ These instructions apply to all files in the `frontend/` directory (templates, C
{% block content %}
<div class="container mx-auto px-4 py-8">
<h1 class="text-2xl font-bold mb-4">{{ page_title }}</h1>
{% if error_message %}
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
{{ error_message }}
</div>
{% endif %}
<form method="post" enctype="multipart/form-data">
<!-- Form content -->
</form>
@@ -72,9 +72,9 @@ These instructions apply to all files in the `frontend/` directory (templates, C
<label class="block text-gray-700 text-sm font-bold mb-2" for="file">
Document File
</label>
<input
type="file"
id="file"
<input
type="file"
id="file"
name="file"
class="w-full px-3 py-2 border rounded"
required
@@ -39,15 +39,15 @@ def process_document(
) -> DocumentMetadata:
"""
Process a document and extract metadata.
Args:
file_path: Path to the document file
user_id: ID of the user uploading the document
metadata: Optional additional metadata
Returns:
DocumentMetadata object with extracted information
Raises:
FileNotFoundError: If file doesn't exist
ProcessingError: If processing fails
@@ -150,7 +150,7 @@ from pydantic_settings import BaseSettings
class Settings(BaseSettings):
openai_api_key: str
max_file_size: int = 10485760 # 10MB default
class Config:
env_file = ".env"
```
+11 -11
View File
@@ -68,9 +68,9 @@ def db_session():
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
yield session
session.close()
Base.metadata.drop_all(engine)
@@ -99,7 +99,7 @@ def test_upload_document():
"/api/documents/upload",
files={"file": ("test.pdf", f, "application/pdf")}
)
assert response.status_code == 201
assert "id" in response.json()
```
@@ -131,12 +131,12 @@ def test_openai_metadata_extraction(mocker):
"amount": 100.00,
"date": "2024-01-01"
}
mocker.patch(
"app.utils.openai_client.extract_metadata",
return_value=mock_response
)
result = extract_document_metadata("test.pdf")
assert result["document_type"] == "invoice"
@@ -144,12 +144,12 @@ def test_openai_metadata_extraction(mocker):
def test_azure_ocr_processing(mocker):
"""Test OCR with mocked Azure service."""
mock_text = "Sample extracted text"
mocker.patch(
"app.utils.azure_client.extract_text",
return_value=mock_text
)
result = perform_ocr("test.pdf")
assert result == mock_text
```
@@ -160,7 +160,7 @@ def test_azure_ocr_processing(mocker):
def test_create_document(db_session):
"""Test document creation in database."""
from app.models import Document
doc = Document(
filename="test.pdf",
user_id=1,
@@ -168,7 +168,7 @@ def test_create_document(db_session):
)
db_session.add(doc)
db_session.commit()
assert doc.id is not None
assert doc.filename == "test.pdf"
```
@@ -189,10 +189,10 @@ def test_document_validation():
"filename": "", # Empty filename
"size": -1 # Invalid size
}
# Act
result = validate_document(invalid_document)
# Assert
assert result.is_valid is False
assert "filename" in result.errors
+8 -8
View File
@@ -17,30 +17,30 @@ jobs:
name: Semantic Release
runs-on: ubuntu-latest
if: github.repository == 'christianlouis/DocuElevate'
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install python-semantic-release
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Run Semantic Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -48,7 +48,7 @@ jobs:
semantic-release version --print
semantic-release version
semantic-release publish
- name: Update build metadata files if changed
run: |
for f in VERSION BUILD_DATE GIT_SHA RUNTIME_INFO; do
@@ -60,7 +60,7 @@ jobs:
git commit -m "chore(release): update build metadata files [skip ci]"
git push
fi
- name: Trigger Docker Build on Tag
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v7
@@ -70,4 +70,4 @@ jobs:
const ref = context.ref;
const tag = ref.replace('refs/tags/', '');
console.log(`New tag created: ${tag}`);
console.log('Docker build will be triggered automatically by the docker-build workflow');
console.log('Docker build will be triggered automatically by the docker-build workflow');