Code review comment for lp:~allanlesage/qa-coverage-dashboard/jenkinsapi-singleton

Brendan Donegan (brendan-donegan) wrote :

I don't like playing devils advocate, but globals should really be avoided - I would personally prefer:

_JENKINS_API = None

def get_jenkinsapi_jenkins():
    if _JENKINS_API is None:
        _JENKINS_API = Jenkins(JENKINS_URL)
    else:
         ...

This way the _JENKINS_API singleton can only be accessed by jenkins_pull._JENKINS_API, which is clear it is not meant to be used directly.

review: Needs Fixing

« Back to merge proposal