patchwise 0.9.2__tar.gz → 0.9.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {patchwise-0.9.2 → patchwise-0.9.3}/PKG-INFO +1 -1
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/default_config.yaml +2 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/main.py +1 -1
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/ai_code_review.py +79 -1
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/patch_review.py +3 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/utils/config.py +8 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/PKG-INFO +1 -1
- {patchwise-0.9.2 → patchwise-0.9.3}/pyproject.toml +1 -1
- {patchwise-0.9.2 → patchwise-0.9.3}/LICENSE.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/README.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/docker.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/AiCodeReview.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/Checkpatch.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/Coccicheck.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/CrashdumpAgent.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/DtCheck.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/DtbsCheck.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/LLMCommitAudit.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/Sparse.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/dockerfiles/base.Dockerfile +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/logger_setup.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/ai_models.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/cli.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/config.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/handler.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/mail_client.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/mail_handler/utils.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_agent/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_agent/agent.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_agent/crashdump_agent.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_agent/tool_definitions.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/ai_fix.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/ai_patch_fix.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/checkpatch_fixer.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/kernel_docs_rag.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_fix/sparse_fixer.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/ai_review.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/fetch_reviewer_comment.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/llm_commit_audit.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/root_cause_analysis.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/ts_cache.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/ts_indexer.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/decorators.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/kernel_tree.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/checkpatch.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/coccicheck.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/dt_check.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/dtbs_check.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/sparse.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/static_analysis.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/stats/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/stats/dashboard.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/ui/__init__.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/ui/dashboard.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/ui/events.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/ui/screen.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/utils/decorators.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/utils/lru_cache.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/utils/repo_workspace.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise/utils/tui.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/SOURCES.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/dependency_links.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/entry_points.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/requires.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/patchwise.egg-info/top_level.txt +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/setup.cfg +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/tests/test_mail_handler_series_refs.py +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/false-positive-guide.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/alignment.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/arm64.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/ata.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/block.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/bluetooth.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/boot-params.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/bpf.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/btf.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/btrfs.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/build.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/cleanup.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/cxl.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/dax.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/drm.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/dt-bindings.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/fscrypt.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/gic-v3.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/gic-v5.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/hid.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/hyp-arm64.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/i2c.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/input.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/io-accessors.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/io_uring.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/kconfig.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/kho.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/kvm-arm64.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/kvm.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/libbpf.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/locking.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mips.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-alloc.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-folio.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-largepage.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-pagetable.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-reclaim.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-vma.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/netlink.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/networking-core.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/networking-drivers.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/nfsd.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/objtool.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/of.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/pci.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/perf.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/pm.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/pmdomain.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/rcu.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/rust.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/scheduler.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/selftests.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/smb-ksmbd.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/subjective-review.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/subsystem-template.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/subsystem.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/sunrpc.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/syscall.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/sysfs.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/timers.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/tracing.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/tty.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/usb-storage.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/vfs.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/wireless.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/workqueue.md +0 -0
- {patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/technical-patterns.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchwise
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: AI Code Review, Root Cause Analysis and Static Analysis for the Linux kernel
|
|
5
5
|
Author-email: "Qualcomm Technologies, Inc." <qc.opensource@qti.qualcomm.com>
|
|
6
6
|
Maintainer-email: Aditya Chillara <achillar@qti.qualcomm.com>
|
|
@@ -30,6 +30,8 @@ ai:
|
|
|
30
30
|
# models:
|
|
31
31
|
# openai/Pro: "GPT-5"
|
|
32
32
|
models: {}
|
|
33
|
+
# Accepts: "inline" or "gerrit".
|
|
34
|
+
output_format: "inline"
|
|
33
35
|
api_key_disclaimer:
|
|
34
36
|
message: "PatchWise uses LiteLLM to interact with your preferred model provider (default: OpenAI). LiteLLM will automatically retrieve the API key from your environment variables if it is set based on the API URL provided to LiteLLM (default: OpenAI). Please confirm that you acknowledge that your API key may be used, if set in your environment. Select 'Yes' to proceed, 'No' to abort, and 'Yes. Don't show again' to proceed and disable this prompt."
|
|
35
37
|
options: ["Yes", "No", "Yes. Don't show again"]
|
|
@@ -211,7 +211,7 @@ def run_local_mode(args: argparse.Namespace) -> None:
|
|
|
211
211
|
if not result_text:
|
|
212
212
|
continue
|
|
213
213
|
review_name = type(review).__name__
|
|
214
|
-
output_file = output_dir / f"{review_name.lower()}.
|
|
214
|
+
output_file = output_dir / f"{review_name.lower()}.{review.output_suffix}"
|
|
215
215
|
if not result_text.endswith("\n"):
|
|
216
216
|
result_text += "\n"
|
|
217
217
|
with open(output_file, "w", encoding="utf-8") as f:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
|
2
2
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
3
3
|
|
|
4
|
+
import ast
|
|
4
5
|
import datetime
|
|
5
6
|
import json
|
|
6
7
|
import os
|
|
@@ -23,6 +24,7 @@ from patchwise.patch_review.decorators import register_llm_review, register_long
|
|
|
23
24
|
|
|
24
25
|
from patchwise.patch_review.ai_review.ai_review import AiReview
|
|
25
26
|
from patchwise.ui import events
|
|
27
|
+
from patchwise.utils.config import ai_output_format
|
|
26
28
|
from patchwise.utils.repo_workspace import (
|
|
27
29
|
project_layout_note,
|
|
28
30
|
repo_project_note,
|
|
@@ -296,7 +298,6 @@ name the concern, do not write the analysis.
|
|
|
296
298
|
```
|
|
297
299
|
"""
|
|
298
300
|
|
|
299
|
-
|
|
300
301
|
# Phase 2 (EXECUTION) prompt
|
|
301
302
|
|
|
302
303
|
EXECUTION_INSTRUCTIONS = """
|
|
@@ -1567,12 +1568,89 @@ finding with record_verdict as you work through them.
|
|
|
1567
1568
|
),
|
|
1568
1569
|
)
|
|
1569
1570
|
|
|
1571
|
+
if ai_output_format() == "gerrit":
|
|
1572
|
+
if findings is None:
|
|
1573
|
+
self.logger.warning(
|
|
1574
|
+
"[cleanup] JSON parse failed; posting the review patchset-level."
|
|
1575
|
+
)
|
|
1576
|
+
findings = [{"finding": text, "end_line": 0}]
|
|
1577
|
+
return json.dumps(self._gerrit_comments(findings), indent=2)
|
|
1578
|
+
|
|
1570
1579
|
if findings is None:
|
|
1571
1580
|
self.logger.warning("[cleanup] JSON parse failed; falling back to raw text.")
|
|
1572
1581
|
return text.strip()
|
|
1573
1582
|
|
|
1574
1583
|
return super().format_chat_response(self._render_inline_review(findings).strip())
|
|
1575
1584
|
|
|
1585
|
+
@property
|
|
1586
|
+
def output_suffix(self) -> str:
|
|
1587
|
+
return "json" if ai_output_format() == "gerrit" else "txt"
|
|
1588
|
+
|
|
1589
|
+
@staticmethod
|
|
1590
|
+
def _diff_path(header: str) -> str:
|
|
1591
|
+
"""The new path from `diff --git a/<old> b/<new>`. Git C-quotes paths
|
|
1592
|
+
with unusual characters (`"b/\\303\\251.txt"`)."""
|
|
1593
|
+
if header.endswith('"'):
|
|
1594
|
+
quoted = header[header.rindex(' "b/') + 1 :]
|
|
1595
|
+
return ast.literal_eval("b" + quoted).decode()[2:]
|
|
1596
|
+
return header.rsplit(" b/", 1)[-1]
|
|
1597
|
+
|
|
1598
|
+
def _gerrit_anchors(self) -> list[tuple[str, dict]]:
|
|
1599
|
+
"""Map each numbered-source line (0-based) to a Gerrit (path,
|
|
1600
|
+
CommentInput) anchor, per the REST API's CommentInput entity.
|
|
1601
|
+
|
|
1602
|
+
Message lines go to the /COMMIT_MSG magic file, below the header Gerrit
|
|
1603
|
+
generates above the message (MagicFile.createCommitMessageHeader: one
|
|
1604
|
+
line per parent, Author, AuthorDate, Commit, CommitDate, blank). File
|
|
1605
|
+
and hunk headers get a file comment; anything else is patchset-level."""
|
|
1606
|
+
raw_lines = self._numbered_source.split("\n")
|
|
1607
|
+
anchors: list[tuple[str, dict]] = [("/PATCHSET_LEVEL", {})] * len(raw_lines)
|
|
1608
|
+
header = len(self.commit.parents) + 5
|
|
1609
|
+
diff_start = self._diff_start_line(self.commit_message) - 1
|
|
1610
|
+
for i in range(diff_start - 1):
|
|
1611
|
+
anchors[i] = ("/COMMIT_MSG", {"line": header + i + 1})
|
|
1612
|
+
path, in_hunk, old, new = None, False, 0, 0
|
|
1613
|
+
for i in range(diff_start, len(raw_lines)):
|
|
1614
|
+
line = raw_lines[i]
|
|
1615
|
+
hunk = re.match(r"@@ -(\d+)(?:,\d+)? \+(\d+)", line)
|
|
1616
|
+
if line.startswith("diff --git"):
|
|
1617
|
+
path, in_hunk = self._diff_path(line), False
|
|
1618
|
+
elif hunk:
|
|
1619
|
+
in_hunk, old, new = True, int(hunk.group(1)), int(hunk.group(2))
|
|
1620
|
+
if path is None:
|
|
1621
|
+
continue
|
|
1622
|
+
anchors[i] = (path, {})
|
|
1623
|
+
if not in_hunk or hunk:
|
|
1624
|
+
continue
|
|
1625
|
+
if line.startswith("+"):
|
|
1626
|
+
anchors[i] = (path, {"line": new})
|
|
1627
|
+
new += 1
|
|
1628
|
+
elif line.startswith("-"):
|
|
1629
|
+
anchors[i] = (path, {"line": old, "side": "PARENT"})
|
|
1630
|
+
old += 1
|
|
1631
|
+
elif line.startswith(" "):
|
|
1632
|
+
anchors[i] = (path, {"line": new})
|
|
1633
|
+
old, new = old + 1, new + 1
|
|
1634
|
+
return anchors
|
|
1635
|
+
|
|
1636
|
+
def _gerrit_comments(self, findings: list) -> dict[str, list[dict]]:
|
|
1637
|
+
"""Findings as a Gerrit ReviewInput `comments` map (path -> list of
|
|
1638
|
+
CommentInput), each anchored at its end line as the inline review
|
|
1639
|
+
places it. An out-of-range line becomes a patchset-level comment."""
|
|
1640
|
+
anchors = self._gerrit_anchors()
|
|
1641
|
+
comments: dict[str, list[dict]] = defaultdict(list)
|
|
1642
|
+
for e in findings:
|
|
1643
|
+
end = e["end_line"]
|
|
1644
|
+
path, anchor = (
|
|
1645
|
+
anchors[end - 1]
|
|
1646
|
+
if 1 <= end <= len(anchors)
|
|
1647
|
+
else ("/PATCHSET_LEVEL", {})
|
|
1648
|
+
)
|
|
1649
|
+
comments[path].append(
|
|
1650
|
+
dict(anchor, message=str(e["finding"]).strip(), unresolved=True)
|
|
1651
|
+
)
|
|
1652
|
+
return comments
|
|
1653
|
+
|
|
1576
1654
|
_SUBDIR = "ai_code_review"
|
|
1577
1655
|
|
|
1578
1656
|
def _dump(self, name: str, content: str) -> None:
|
|
@@ -85,6 +85,9 @@ class PatchReview(abc.ABC):
|
|
|
85
85
|
return specific_dockerfile
|
|
86
86
|
return DOCKERFILES_PATH / "base.Dockerfile"
|
|
87
87
|
|
|
88
|
+
# Extension of the file main.py saves this review's result to
|
|
89
|
+
output_suffix = "txt"
|
|
90
|
+
|
|
88
91
|
@abc.abstractmethod
|
|
89
92
|
def setup(self) -> None:
|
|
90
93
|
"""
|
|
@@ -61,6 +61,14 @@ def redis_address() -> Tuple[str, int]:
|
|
|
61
61
|
return cache["host"], int(cache["port"])
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
def ai_output_format() -> str:
|
|
65
|
+
"""Return `ai.output_format`: "inline" or "gerrit"."""
|
|
66
|
+
fmt = parse_config()["ai"].get("output_format", "inline")
|
|
67
|
+
if fmt not in ("inline", "gerrit"):
|
|
68
|
+
raise ValueError(f'ai.output_format must be "inline" or "gerrit", not {fmt!r}')
|
|
69
|
+
return fmt
|
|
70
|
+
|
|
71
|
+
|
|
64
72
|
def update_user_config(dict: Dict[str, Any]) -> None:
|
|
65
73
|
if not USER_CONFIG_PATH.exists():
|
|
66
74
|
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchwise
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3
|
|
4
4
|
Summary: AI Code Review, Root Cause Analysis and Static Analysis for the Linux kernel
|
|
5
5
|
Author-email: "Qualcomm Technologies, Inc." <qc.opensource@qti.qualcomm.com>
|
|
6
6
|
Maintainer-email: Aditya Chillara <achillar@qti.qualcomm.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "patchwise"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.3"
|
|
8
8
|
description = "AI Code Review, Root Cause Analysis and Static Analysis for the Linux kernel"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Qualcomm Technologies, Inc.", email = "qc.opensource@qti.qualcomm.com" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/ai_review/fetch_reviewer_comment.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/patchwise/patch_review/static_analysis/static_analysis.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/false-positive-guide.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/boot-params.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/dt-bindings.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/io-accessors.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-largepage.md
RENAMED
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-pagetable.md
RENAMED
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/mm-reclaim.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/networking-core.md
RENAMED
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/networking-drivers.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/subjective-review.md
RENAMED
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/subsystem-template.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{patchwise-0.9.2 → patchwise-0.9.3}/thirdparty/review-prompts/kernel/subsystem/usb-storage.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|