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

Ensure files_to_ignore is passed as a single arg #38

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

johnlk
Copy link
Contributor

@johnlk johnlk commented Apr 27, 2024

As the title implies, this ensures that the argument is passed as a single string value that is whitespace delimited.

@johnlk johnlk self-assigned this Apr 27, 2024
Copy link

Score: 75
Improvements:
  • Consider moving all the details related to how you're getting the "commit_diff" to a separate function. This will enhance the readability of the main() function, and adhere to the single responsibility principle.
  • Variable "files_to_ignore" can have a clearer name to indicate it's an array.
\r\n\r\n
get_commit_diff_for_pr() {
  local -r pr_number=$1
  local -A files_to_ignore=$2
  echo $(github::get_commit_diff "$pr_number" "${files_to_ignore[*]}")
}

main() {
  ...
  local -r commit_diff=$(get_commit_diff_for_pr "$pr_number" "${files_to_ignore[*]}")
  ...
}

@johnlk johnlk merged commit 0af8be7 into main Apr 27, 2024
1 check passed
@johnlk johnlk deleted the john/ensure-array-input branch April 27, 2024 17:59
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.

1 participant