REQ-DDB-GUARD-023: Git diff parsing¶
What it requires
- Hunk headers parsed to 0-indexed line sets; pure deletions excluded; git add supported
- tier
- PASS
- declared
- implemented
- priority
- P1
How it is met
Implemented by
get_branch_diff_rangeclew/guard/git.py:186get_changed_filesclew/guard/git.py:117get_changed_lines_for_fileclew/guard/git.py:226get_diffclew/guard/git.py:100get_file_at_revisionclew/guard/git.py:215get_merge_baseclew/guard/git.py:170get_staged_diffclew/guard/git.py:88parse_changed_linesclew/guard/git.py:133run_gitclew/guard/git.py:60
Tests (79)
Linked directly
33 tests: 33 passed
33 passed
| test | result | linked by | implementers exercised | calls away |
|---|---|---|---|---|
test_precommit_with_impact | passed | measured | 5 of 9 | — |
test_the_pre_commit_hook_runs_the_coverage_gate | passed | measured | 5 of 9 | — |
test_a_symlinked_impact_directory_is_refused | passed | measured | 2 of 9: get_file_at_revision, run_git | — |
test_default_subcommand_with_files | passed | measured | 2 of 9: get_file_at_revision, run_git | — |
test_impact_no_files_returns_0 | passed | measured | 2 of 9: get_changed_files, run_git | — |
test_precommit_mode_flags_a_stale_rust_function | passed | measured | 2 of 9: get_file_at_revision, run_git | — |
test_combines_diff_and_parse | passed | measured | 4 of 9: get_changed_lines_for_file, get_staged_diff, parse_changed_lines, run_git | 1 |
test_branch_diff_range_builds_range_string | passed | measured | 3 of 9: get_branch_diff_range, get_merge_base, run_git | 1 |
test_branch_diff_range_returns_none_on_failure | passed | measured | 3 of 9: get_branch_diff_range, get_merge_base, run_git | 1 |
test_branch_diff_range_returns_none_on_main | passed | measured | 3 of 9: get_branch_diff_range, get_merge_base, run_git | 1 |
test_changed_lines_is_empty_when_diff_unavailable | passed | measured | 3 of 9: get_changed_lines_for_file, get_staged_diff, run_git | 1 |
test_the_gate_git_path_cannot_run_the_trees_commands | passed | measured | 3 of 9: get_file_at_revision, get_staged_diff, run_git | 1 |
test_calls_git_diff_cached | passed | measured | 2 of 9: get_staged_diff, run_git | 1 |
test_calls_git_diff_with_range | passed | measured | 2 of 9: get_diff, run_git | 1 |
test_returns_commit_hash | passed | measured | 2 of 9: get_merge_base, run_git | 1 |
test_returns_none_on_failure | passed | measured | 2 of 9: get_merge_base, run_git | 1 |
test_diff_range_that_looks_like_an_option_is_refused | passed | measured | 1 of 9: get_diff | 1 |
test_empty_diff | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_modification_in_middle | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_multi_line_addition | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_multiple_hunks | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_pure_deletion | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_real_world_diff | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_run_git_returns_none_on_called_process_error | passed | measured | 1 of 9: run_git | 1 |
test_run_git_returns_none_on_timeout | passed | measured | 1 of 9: run_git | 1 |
test_run_git_returns_none_when_git_missing | passed | measured | 1 of 9: run_git | 1 |
test_single_line_addition | passed | measured | 1 of 9: parse_changed_lines | 1 |
test_unknown_extension_skipped | passed | measured | 3 of 9: get_staged_diff, parse_changed_lines, run_git | 2 |
test_git_add_uses_double_dash | passed | measured | 1 of 9: run_git | 2 |
test_a_range_with_no_files_reads_the_files_the_range_changed | passed | measured | 5 of 9 | 3 |
test_full_pipeline | passed | measured | 3 of 9: get_staged_diff, parse_changed_lines, run_git | 3 |
test_finds_changed_function | passed | measured | 3 of 9: get_staged_diff, parse_changed_lines, run_git | 4 |
test_no_change_no_result | passed | measured | 2 of 9: get_staged_diff, run_git | 4 |
Reached through calls
46 tests: 46 passed
46 passed
| test | result | linked by | implementers exercised | calls away |
|---|---|---|---|---|
test_a_broken_toolchain_file_is_reported_not_fatal | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_all_checks_run | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_binary_named_as_source_is_skipped | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_clew_specific_ignores_apply_to_the_gate | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_decorative_triggers_presence_violation | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_docstring_satisfies_req_tag | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_docstring_tags_satisfy_presence | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_documented_file_no_violations | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_excluded_file | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_excluded_path_is_absent_and_gate_skips_it | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_fixture_violations | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_fully_documented_python | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_inner_doc_satisfies_the_file_block_without_at_file | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_javascript_extensions | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_missing_file_block_suggests_inner_doc | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_nested_lookalike_path_agrees | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_no_false_positives | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_no_false_positives_with_attributes | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_only_definitions_checked | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_opt_in | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_presence_message_c_style_for_c_file | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_presence_message_includes_return_for_non_void | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_presence_message_omits_return_for_void | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_presence_message_python_style | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_require_return_bites_only_on_valued_annotations | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_return_is_not_required_for_rust | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_return_requirement_can_be_turned_back_on | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_rust_is_opt_in | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_toolchain_ignore_paths_skip_validation | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_tsx_file_uses_typescript_config | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_validate_file_python | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_violations | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_without_toolchain_files_everything_is_checked | passed | inferred | 2 of 9: get_file_at_revision, run_git | 2 |
test_a_submodule_in_the_range_is_an_unmapped_file_never_opened | passed | inferred | 4 of 9: get_diff, get_staged_diff, parse_changed_lines, run_git | 3 |
test_a_cpp_member_declaration_is_checked_too | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_a_dead_req_on_a_documented_declaration_is_refused | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_a_declaration_does_not_need_its_own_req | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_a_documented_declaration_needs_its_version | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_an_undocumented_declaration_is_not_a_finding | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_class_level_block_does_not_leak_to_first_method | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_excludes_are_globs_and_a_regex_says_so | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_first_method_after_class_docstring_still_found | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_first_method_directly_after_class_line | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_later_method_still_found | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_nested_class_first_method | passed | inferred | 2 of 9: get_file_at_revision, run_git | 3 |
test_covering_tests_are_read_from_the_test_tree | passed | inferred | 1 of 9: run_git | 3 |