Skip to content

[Gitter] Enrichment Index Error #1027

Open
@k----n

Description

@k----n

Here is the error:

2022-01-30 04:53:17,513 - grimoire_elk.elk - ERROR - Error enriching raw from gitter (https://gitter.im/scala/scala): list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/elk.py", line 562, in enrich_backend
    enrich_count = enrich_items(ocean_backend, enrich_backend)
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/elk.py", line 350, in enrich_items
    total = enrich_backend.enrich_items(ocean_backend)
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/enriched/enrich.py", line 393, in enrich_items
    rich_item = self.get_rich_item(item)
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/enriched/enrich.py", line 98, in decorator
    eitem = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/enriched/gitter.py", line 121, in get_rich_item
    eitem.update(self.get_rich_links(item['data']))
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/enriched/gitter.py", line 143, in get_rich_links
    self.extract_issues(item['issues'], item['html'])
  File "/usr/local/lib/python3.7/dist-packages/grimoire_elk/enriched/gitter.py", line 163, in extract_issues
    if links_found[i].split('/')[-2] == 'issues':
IndexError: list index out of range

I'm not sure if it is the [i] or [-2], but a more detailed raised error would help.

I think the IndexError should probably be handled here too somehow:

def extract_issues(self, issue_pr, html_text):
"""Enrich issues or PRs mentioned in the message"""
links_found = self.HTML_LINK_REGEX.findall(html_text)
for i, entity in enumerate(issue_pr):
if 'repo' in entity.keys() and links_found:
if links_found[i].split('/')[-2] == 'issues':
entity['is_issue'] = entity['repo'] + ' #' + entity['number']
elif links_found[i].split('/')[-2] == 'pull':
entity['is_pull'] = entity['repo'] + ' #' + entity['number']
else:
continue
entity['url'] = links_found[i]


If there is an index error, does that mean the gitter message is not enriched and added to the index?
Will it be attempted to be enriched again and added to the index?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions