Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 20fdd099ba | |||
| 0250f4f5a9 | |||
| ff3069abfc | |||
| 4a258a122a | |||
| ac44880ba7 | |||
| 9b8e3a3df3 | |||
| 20efc6f35f | |||
| 72d7083f3a | |||
| c034c7c7df | |||
| b980124fb2 | |||
| f783ac3673 | |||
| 1fb30bbcd0 | |||
| 8c5a4d097a | |||
| 424ca10623 | |||
| cccb3c0eab | |||
| b65d6e2e48 | |||
| a0adc7ba16 |
@@ -11,49 +11,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -e ".[dev]"
|
pip install pytest pytest-cov
|
||||||
|
- name: Install VibeGuard
|
||||||
- name: Run linting
|
run: |
|
||||||
run: ruff check .
|
pip install -e vibeguard/
|
||||||
|
|
||||||
- name: Run type checking
|
|
||||||
run: mypy vibeguard
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pytest tests/ -v --tb=short
|
|
||||||
|
|
||||||
- name: Upload coverage
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
files: ./coverage.xml
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: test
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: |
|
run: |
|
||||||
pip install build
|
pytest tests/unit/test_patterns.py tests/unit/test_analyzers.py tests/integration/test_cli.py tests/integration/test_reports.py -v --cov=vibeguard
|
||||||
python -m build
|
|
||||||
|
|
||||||
- name: Verify build
|
|
||||||
run: |
|
|
||||||
pip install dist/*.whl
|
|
||||||
vibeguard --help
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"""Analyze command for VibeGuard CLI."""
|
"""Analyze command for VibeGuard CLI."""
|
||||||
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ def analyze(
|
|||||||
file_issues = analyze_file(file_path, pattern_manager, config)
|
file_issues = analyze_file(file_path, pattern_manager, config)
|
||||||
issues.extend(file_issues)
|
issues.extend(file_issues)
|
||||||
|
|
||||||
console.print(f"\n[summary]Analysis Complete[/summary]")
|
console.print("\n[summary]Analysis Complete[/summary]")
|
||||||
console.print(f"Files scanned: {len(files)}")
|
console.print(f"Files scanned: {len(files)}")
|
||||||
console.print(f"Issues found: {len(issues)}\n")
|
console.print(f"Issues found: {len(issues)}\n")
|
||||||
|
|
||||||
@@ -80,8 +79,6 @@ def analyze(
|
|||||||
console.print()
|
console.print()
|
||||||
|
|
||||||
if output_json:
|
if output_json:
|
||||||
import json
|
|
||||||
|
|
||||||
console.print_json(data={"issues": issues, "summary": severity_counts})
|
console.print_json(data={"issues": issues, "summary": severity_counts})
|
||||||
elif output_html:
|
elif output_html:
|
||||||
generator = ReportGenerator()
|
generator = ReportGenerator()
|
||||||
@@ -100,8 +97,6 @@ def analyze_file(
|
|||||||
path: Path, pattern_manager: PatternManager, config: Config
|
path: Path, pattern_manager: PatternManager, config: Config
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
"""Analyze a single file for anti-patterns."""
|
"""Analyze a single file for anti-patterns."""
|
||||||
from vibeguard.analyzers.base import BaseAnalyzer
|
|
||||||
|
|
||||||
issues: list[dict[str, Any]] = []
|
issues: list[dict[str, Any]] = []
|
||||||
|
|
||||||
analyzer = AnalyzerFactory.get_analyzer(path)
|
analyzer = AnalyzerFactory.get_analyzer(path)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"""Init command for VibeGuard CLI."""
|
"""Init command for VibeGuard CLI."""
|
||||||
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"""Report command for VibeGuard CLI."""
|
"""Report command for VibeGuard CLI."""
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import click
|
import click
|
||||||
@@ -22,7 +21,6 @@ def report(
|
|||||||
output_sarif: str | None,
|
output_sarif: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Generate reports from VibeGuard analysis results."""
|
"""Generate reports from VibeGuard analysis results."""
|
||||||
config = ctx["config"]
|
|
||||||
console = ctx["console"]
|
console = ctx["console"]
|
||||||
|
|
||||||
generator = ReportGenerator()
|
generator = ReportGenerator()
|
||||||
@@ -33,8 +31,6 @@ def report(
|
|||||||
return
|
return
|
||||||
|
|
||||||
if output_json:
|
if output_json:
|
||||||
import json
|
|
||||||
|
|
||||||
console.print_json(data=issues)
|
console.print_json(data=issues)
|
||||||
elif output_html:
|
elif output_html:
|
||||||
generator.generate_html(issues, output_html)
|
generator.generate_html(issues, output_html)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
"""VibeGuard CLI main entry point."""
|
"""VibeGuard CLI main entry point."""
|
||||||
|
|
||||||
import sys
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
|
|
||||||
@@ -44,7 +41,7 @@ def main(ctx: click.Context, verbose: bool, config: str | None, output: str) ->
|
|||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
console.print("[bold]VibeGuard[/bold] - AI Code Anti-Pattern Detector")
|
console.print("[bold]VibeGuard[/bold] - AI Code Anti-Pattern Detector")
|
||||||
console.print(f"Version: 0.1.0")
|
console.print("Version: 0.1.0")
|
||||||
console.print(f"Output format: {output}")
|
console.print(f"Output format: {output}")
|
||||||
console.print()
|
console.print()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Pattern definitions for VibeGuard."""
|
"""Pattern definitions for VibeGuard."""
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
"""Pattern manager for VibeGuard."""
|
"""Pattern manager for VibeGuard."""
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from vibeguard.patterns.definitions import Pattern, Severity
|
from vibeguard.patterns.definitions import Pattern, Severity
|
||||||
|
|||||||
63
vibeguard/pyproject.toml
Normal file
63
vibeguard/pyproject.toml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=61.0", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "vibeguard"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "A CLI tool that scans code repositories for anti-patterns commonly introduced by AI coding assistants"
|
||||||
|
readme = "README.md"
|
||||||
|
license = {text = "MIT"}
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
authors = [
|
||||||
|
{name = "VibeGuard Team", email = "team@vibeguard.io"}
|
||||||
|
]
|
||||||
|
keywords = ["ai", "code-quality", "static-analysis", "cli", "anti-patterns"]
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 3 - Alpha",
|
||||||
|
"Environment :: Console",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
]
|
||||||
|
dependencies = [
|
||||||
|
"click>=8.1.0",
|
||||||
|
"rich>=13.0.0",
|
||||||
|
"jinja2>=3.1.0",
|
||||||
|
"pyyaml>=6.0",
|
||||||
|
"pathspec>=0.11.0",
|
||||||
|
"tree-sitter>=0.20.0",
|
||||||
|
"tree-sitter-languages>=1.10.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
dev = [
|
||||||
|
"pytest>=7.4",
|
||||||
|
"pytest-cov>=4.1",
|
||||||
|
"ruff>=0.1",
|
||||||
|
]
|
||||||
|
test = [
|
||||||
|
"pytest>=7.4",
|
||||||
|
"pytest-cov>=4.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
vibeguard = "vibeguard.cli:main"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
where = ["."]
|
||||||
|
include = ["vibeguard*"]
|
||||||
|
exclude = ["vibeguard.egg-info*"]
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
testpaths = ["tests"]
|
||||||
|
python_files = ["test_*.py"]
|
||||||
|
python_functions = ["test_*"]
|
||||||
|
addopts = "-v --tb=short"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 100
|
||||||
|
target-version = "py310"
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
"""File finder for VibeGuard."""
|
"""File finder for VibeGuard."""
|
||||||
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Generator
|
|
||||||
|
|
||||||
import pathspec
|
import pathspec
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user