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

refactor to avoid use of globally defined variables #16

Merged
merged 1 commit into from
Dec 12, 2020

Conversation

funbeedev
Copy link
Member

Please fill in this pull request template before submitting

1. This pull request resolves #11

2. Description

Removed use of global variables.
Config file reading performed in a function.
Variables are now passed into each function as needed.

3. Fill in checklist by marking [x]

  • I've read the CONTRIBUTING.md
  • I was assigned to this issue
  • My code is formatted using required linting
  • I've run my code locally and checked it works

- instead pass the variables needed by each function
@@ -140,21 +146,23 @@ def start_program_flow():

print("------ Start ------")

create_local_git_repo()
access_token, repo_name, first_file, msg, github_name, pc_directory, repo_directory, run_cmd = setup_config()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

first_file = config.get('your_settings', 'commit_file')
msg = config.get('your_settings', 'first_commit_msg')
github_name = config.get('your_settings', 'github_name')
def setup_config():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@funbeedev - how about passing the config file in to the function as well...

def setup_config(config_file = None):
    if config_file is None:
        config_file = 'config.ini'

Default to None is the standard way of defaulting parameters.

@Stedders
Copy link
Contributor

Stedders commented Dec 9, 2020

That looks good, my one small suggestions would be to make the file configurable and default to your standard value.

@funbeedev
Copy link
Member Author

@Stedders Thanks for the review! I'll be making the file configurable in a separate PR 👍🏿

@funbeedev funbeedev merged commit 11743c8 into inspirezonetech:main Dec 12, 2020
@funbeedev funbeedev deleted the avoid_globals branch January 2, 2021 20:37
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

Successfully merging this pull request may close these issues.

Refactor to avoid use of global variables
2 participants