grimoirelab-elk icon indicating copy to clipboard operation
grimoirelab-elk copied to clipboard

[ELK] Refactor `class Enrich` to improve cohesion

Open imnitishng opened this issue 4 years ago • 4 comments

This PR moves item identities related methods from class Enrich to class Identities from improving cohesion and reducing lines of code for class Enrich.

Closes https://github.com/chaoss/grimoirelab-elk/issues/877

imnitishng avatar May 27 '20 15:05 imnitishng

Hi @valeriocos, I am sorry for all the delay, I have been a bit busy with college work. So I was having a look at this issue. based on the changes you proposed I was facing a problem. Can I get some help here? Suppose we migrate the code from https://github.com/chaoss/grimoirelab-elk/blob/master/grimoire_elk/enriched/enrich.py#L120-L129 to Identities.__init__ then we will have to obviously inherit 2 classes in the backend enrichers, Eg - class GithubEnrich(Enrich, Identities):, hence calling __init__() of 2 super classes with similar arguments. We can also add a new attribute like GitHubIdentities to https://github.com/chaoss/grimoirelab-elk/blob/048b727ec804bb9c61bdf84dd76ea9524593a466/grimoire_elk/utils.py#L236 and proceed doing identity related work there?

imnitishng avatar Jun 15 '20 11:06 imnitishng

@valeriocos, ping

imnitishng avatar Jun 17 '20 14:06 imnitishng

@imnitishng pong :) I hope to catch up with this PR and the other ones next week.

Would make it sense if the Enrich class contains a reference to the Identities class?

class Enrich(ElasticItems):

    ...
    def __init__(self, db_sortinghat=None, db_projects_map=None, json_projects_map=None,
                 db_user='', db_password='', db_host='', insecure=True):

        perceval_backend = None
        super().__init__(perceval_backend, insecure=insecure)
        identities = Identities(db_user, db_password, db_sortinghat, db_host, ...)
       ...

valeriocos avatar Jun 18 '20 12:06 valeriocos

Thanks @valeriocos, sorry for the disturbance. Take your time.

Would make it sense if the Enrich class contains a reference to the Identities class?

Okay sure I'll try to do as you said and update the PR. :smile:

imnitishng avatar Jun 18 '20 16:06 imnitishng

Closing this due to inactivity.

jjmerchante avatar Oct 11 '23 16:10 jjmerchante