Problem
During manual execution of the validator, a NameError was discovered in src/docs_validator/rules/anchor_link.py:
message=f'Anchor "{link.anchor}" not found in file {target_file_path.relative_to(root_dir)}'
The variable target_file_path is undefined (it should be target_path). This bug was not caught by the existing test suite because the current integration test (test_anchor_file.py) only covers the positive scenario (when the anchor exists and no issues are generated).
Proposed Solution
Add integration/unit tests to tests/integration/test_anchor_file.py (or a dedicated test file) to cover the negative scenarios:
- Target file exists, but the specified anchor is missing.
- Target file does not exist (should be handled gracefully or delegated to
BrokenLinkValidator).
Problem
During manual execution of the validator, a
NameErrorwas discovered insrc/docs_validator/rules/anchor_link.py:The variable
target_file_pathis undefined (it should betarget_path). This bug was not caught by the existing test suite because the current integration test (test_anchor_file.py) only covers the positive scenario (when the anchor exists and no issues are generated).Proposed Solution
Add integration/unit tests to
tests/integration/test_anchor_file.py(or a dedicated test file) to cover the negative scenarios:BrokenLinkValidator).