Skip to content

Commit 33126bc

Browse files
refactor: fix linting errors
1 parent cb17ff4 commit 33126bc

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

scripts/git-make-release

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

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

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

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

@@ -27,7 +27,9 @@ get_latest_version() {
2727
prepend_to_changelog() {
2828
local version=$1
2929
local tickets=$2
30-
local date=$(date +"%b %d, %Y")
30+
local date
31+
32+
date=$(date +"%b %d, %Y")
3133
local changelog="CHANGELOG.md"
3234

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

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

5961
if $DRY_RUN; then
6062
# Perform a dry run

scripts/git-tickets

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# Prompt for a branch name with a default
33
prompt_for_branch() {
4-
read -p "Enter the name of the $1 branch (default: $2): " branch
4+
read -rp "Enter the name of the $1 branch (default: $2): " branch
55
echo "${branch:-$2}" # Return the entered branch name or the default if none was entered
66
}
77

@@ -32,35 +32,35 @@ process_branch() {
3232
local branch_name=$1
3333
local temp_branch="temp_${branch_name}_$$"
3434
if $UPDATE_BRANCHES; then
35-
git checkout $branch_name &> /dev/null
36-
git pull origin $branch_name &> /dev/null
35+
git checkout "$branch_name" &> /dev/null
36+
git pull origin "$branch_name" &> /dev/null
3737
echo "$branch_name"
3838
else
39-
git fetch origin $branch_name:$temp_branch &> /dev/null
40-
echo $temp_branch
39+
git fetch origin "$branch_name":"$temp_branch" &> /dev/null
40+
echo "$temp_branch"
4141
fi
4242
}
4343

4444
# Process the first branch
45-
BRANCH1=$(process_branch $BRANCH1)
45+
BRANCH1=$(process_branch "$BRANCH1")
4646

4747
# Process the second branch
48-
BRANCH2=$(process_branch $BRANCH2)
48+
BRANCH2=$(process_branch "$BRANCH2")
4949

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

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

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

0 commit comments

Comments
 (0)