github-code-review 3.3.2__tar.gz → 3.3.4__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.
Files changed (40) hide show
  1. {github_code_review-3.3.2 → github_code_review-3.3.4}/PKG-INFO +1 -1
  2. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/core.py +22 -7
  3. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/report_struct.py +1 -1
  4. {github_code_review-3.3.2 → github_code_review-3.3.4}/pyproject.toml +1 -1
  5. {github_code_review-3.3.2 → github_code_review-3.3.4}/LICENSE +0 -0
  6. {github_code_review-3.3.2 → github_code_review-3.3.4}/README.md +0 -0
  7. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/__init__.py +0 -0
  8. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/__main__.py +0 -0
  9. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/bootstrap.py +0 -0
  10. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/cli.py +0 -0
  11. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/cli_base.py +0 -0
  12. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/__init__.py +0 -0
  13. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/deploy.py +0 -0
  14. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/fix.py +0 -0
  15. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/gh_post_review_comment.py +0 -0
  16. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/gh_react_to_comment.py +0 -0
  17. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/linear_comment.py +0 -0
  18. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/repl.py +0 -0
  19. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/commands/version.py +0 -0
  20. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/config.toml +0 -0
  21. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/constants.py +0 -0
  22. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/context.py +0 -0
  23. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/env.py +0 -0
  24. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/gh_api.py +0 -0
  25. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/issue_trackers.py +0 -0
  26. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/pipeline.py +0 -0
  27. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/pipeline_steps/__init__.py +0 -0
  28. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/pipeline_steps/jira.py +0 -0
  29. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/pipeline_steps/linear.py +0 -0
  30. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/project_config.py +0 -0
  31. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/answer.j2 +0 -0
  32. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/github_workflows/components/env-vars.j2 +0 -0
  33. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/github_workflows/components/installs.j2 +0 -0
  34. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/github_workflows/gito-code-review.yml.j2 +0 -0
  35. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/github_workflows/gito-react-to-comments.yml.j2 +0 -0
  36. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/partial/aux_files.j2 +0 -0
  37. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/questions/changes_summary.j2 +0 -0
  38. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/questions/release_notes.j2 +0 -0
  39. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/tpl/questions/test_cases.j2 +0 -0
  40. {github_code_review-3.3.2 → github_code_review-3.3.4}/gito/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: github-code-review
3
- Version: 3.3.2
3
+ Version: 3.3.4
4
4
  Summary: AI code review tool that works with any language model provider. It detects issues in GitHub pull requests or local changes—instantly, reliably, and without vendor lock-in.
5
5
  License: MIT
6
6
  Keywords: static code analysis,code review,code quality,ai,coding,assistant,llm,github,automation,devops,developer tools,github actions,workflows,git
@@ -97,7 +97,7 @@ def get_base_branch(repo: Repo, pr: int | str = None):
97
97
  except AttributeError:
98
98
  try:
99
99
  logging.info(
100
- "Checking if repo has 'main' or 'master' branchs to use as --against branch..."
100
+ "Checking if repo has 'main' or 'master' branches to use as --against branch..."
101
101
  )
102
102
  remote_refs = repo.remotes.origin.refs
103
103
  for branch_name in ['main', 'master']:
@@ -341,9 +341,7 @@ def _prepare(
341
341
  - mc.tokenizing.num_tokens_from_string(str(file_diff)),
342
342
  use_local_files=review_subject_is_index(what) or what == REFS_VALUE_ALL
343
343
  )
344
- if (
345
- file_diff.target_file != DEV_NULL and not file_diff.is_added_file
346
- ) or what == REFS_VALUE_ALL
344
+ if file_diff.target_file != DEV_NULL or what == REFS_VALUE_ALL
347
345
  else ""
348
346
  )
349
347
  for file_diff in diff
@@ -408,6 +406,10 @@ async def review(
408
406
  out_folder: str | os.PathLike | None = None,
409
407
  pr: str | int = None
410
408
  ):
409
+ """
410
+ Conducts a code review.
411
+ Prints the review report to the console and saves it to a file.
412
+ """
411
413
  reviewing_all = what == REFS_VALUE_ALL
412
414
  try:
413
415
  repo, cfg, diff, lines = _prepare(
@@ -421,15 +423,24 @@ async def review(
421
423
  except NoChangesInContextError:
422
424
  logging.error("No changes to review")
423
425
  return
426
+
427
+ def input_is_diff(file_diff: PatchedFile) -> bool:
428
+ """
429
+ In case of reviewing all changes, or added files,
430
+ we provide full file content as input.
431
+ Otherwise, we provide the diff and additional file lines separately.
432
+ """
433
+ return not reviewing_all and not file_diff.is_added_file
434
+
424
435
  responses = await mc.llm_parallel(
425
436
  [
426
437
  mc.prompt(
427
438
  cfg.prompt,
428
439
  input=(
429
- file_diff if not reviewing_all
440
+ file_diff if input_is_diff(file_diff)
430
441
  else str(file_diff.path) + ":\n" + lines[file_diff.path]
431
442
  ),
432
- file_lines=lines[file_diff.path] if not reviewing_all else None,
443
+ file_lines=lines[file_diff.path] if input_is_diff(file_diff) else None,
433
444
  **cfg.prompt_vars,
434
445
  )
435
446
  for file_diff in diff
@@ -479,6 +490,10 @@ def answer(
479
490
  pr: str | int = None,
480
491
  aux_files: list[str] = None,
481
492
  ) -> str | None:
493
+ """
494
+ Answers a question about the code changes.
495
+ Returns the LLM response as a string.
496
+ """
482
497
  try:
483
498
  repo, config, diff, lines = _prepare(
484
499
  repo=repo,
@@ -508,7 +523,7 @@ def answer(
508
523
  if aux_files or config.aux_files:
509
524
  aux_files_dict = read_files(
510
525
  repo,
511
- (aux_files or list()) + config.aux_files,
526
+ (aux_files or []) + config.aux_files,
512
527
  config.max_code_tokens // 2
513
528
  )
514
529
  else:
@@ -52,7 +52,7 @@ class Issue(RawIssue):
52
52
  if is_dataclass(raw_issue):
53
53
  raw_issue = asdict(raw_issue)
54
54
  params = filter_kwargs(Issue, raw_issue | {"file": file, "id": issue_id})
55
- for i, obj in enumerate(params["affected_lines"]):
55
+ for i, obj in enumerate(params.get("affected_lines") or []):
56
56
  d = obj if isinstance(obj, dict) else asdict(obj)
57
57
  params["affected_lines"][i] = Issue.AffectedCode(
58
58
  **filter_kwargs(Issue.AffectedCode, {"file": file} | d)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "github-code-review"
3
- version = "3.3.2"
3
+ version = "3.3.4"
4
4
  description = "AI code review tool that works with any language model provider. It detects issues in GitHub pull requests or local changes—instantly, reliably, and without vendor lock-in."
5
5
  authors = ["Nayjest <mail@vitaliy.in>"]
6
6
  readme = "README.md"