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(readability): move function opening brace to new line #1339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/scripts/process_release_tags
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ set -o errexit
set -o nounset

# Error handling function
handle_error() {
handle_error()
{
echo "An error occurred on line $1" >&2
exit 1
}
Expand All @@ -16,7 +17,8 @@ handle_error() {
trap 'if [ $? -gt 0 ]; then handle_error ${LINENO:-}; fi' EXIT

# Error throwing function
throw_error() {
throw_error()
{
# Print the error message to stderr
echo "$1" >&2

Expand All @@ -25,7 +27,8 @@ throw_error() {
}

# Open URL function
open_url() {
open_url()
{
url="$1"
case "${TARGET_KERNEL}" in
Darwin*) open "${url}" ;;
Expand All @@ -36,7 +39,8 @@ open_url() {
}

# Git operations function
push_changes_to_branch() {
push_changes_to_branch()
{
# Stash any changes if there are any
if [ -n "$(git status --porcelain)" ]; then
git stash
Expand All @@ -60,7 +64,8 @@ push_changes_to_branch() {
}

# Prepare to push changes
prepare_to_push_changes() {
prepare_to_push_changes()
{
# Change to the repository directory
cd "${REPO_PATH}"
git fetch origin master
Expand All @@ -72,7 +77,8 @@ prepare_to_push_changes() {
}

# Replace function
replace_in_files() {
replace_in_files()
{
# Replace the old version with the new version in all files
if [ "${TARGET_KERNEL}" = 'Darwin' ]; then
find . -type f -exec env LANG=C sed -i '' "s/$1/$2/g" {} \;
Expand All @@ -81,15 +87,17 @@ replace_in_files() {
fi
}

validate_branch() {
validate_branch()
{
cd "${REPO_PATH}"
git fetch origin
if ! git show-ref --verify --quiet refs/remotes/origin/"$1"; then
throw_error "Branch $1 does not exist on origin. Please enter a valid branch."
fi
}

validate_semver() {
validate_semver()
{
if ! echo "$1" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
throw_error "Invalid version: $1. Version must be in SemVer format without any suffix like '-beta'."
fi
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
--enable require-variable-braces
SHFMT_OPTS: >-
--case-indent
--func-next-line
--indent 2
--space-redirects

Expand Down
Loading
Loading