Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8e7140e
feat: add API middleware for authentication and rate limiting - PR-6 …
d-ulker Sep 10, 2025
d6e125f
feat: add API middleware for CORS, security, rate limiting - PR-6
d-ulker Sep 10, 2025
e6b6c3d
feat: add API health checks and monitoring - PR-7
d-ulker Sep 10, 2025
ca8589b
feat: add emotion analysis endpoint - PR-8
d-ulker Sep 10, 2025
fa2988c
feat: add text summarization endpoint - PR-9
d-ulker Sep 10, 2025
e221b0b
feat: add audio transcription endpoint - PR-10
d-ulker Sep 10, 2025
afa17b0
feat: add complete analysis endpoint - PR-11
d-ulker Sep 10, 2025
8e09170
feat: add API documentation and examples - PR-12
d-ulker Sep 10, 2025
a121e87
feat: add comprehensive unit tests - PR-13
d-ulker Sep 10, 2025
69963c3
feat: add comprehensive integration tests - PR-14
d-ulker Sep 10, 2025
94a1331
fix: escape backslashes in pylint regex pattern
d-ulker Sep 10, 2025
4935eb6
feat: add comprehensive code quality tools and configuration - PR-15
d-ulker Sep 10, 2025
28f7e1a
fix: Update directory paths to match reorganized structure
d-ulker Sep 14, 2025
9218e85
cleanup: Remove Python cache files from PR #163 branch
d-ulker Sep 14, 2025
340126f
fix(security): prevent information exposure through exception
d-ulker Sep 14, 2025
15cccaa
fix(merge): resolve cache file conflicts and complete merge with main
d-ulker Sep 14, 2025
4677ea3
fix(security): prevent stack trace exposure in API endpoints
d-ulker Sep 14, 2025
bd0eb20
feat: add comprehensive code quality tools and configuration
deepsource-autofix[bot] Sep 14, 2025
f5e129f
fix(quality): address DeepSource critical and major issues
d-ulker Sep 14, 2025
f00e62c
fix: Quote Python version numbers in GitHub Actions workflow
d-ulker Sep 14, 2025
783d8f7
fix: Replace base64 audio data with placeholder to prevent secret sca…
d-ulker Sep 14, 2025
5e802e3
fix: Replace hardcoded secrets with non-triggering placeholders
d-ulker Sep 14, 2025
aa9494a
fix: Address critical import and code review issues
d-ulker Sep 14, 2025
aee6f1d
fix: Replace password example to prevent DeepSource secrets false pos…
d-ulker Sep 14, 2025
f6107e9
fix: Address critical CodeRabbit review comments
d-ulker Sep 14, 2025
4bdc72c
fix: Additional CodeRabbit review fixes
d-ulker Sep 14, 2025
672e8a1
fix: Address CRITICAL DeepSource issues
d-ulker Sep 14, 2025
c870108
fix: critical code quality issues
cursoragent Sep 15, 2025
1ee3fe6
feat: add comprehensive code quality tools and configuration
deepsource-autofix[bot] Sep 15, 2025
999642b
fix: Resolve remaining DeepSource code quality issues
d-ulker Sep 15, 2025
049180d
fix: Address critical code review issues and integrate actual ML models
d-ulker Sep 15, 2025
1c4727d
feat: add comprehensive code quality tools and configuration
deepsource-autofix[bot] Sep 19, 2025
ec1dfb1
Fix code quality issues: debug messages, safe extraction, GitHub Acti…
d-ulker Sep 19, 2025
de69344
Merge branch 'feat/dl-add-code-quality-fixes' of github.com:uelkerd/S…
d-ulker Sep 19, 2025
000e917
Fix comprehensive code quality issues: singletons, validation, securi…
d-ulker Sep 19, 2025
7e5115c
Fix comprehensive code quality issues: executable permissions, error …
d-ulker Sep 19, 2025
8082106
fix: Add strict audio format validation to prevent path traversal att…
d-ulker Sep 19, 2025
7d2dad3
chore: Remove temporary security test script
d-ulker Sep 19, 2025
da00f31
fix: Address additional security vulnerabilities
d-ulker Sep 19, 2025
f03df67
fix: Comprehensive security fixes for PR #163
d-ulker Sep 19, 2025
6eb0835
fix: Additional security fixes for Sourcery AI bot concerns
d-ulker Sep 19, 2025
99e3e57
fix: Suppress Sourcery AI security warnings with nosec comments
d-ulker Sep 19, 2025
07239a0
fix: Add explicit permissions to GitHub Actions workflow
d-ulker Sep 19, 2025
6b5b45f
fix: Address Gemini code-assist bot concerns
d-ulker Sep 19, 2025
214fcf4
fix: Final security and testing fixes
d-ulker Sep 19, 2025
a759223
fix: Performance and error handling improvements
d-ulker Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Code Quality

permissions:
contents: read

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
quality:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
# pinned to v4.1.7 - https://github.com/actions/checkout/releases/tag/v4.1.7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@39c02d0a5e7e3e4c6c3c0e5f5a30cb850a3c2a6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
# pinned to v5.1.1 - https://github.com/actions/setup-python/releases/tag/v5.1.1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Run Black
run: black --check src/ tests/

- name: Run isort
run: isort --check-only src/ tests/

- name: Run Flake8
run: flake8 src/ tests/

- name: Run Pylint
run: pylint src/ tests/

- name: Run MyPy
run: mypy src/

- name: Run Bandit
run: bandit -r src/ -f json -o bandit-report.json

- name: Run Safety
run: safety check --json --output safety-report.json

- name: Run Tests
run: pytest tests/ --cov=src --cov-report=xml --cov-report=html

- name: Upload coverage to Codecov
uses: codecov/codecov-action@e28ff129e5465c916cd5fe5c1fb97ffaae5dc969
if: matrix.python-version == '3.11'
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
Comment thread
coderabbitai[bot] marked this conversation as resolved.
# pinned to v4.5.0 - https://github.com/codecov/codecov-action/releases/tag/v4.5.0
Comment thread Fixed
210 changes: 22 additions & 188 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,218 +1,52 @@
# Comprehensive Code Quality Prevention System for SAMO-DL
# This configuration prevents ALL recurring DeepSource issues from ever happening again
#
# TODO: Re-enable all disabled hooks once configuration issues are resolved
# Issue: https://github.com/uelkerd/SAMO--DL/issues/106
#
# Disabled hooks and their status:
# ✅ Bandit: RE-ENABLED - Split into targeted hooks: changed files + tests (B101 skipped)
# ✅ Safety: RE-ENABLED - Local hook with safety package, runs on push, scans all deps
# ✅ Docformatter: RE-ENABLED - Local hook with docformatter package for reliability
# ✅ Flynt: RE-ENABLED - Fully configured with always_run and pass_filenames for consistency
# - Local hooks: Configuration format issues (exclude field format) - FIXED: Updated to single-line format
#
# IMPROVEMENTS IMPLEMENTED:
# ✅ Global exclude pattern implemented - all hooks now inherit from top-level exclude
# ✅ Individual exclude patterns removed from active hooks (black, isort, ruff, mypy)
# ✅ Bandit split into targeted hooks: changed files (all rules) + tests (B101 skipped)
# ✅ Safety implemented as local hook with safety package, optimized for push-only execution
# ✅ Docformatter implemented as local hook with docformatter package for reliability
# ✅ Flynt configuration made consistent with Bandit (always_run, pass_filenames)
# ✅ Global exclude pattern enhanced to cover ALL test artifacts and build directories
# ✅ Configuration is now much more maintainable and follows best practices
# ✅ All code review comments addressed and resolved
#
# Next steps:
# 1. Test Safety hook with local implementation
# 2. Test Docformatter hook with system language configuration
# 3. Test and re-enable local hooks
# 4. Update this TODO section as hooks are re-enabled
#
# Global exclude pattern - applies to all hooks unless overridden
# Uses anchored regex with extended mode for readability and accuracy
# Comprehensive coverage: git, venvs, caches, builds, artifacts, docs, samples, test artifacts
exclude: |
(?x)^(
\.git|
\.venv|
\.env|
__pycache__|
\.pytest_cache|
\.mypy_cache|
\.ruff_cache|
build|
dist|
\.eggs|
\.tox|
\.coverage|
htmlcov|
\.cache|
\.logs|
results|
samples|
notebooks|
website|
docs/diagrams|
\.DS_Store|
artifacts|
\.benchmarks|
\.kilocode|
\.vscode|
deprecated|
test_reports|
test_report\.txt|
\.pytest_cache|
\.mypy_cache|
\.ruff_cache|
\.coverage|
coverage\.xml|
\.coveragerc|
\.gitignore-pages|
\.nojekyll|
\.deepsource\.toml|
\.pre-commit-exclude-patterns\.yaml|
trivy-results-.*\.json|
vulnerabilities-.*\.json
)$

repos:
# Basic pre-commit hooks (run first)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: debug-statements
- id: name-tests-test
- id: requirements-txt-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: check-ast
- id: check-docstring-first

# Python formatting and linting (in order)
- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.8.0
hooks:
- id: black
language_version: python3
args: [--line-length=88, --target-version=py38]
types: [python]

# Import sorting and organization
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black, --line-length=88, --py=38]
types: [python]
args: ["--profile", "black"]

# Python linting with Ruff (super fast)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types: [python]
- id: flake8
args: ["--max-line-length=88", "--extend-ignore=E203,W503"]

- repo: https://github.com/pycqa/pylint
rev: v3.2.6
hooks:
- id: pylint
args: [--rcfile=.pylintrc]

# Type checking with MyPy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.11.2
hooks:
- id: mypy
args: [--ignore-missing-imports, --python-version=3.8]
types: [python]
additional_dependencies: [types-requests, types-PyYAML]

# Security scanning with Bandit (optimized for performance)
# Split into targeted hooks: changed files (all rules) + tests (B101 skipped)
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.9
hooks:
- id: bandit
name: bandit (changed files)
# Scan only changed Python files, enforce all rules
types: [python]
exclude: '^(tests/|.*_test\.py$)'

- id: bandit
name: bandit (tests, B101 skipped)
# Scan test files with B101 (assert_used) disabled
args: [-s, B101]
types: [python]
files: '^(tests/|.*_test\.py$)'
args: [-r, src/, -f, json, -o, bandit-report.json]

# Security vulnerability scanning with Safety (local hook)
# Local hook with safety package for reliability and control
# Runs on push to avoid blocking commits, scans all dependency files
- repo: local
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.3.3
hooks:
- id: safety-scan
name: Safety (dependency vulnerability scan)
entry: safety
language: python
additional_dependencies: [safety==3.6.0]
args: [scan, --full-report, --target, .]
pass_filenames: false
stages: [push]
# Optional: Add policy file for custom rules
# args: [scan, --full-report, --policy-file, .safety-policy.yml]
# env:
# - SAFETY_API_KEY # if using the commercial DB

# Documentation formatting with Docformatter (local hook)
# Local hook with docformatter package to avoid external repository compatibility issues
- repo: local
hooks:
- id: docformatter
name: Docformatter (docstring formatting)
entry: docformatter
language: python
additional_dependencies: [docformatter==1.7.3]
args: [--in-place, --wrap-summaries=88, --wrap-descriptions=88]
types: [python]

# String formatting with flynt
# Configuration consistent with Bandit hooks for maintainability
- repo: https://github.com/ikamensh/flynt
rev: "0.78"
hooks:
- id: flynt
args: [--line-length=88, .]
types: [python]
pass_filenames: false
always_run: true

# Custom SAMO-DL code quality enforcer
# TODO: Re-enable once configuration issues are resolved
# Issue: https://github.com/uelkerd/SAMO--DL/issues/106
# - repo: local
# hooks:
# - id: samo-code-quality-enforcer
# name: SAMO-DL Code Quality Enforcer
# entry: python scripts/maintenance/code_quality_enforcer.py
# language: python
# types: [python]
# pass_filenames: false
# always_run: true

# Auto-fix common code quality issues
# TODO: Re-enable once configuration issues are resolved
# Issue: https://github.com/uelkerd/SAMO--DL/issues/106
# - repo: local
# hooks:
# - id: samo-auto-fix-code-quality
# name: SAMO-DL Auto-Fix Code Quality
# entry: python scripts/maintenance/auto_fix_code_quality.py
# language: python
# types: [python]
# pass_filenames: false
# always_run: true

# Global configuration
default_language_version:
python: python3.8
- id: python-safety-dependencies-check
Loading
Loading