Link does not exist when it points to a section
Linter complains that the file does not exist when it does:
'/docs/coding/all.coding_style.how_to_guide.md#logging' does not exist [fix_md_links]
The problem might be that the link contains a reference to a particular section within the file (#logging) and this is not covered by the Linter action checking links (amp_fix_md_links.py).
We should update the Linter action so that in such cases it ignores the reference to the section while checking that the file exists. Or even more thoroughly, we can check that (1) the file (without the reference to the section) exists, (2) if there is a reference to the section, Linter also checks if the file contains this section and issues a complaint if it doesn't.
Here are the necessary links:
- https://github.com/causify-ai/helpers/blob/master/docs/coding/all.developing_linter.how_to_guide.md
- https://github.com/causify-ai/helpers/blob/master/docs/coding/all.amp_fix_md_links.explanation.md
- https://github.com/causify-ai/helpers/blob/master/linters/amp_fix_md_links.py
- https://github.com/causify-ai/helpers/blob/master/linters/test/test_amp_fix_md_links.py
We want to fix the bug and add unit tests.
@sonniki
I implemented both of the suggestions you mentioned. I first checked if the file existed by removing the text after the #. Next, if the file does exist, I checked whether the section is present. If the section is missing, a warning will be raised. If this approach is okay, I will go ahead and implement unit tests.
I implemented both of the suggestions you mentioned. I first checked if the file existed by removing the text after the
#. Next, if the file does exist, I checked whether the section is present. If the section is missing, a warning will be raised. If this approach is okay, I will go ahead and implement unit tests.
This sounds good. Feel free to file a PR when ready.
Done