mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
+ Vulture + pre-commit hooks setup
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: ruff-format
|
||||||
|
name: ruff-format
|
||||||
|
entry: uv run ruff format
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [ python ]
|
||||||
|
- id: ruff
|
||||||
|
name: ruff
|
||||||
|
entry: uv run ruff check --force-exclude
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
- id: mypy
|
||||||
|
name: mypy
|
||||||
|
entry: uv run mypy roboco
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
- id: vulture
|
||||||
|
name: vulture
|
||||||
|
entry: uv run vulture vulture_whitelist.py
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
- id: bandit
|
||||||
|
name: bandit
|
||||||
|
entry: uv run bandit -r roboco -ll
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
- id: safety
|
||||||
|
name: safety
|
||||||
|
entry: uv run safety check
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
- id: radon-cc
|
||||||
|
name: radon-cyclomatic-complexity
|
||||||
|
entry: uv run radon cc roboco -nc
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
- id: xenon
|
||||||
|
name: xenon
|
||||||
|
entry: uv run xenon roboco --max-absolute B --max-modules A --max-average A
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
|
- id: deptry
|
||||||
|
name: deptry
|
||||||
|
entry: uv run deptry .
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
- id: semgrep
|
||||||
|
name: semgrep
|
||||||
|
entry: uv run semgrep --config=auto --error roboco
|
||||||
|
require_serial: true
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
pass_filenames: false
|
||||||
@@ -41,9 +41,10 @@ restart: stop start-example
|
|||||||
# Lint code
|
# Lint code
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
@COMPOSE_BAKE=true docker compose run --rm --no-deps roboco sh -c "echo 'Formatting w/ Ruff...' ; echo '' ; ruff format . ; echo '' ; echo '' ; echo 'Linting w/ Ruff...' ; echo '' ; ruff check . ; echo '' ; echo '' ; echo 'Type checking w/ Mypy...' ; echo '' ; mypy . ; echo '' ; echo '' ; echo 'Finding dead code w/ Vulture...' ; echo '' ; vulture"
|
@echo 'Formatting w/ Ruff...' ; echo '' ; uv run ruff format .
|
||||||
@docker compose down --rmi all --remove-orphans -v
|
@echo '' ; echo '' ; echo 'Linting w/ Ruff...' ; echo '' ; uv run ruff check .
|
||||||
@docker system prune -f
|
@echo '' ; echo '' ; echo 'Type checking w/ Mypy...' ; echo '' ; uv run mypy .
|
||||||
|
@echo '' ; echo '' ; echo 'Finding dead code w/ Vulture...' ; echo '' ; uv run vulture vulture_whitelist.py
|
||||||
|
|
||||||
# Fix code
|
# Fix code
|
||||||
.PHONY: fix
|
.PHONY: fix
|
||||||
@@ -68,7 +69,7 @@ vulture:
|
|||||||
bandit:
|
bandit:
|
||||||
@echo "Running Bandit security scan..."
|
@echo "Running Bandit security scan..."
|
||||||
@echo ''
|
@echo ''
|
||||||
@uv run bandit -r guard -ll
|
@uv run bandit -r roboco -ll
|
||||||
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Check dependencies with Safety
|
# Check dependencies with Safety
|
||||||
@@ -93,13 +94,13 @@ radon:
|
|||||||
@echo "Analyzing code complexity with Radon..."
|
@echo "Analyzing code complexity with Radon..."
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo "Cyclomatic Complexity:"
|
@echo "Cyclomatic Complexity:"
|
||||||
@uv run radon cc guard -nc
|
@uv run radon cc roboco -nc
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo "Maintainability Index:"
|
@echo "Maintainability Index:"
|
||||||
@uv run radon mi guard -nc
|
@uv run radon mi roboco -nc
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo "Raw Metrics:"
|
@echo "Raw Metrics:"
|
||||||
@uv run radon raw guard
|
@uv run radon raw roboco
|
||||||
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Check complexity thresholds with Xenon
|
# Check complexity thresholds with Xenon
|
||||||
@@ -107,7 +108,7 @@ radon:
|
|||||||
xenon:
|
xenon:
|
||||||
@echo "Checking complexity thresholds with Xenon..."
|
@echo "Checking complexity thresholds with Xenon..."
|
||||||
@echo ''
|
@echo ''
|
||||||
@uv run xenon guard --max-absolute B --max-modules A --max-average A
|
@uv run xenon roboco --max-absolute B --max-modules A --max-average A
|
||||||
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Analyze dependencies with Deptry
|
# Analyze dependencies with Deptry
|
||||||
@@ -123,7 +124,7 @@ deptry:
|
|||||||
semgrep:
|
semgrep:
|
||||||
@echo "Running Semgrep static analysis..."
|
@echo "Running Semgrep static analysis..."
|
||||||
@echo ''
|
@echo ''
|
||||||
@uv run semgrep --config=auto guard
|
@uv run semgrep --config=auto roboco
|
||||||
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Run all security checks
|
# Run all security checks
|
||||||
@@ -231,13 +232,13 @@ serve-docs:
|
|||||||
# Lint documentation
|
# Lint documentation
|
||||||
.PHONY: lint-docs
|
.PHONY: lint-docs
|
||||||
lint-docs:
|
lint-docs:
|
||||||
@uv run pymarkdownlnt scan -r -e ./.venv -e ./.git -e ./.github -e ./data -e ./guard -e ./tests -e ./.claude -e ./CLAUDE.md -e ./.cursor -e ./.kiro -e ./ZZZ .
|
@uv run pymarkdownlnt scan -r -e ./.venv -e ./.git -e ./.github -e ./roboco -e ./tests -e ./.claude -e ./CLAUDE.md -e ./ZZZ .
|
||||||
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Fix documentation
|
# Fix documentation
|
||||||
.PHONY: fix-docs
|
.PHONY: fix-docs
|
||||||
fix-docs:
|
fix-docs:
|
||||||
@uv run pymarkdownlnt fix -r -e ./.venv -e ./.git -e ./.github -e ./data -e ./guard -e ./tests -e ./.claude -e ./CLAUDE.md -e ./.cursor -e ./.kiro -e ./ZZZ .
|
@uv run pymarkdownlnt fix -r -e ./.venv -e ./.git -e ./.github -e ./roboco -e ./tests -e ./.claude -e ./CLAUDE.md -e ./ZZZ .
|
||||||
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
||||||
|
|
||||||
# Prune
|
# Prune
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ async def create_session(
|
|||||||
)
|
)
|
||||||
async def close_session(
|
async def close_session(
|
||||||
db: DbSession,
|
db: DbSession,
|
||||||
__agent_id: CurrentAgentId,
|
_agent_id: CurrentAgentId,
|
||||||
session_id: UUID,
|
session_id: UUID,
|
||||||
) -> SessionResponse:
|
) -> SessionResponse:
|
||||||
"""Close a session."""
|
"""Close a session."""
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Vulture whitelist - empty because min_confidence=100 in pyproject.toml
|
||||||
|
# filters out false positives. Add entries here only if vulture reports
|
||||||
|
# 100% confidence unused code that is actually used dynamically.
|
||||||
Reference in New Issue
Block a user