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

Make code more generic to handle different SCM types #374

Open
svidhani opened this issue Jun 20, 2018 · 0 comments
Open

Make code more generic to handle different SCM types #374

svidhani opened this issue Jun 20, 2018 · 0 comments

Comments

@svidhani
Copy link
Contributor

svidhani commented Jun 20, 2018

Description

Currently there is if else condition to check for SCM type which is very specific.

The code needs to be improved to handle different SCM types more generically which can handle bitbucket, gitlab, github, etc by importing different modules based on scmTypes as shown below
Here I am following convention to define objects keys and the files to make my code flexible.

function(scmType) {
const scmTypes = {
'default': require('./defaultSCM'),
[scmType]: require(./${scmType})
};

     try {
        scmTypes[scmType]();
    } catch(ex) {
        console.log(ex);
        scmTypes['default']();
    }
}

Aha! Link: https://t-mobile1t-mobile.aha.io/features/JZ-25

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

No branches or pull requests

1 participant