Skip to content

Commit

Permalink
refactor: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesreffett committed Nov 12, 2023
1 parent cb17ff4 commit 33126bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
12 changes: 7 additions & 5 deletions scripts/git-make-release
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

# Prompt for the version number
prompt_for_version() {
read -p "Enter the version number (default: $1): " version
read -rp "Enter the version number (default: $1): " version
echo "${version:-$1}" # Return the entered version number or the default if none was entered
}

# Increment version number
increment_version() {
local IFS='.'
read -a version_parts <<< "$1"
read -ar version_parts <<< "$1"
# Increment the minor version and reset patch version
local next_version="${version_parts[0]}.$((version_parts[1] + 1)).0"

# Prompt for the version number, using the next version as the default
read -p "Enter the version number (default: $next_version): " version
read -rp "Enter the version number (default: $next_version): " version
echo "${version:-$next_version}" # Return the entered version number or the default if none was entered
}

Expand All @@ -27,7 +27,9 @@ get_latest_version() {
prepend_to_changelog() {
local version=$1
local tickets=$2
local date=$(date +"%b %d, %Y")
local date

date=$(date +"%b %d, %Y")
local changelog="CHANGELOG.md"

# Create a backup of the CHANGELOG.md
Expand All @@ -54,7 +56,7 @@ fi

# Get the latest tag and suggest the next version number
LATEST_TAG=$(get_latest_version)
NEXT_VERSION=$(increment_version ${LATEST_TAG#v}) # Assuming the tag is in the 'v1.2.3' format
NEXT_VERSION=$(increment_version "${LATEST_TAG#v}") # Assuming the tag is in the 'v1.2.3' format

if $DRY_RUN; then
# Perform a dry run
Expand Down
24 changes: 12 additions & 12 deletions scripts/git-tickets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# Prompt for a branch name with a default
prompt_for_branch() {
read -p "Enter the name of the $1 branch (default: $2): " branch
read -rp "Enter the name of the $1 branch (default: $2): " branch
echo "${branch:-$2}" # Return the entered branch name or the default if none was entered
}

Expand Down Expand Up @@ -32,35 +32,35 @@ process_branch() {
local branch_name=$1
local temp_branch="temp_${branch_name}_$$"
if $UPDATE_BRANCHES; then
git checkout $branch_name &> /dev/null
git pull origin $branch_name &> /dev/null
git checkout "$branch_name" &> /dev/null
git pull origin "$branch_name" &> /dev/null
echo "$branch_name"
else
git fetch origin $branch_name:$temp_branch &> /dev/null
echo $temp_branch
git fetch origin "$branch_name":"$temp_branch" &> /dev/null
echo "$temp_branch"
fi
}

# Process the first branch
BRANCH1=$(process_branch $BRANCH1)
BRANCH1=$(process_branch "$BRANCH1")

# Process the second branch
BRANCH2=$(process_branch $BRANCH2)
BRANCH2=$(process_branch "$BRANCH2")

# If not updating branches, use the temporary branches for log
if ! $UPDATE_BRANCHES; then
# Run the git log command and process the output on temporary branches
git log $BRANCH2..$BRANCH1 --oneline --no-merges | grep -Eio "(\w+)-([0-9]+)" | tr '[:lower:]' '[:upper:]' | sort -u
git log "$BRANCH2".."$BRANCH1" --oneline --no-merges | grep -Eio "(\w+)-([0-9]+)" | tr '[:lower:]' '[:upper:]' | sort -u

# Delete the temporary branches
git branch -D $BRANCH1 &> /dev/null
git branch -D $BRANCH2 &> /dev/null
git branch -D "$BRANCH1" &> /dev/null
git branch -D "$BRANCH2" &> /dev/null
git status;
else
# Run the git log command and process the output on updated branches
git log $BRANCH2..$BRANCH1 --oneline --no-merges | grep -Eio "(\w+)-([0-9]+)" | tr '[:lower:]' '[:upper:]' | sort -u
git log "$BRANCH2".."$BRANCH1" --oneline --no-merges | grep -Eio "(\w+)-([0-9]+)" | tr '[:lower:]' '[:upper:]' | sort -u

# Checkout to the first branch (assumed to be 'master')
git checkout $BRANCH1 &> /dev/null
git checkout "$BRANCH1" &> /dev/null
git status
fi

0 comments on commit 33126bc

Please sign in to comment.