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

[Gitter] Enrichment Index Error #1027

Open
k----n opened this issue Jan 30, 2022 · 0 comments
Open

[Gitter] Enrichment Index Error #1027

k----n opened this issue Jan 30, 2022 · 0 comments
Labels

Comments

@k----n
Copy link

k----n commented Jan 30, 2022

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?

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

No branches or pull requests

2 participants