Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[searchfox_api] Handle elements without line number id #4798

Closed
wants to merge 2 commits into from

Conversation

benjaminmah
Copy link
Contributor

@benjaminmah benjaminmah commented Feb 7, 2025

Resolves #4796.

We were encountering this error when running code_review_tool_evaluator, and it was due to elements that didn't have an ID, for example: <span class="syn_comment"># Can't use argparse default or this choice will be always present</span> which was from recursively getting the descendants.

I've added a conditional to only get the descendants for elements with the attribute data-nesting-sym if it contains an id starting with line-.

@benjaminmah benjaminmah changed the title [searchfox_api] Skip syn_comment spans in get_line_number() [searchfox_api] Handle elements without line number id Feb 12, 2025
@benjaminmah benjaminmah requested a review from marco-c February 14, 2025 16:55
Comment on lines +32 to +33
for e in all_descendants
if "id" in e.attrib and e.attrib["id"].startswith("line-")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not consider cases where the last element is a code block, not a code line. We may need to consider such cases.

@suhaibmujahid
Copy link
Member

Closing in favour of #4844

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[searchfox_api] TypeError: 'NoneType' object is not subscriptable
2 participants