File Changes¶
- class git_bot_feedback.FileFilter¶
A structure to encapsulate file path filtering behavior.
- extensions¶
The set of valid file extensions.
- ignored¶
The set of explicitly ignored paths/patterns.
- is_file_ignored(file_name: str | Path) bool¶
–
Check if a given file is ignored.
- is_file_in_list(file_name: str | Path, ignored: bool) bool¶
–
Check if a given file is in the
ignoredornot_ignoredlist.
- is_file_not_ignored(file_name: str | Path) bool¶
–
Check if a given file is not ignored.
- is_qualified(file_path: str | Path) bool¶
–
Check if a given file is qualified.
- not_ignored¶
The set of explicitly not ignored paths/patterns.
- parse_submodules()¶
Parse submodules from a .gitmodules file.
- walk_dir(root_path: str | Path) set[str]¶
–
Walk a given directory recursively and return a set of discovered source files.
- class git_bot_feedback.DiffHunkHeader¶
A struct to represent the header information of a diff hunk.
- new_lines¶
The total number of lines in the new hunk.
- new_start¶
The starting line number of the new hunk.
- old_lines¶
The total number of lines in the old hunk.
- old_start¶
The starting line number of the old hunk.
- class git_bot_feedback.FileDiffLines¶
A structure to represent a file’s changes per line numbers.
- added_lines¶
The list of line numbers whose lines have additions.
- added_ranges¶
The range of line numbers whose lines were added.
This takes the form of a list of tuples of
(inclusive_start, exclusive_end)to represent ranges.
- diff_hunks¶
The range of line numbers that span the diff hunks.
This takes the form of a list of tuples of
(inclusive_start, exclusive_end)to represent ranges.
- static from_info(added_lines: list[int], diff_hunks: list[tuple[int, int]]) FileDiffLines¶
–
Create a new file diff lines instance from given
added_linesanddiff_hunks.This constructor is preferred because the
added_rangesis automatically calculated from theadded_lines.
- is_hunk_in_diff(hunk: DiffHunkHeader) tuple[int, int] | None¶
–
Check if the given hunk header describes a hunk contained in the
diff_hunks.
- is_line_in_diff(line: int) bool¶
–
Check if the given line number is contained in the
diff_hunks.
- class git_bot_feedback.LinesChangedOnly¶
An enum to help determine what constitutes a changed file based on the diff contents.
- class git_bot_feedback.LinesChangedOnly.On¶
Only the lines in the diff that have additions.
- class git_bot_feedback.LinesChangedOnly.Off¶
All lines in the file, regardless of the diff contents.
- class git_bot_feedback.LinesChangedOnly.Diff¶
All lines in the diff, including context lines.
- git_bot_feedback.parse_diff(diff: str, file_filter: FileFilter, lines_changed_only: LinesChangedOnly | None = None) dict[str, FileDiffLines]¶
–
A function to parse a diff string.
Returns a mapping of file paths to their corresponding
FileDiffLines.