Skip to content

Commit 24e54f1

Browse files
fix sort import and fix line length
1 parent adc9718 commit 24e54f1

10 files changed

Lines changed: 28 additions & 9 deletions

File tree

src/ai_reviewer/git/github.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import fnmatch
22
import json
33
from pathlib import Path
4-
from github import Github, Auth
4+
5+
from github import Auth, Github
56
from github.PullRequest import PullRequest
6-
from ..models import ReviewResult, InlineComment, Severity
7+
8+
from ..models import InlineComment, ReviewResult, Severity
79

810

911
SEVERITY_EMOJI = {

src/ai_reviewer/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import asyncio
22
import sys
3+
34
from .config import Config
4-
from .providers import get_provider
55
from .git.github import GitHubClient
6+
from .providers import get_provider
67

78

89
async def run() -> None:
910
config = Config()
1011

1112
print(f"[ai-reviewer] Provider: {config.provider} | Model: {config.resolved_model}")
12-
print(f"[ai-reviewer] Review level: {config.review_level} | Security only: {config.security_only}")
13+
print(
14+
f"[ai-reviewer] Review level: {config.review_level} | Security only: {config.security_only}"
15+
)
1316

1417
# 1. Fetch diff from GitHub
1518
gh = GitHubClient(

src/ai_reviewer/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from enum import StrEnum
2+
23
from pydantic import BaseModel, Field
34

45

src/ai_reviewer/providers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from ..config import Provider
2-
from .base import LLMProvider
32
from .anthropic import AnthropicProvider
4-
from .openai import OpenAIProvider
3+
from .base import LLMProvider
54
from .gemini import GeminiProvider
5+
from .openai import OpenAIProvider
66

77

88
def get_provider(provider: Provider, api_key: str, model: str) -> LLMProvider:

src/ai_reviewer/providers/anthropic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
2+
23
import anthropic
4+
35
from ..models import ReviewResult
46
from .base import LLMProvider
57
from .prompts import SYSTEM_PROMPT, build_user_prompt

src/ai_reviewer/providers/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from abc import ABC, abstractmethod
2+
23
from ..models import ReviewResult
34

45

src/ai_reviewer/providers/gemini.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
2+
23
import google.generativeai as genai
4+
35
from ..models import ReviewResult
46
from .base import LLMProvider
57
from .prompts import SYSTEM_PROMPT, build_user_prompt

src/ai_reviewer/providers/openai.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
2+
23
from openai import AsyncOpenAI
4+
35
from ..models import ReviewResult
46
from .base import LLMProvider
57
from .prompts import SYSTEM_PROMPT, build_user_prompt

src/ai_reviewer/providers/prompts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
SYSTEM_PROMPT = """You are an expert code reviewer. Your job is to review a pull request diff and provide:
1+
SYSTEM_PROMPT = """\
2+
You are an expert code reviewer. Your job is to review a pull request diff and provide:
23
1. Inline comments on specific lines that have issues
34
2. An overall summary of the PR
45
@@ -43,7 +44,10 @@ def build_user_prompt(diff: str, review_level: str, security_only: bool) -> str:
4344
depth = {
4445
"quick": "Do a quick pass — flag only errors and security issues.",
4546
"standard": "Do a thorough review covering bugs, security, and important style issues.",
46-
"thorough": "Do an exhaustive review of every aspect: correctness, security, performance, style, and maintainability.",
47+
"thorough": (
48+
"Do an exhaustive review of every aspect: correctness, security, performance,"
49+
" style, and maintainability."
50+
),
4751
}[review_level]
4852

4953
return f"""{depth} {focus}

tests/test_providers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import json
2-
import pytest
32
from unittest.mock import AsyncMock, MagicMock, patch
3+
4+
import pytest
5+
46
from ai_reviewer.models import ReviewResult, Severity
57
from ai_reviewer.providers.anthropic import AnthropicProvider
68
from ai_reviewer.providers.openai import OpenAIProvider

0 commit comments

Comments
 (0)