Skip to content

Commit 3b0c08c

Browse files
committed
fix: correct lint issues and show errors on lint
1 parent b52d9bf commit 3b0c08c

2 files changed

Lines changed: 35 additions & 32 deletions

File tree

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Using PIP via Github (more likely the latest version)::
2828
Python scripts are unlikely to be included in your ``$PATH`` by default, this means it cannot be run directly in terminal with ``$ github-backup ...``, you can either add python's install path to your environments ``$PATH`` or call the script directly e.g. using ``$ ~/.local/bin/github-backup``.*
2929

3030
Basic Help
31-
===========
31+
==========
3232

3333
Show the CLI help output::
3434

@@ -220,7 +220,7 @@ Cloning all starred size
220220
Using the ``--all-starred`` argument to clone all starred repositories may use a large amount of storage space, especially if ``--all`` or more arguments are used. e.g. commonly starred repos can have tens of thousands of issues, many large assets and the repo itself etc. Consider just storing links to starred repos in JSON format with ``--starred``.
221221

222222
Incremental Backup
223-
-------------------
223+
------------------
224224

225225
Using (``-i, --incremental``) will only request new data from the API **since the last run (successful or not)**. e.g. only request issues from the API since the last run.
226226

@@ -249,7 +249,7 @@ It's therefore recommended to only use the incremental argument if the output/re
249249

250250

251251
"bare" is actually "mirror"
252-
--------------------------
252+
---------------------------
253253

254254
Using the bare clone argument (``--bare``) will actually call git's ``clone --mirror`` command. There's a subtle difference between `bare <https://www.git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare>`_ and `mirror <https://www.git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror>`_ clone.
255255

@@ -263,13 +263,13 @@ The starred normal repo cloning (``--all-starred``) argument stores starred repo
263263

264264

265265
Skip existing on incomplete backups
266-
-------------------------------------------------------
266+
-----------------------------------
267267

268268
The ``--skip-existing`` argument will skip a backup if the directory already exists, even if the backup in that directory failed (perhaps due to a blocking error). This may result in unexpected missing data in a regular backup.
269269

270270

271271
Github Backup Examples
272-
========
272+
======================
273273

274274
Backup all repositories, including private ones using a classic token::
275275

release

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
#!/usr/bin/env bash
2-
set -eo pipefail; [[ $RELEASE_TRACE ]] && set -x
2+
set -eo pipefail
3+
[[ $RELEASE_TRACE ]] && set -x
34

45
if [[ ! -f setup.py ]]; then
5-
echo -e "${RED}WARNING: Missing setup.py${COLOR_OFF}\n"
6-
exit 1
6+
echo -e "${RED}WARNING: Missing setup.py${COLOR_OFF}\n"
7+
exit 1
78
fi
89

910
PACKAGE_NAME="$(cat setup.py | grep 'name="' | head | cut -d '"' -f2)"
1011
INIT_PACKAGE_NAME="$(echo "${PACKAGE_NAME//-/_}")"
1112
PUBLIC="true"
1213

1314
# Colors
14-
COLOR_OFF="\033[0m" # unsets color to term fg color
15-
RED="\033[0;31m" # red
16-
GREEN="\033[0;32m" # green
17-
YELLOW="\033[0;33m" # yellow
18-
MAGENTA="\033[0;35m" # magenta
19-
CYAN="\033[0;36m" # cyan
15+
COLOR_OFF="\033[0m" # unsets color to term fg color
16+
RED="\033[0;31m" # red
17+
GREEN="\033[0;32m" # green
18+
YELLOW="\033[0;33m" # yellow
19+
MAGENTA="\033[0;35m" # magenta
20+
CYAN="\033[0;36m" # cyan
2021

2122
# ensure wheel is available
22-
pip install wheel > /dev/null
23+
pip install wheel >/dev/null
2324

2425
command -v gitchangelog >/dev/null 2>&1 || {
2526
echo -e "${RED}WARNING: Missing gitchangelog binary, please run: pip install gitchangelog==3.0.4${COLOR_OFF}\n"
2627
exit 1
2728
}
2829

29-
command -v rst-lint > /dev/null || {
30+
command -v rst-lint >/dev/null || {
3031
echo -e "${RED}WARNING: Missing rst-lint binary, please run: pip install restructuredtext_lint${COLOR_OFF}\n"
3132
exit 1
3233
}
3334

34-
command -v twine > /dev/null || {
35+
command -v twine >/dev/null || {
3536
echo -e "${RED}WARNING: Missing twine binary, please run: pip install twine==3.2.0${COLOR_OFF}\n"
3637
exit 1
3738
}
@@ -43,41 +44,41 @@ fi
4344

4445
echo -e "\n${GREEN}STARTING RELEASE PROCESS${COLOR_OFF}\n"
4546

46-
set +e;
47-
git status | grep -Eo "working (directory|tree) clean" &> /dev/null
47+
set +e
48+
git status | grep -Eo "working (directory|tree) clean" &>/dev/null
4849
if [ ! $? -eq 0 ]; then # working directory is NOT clean
4950
echo -e "${RED}WARNING: You have uncomitted changes, you may have forgotten something${COLOR_OFF}\n"
5051
exit 1
5152
fi
52-
set -e;
53+
set -e
5354

5455
echo -e "${YELLOW}--->${COLOR_OFF} Updating local copy"
5556
git pull -q origin master
5657

5758
echo -e "${YELLOW}--->${COLOR_OFF} Retrieving release versions"
5859

59-
current_version=$(cat ${INIT_PACKAGE_NAME}/__init__.py |grep '__version__ ='|sed 's/[^0-9.]//g')
60+
current_version=$(cat ${INIT_PACKAGE_NAME}/__init__.py | grep '__version__ =' | sed 's/[^0-9.]//g')
6061
major=$(echo $current_version | awk '{split($0,a,"."); print a[1]}')
6162
minor=$(echo $current_version | awk '{split($0,a,"."); print a[2]}')
6263
patch=$(echo $current_version | awk '{split($0,a,"."); print a[3]}')
6364

6465
if [[ "$@" == "major" ]]; then
65-
major=$(($major + 1));
66+
major=$(($major + 1))
6667
minor="0"
6768
patch="0"
6869
elif [[ "$@" == "minor" ]]; then
69-
minor=$(($minor + 1));
70+
minor=$(($minor + 1))
7071
patch="0"
7172
elif [[ "$@" == "patch" ]]; then
72-
patch=$(($patch + 1));
73+
patch=$(($patch + 1))
7374
fi
7475

7576
next_version="${major}.${minor}.${patch}"
7677

77-
echo -e "${YELLOW} >${COLOR_OFF} ${MAGENTA}${current_version}${COLOR_OFF} -> ${MAGENTA}${next_version}${COLOR_OFF}"
78+
echo -e "${YELLOW} >${COLOR_OFF} ${MAGENTA}${current_version}${COLOR_OFF} -> ${MAGENTA}${next_version}${COLOR_OFF}"
7879

7980
echo -e "${YELLOW}--->${COLOR_OFF} Ensuring readme passes lint checks (if this fails, run rst-lint)"
80-
rst-lint README.rst > /dev/null
81+
rst-lint README.rst || exit 1
8182

8283
echo -e "${YELLOW}--->${COLOR_OFF} Creating necessary temp file"
8384
tempfoo=$(basename $0)
@@ -90,23 +91,25 @@ find_this="__version__ = \"$current_version\""
9091
replace_with="__version__ = \"$next_version\""
9192

9293
echo -e "${YELLOW}--->${COLOR_OFF} Updating ${INIT_PACKAGE_NAME}/__init__.py"
93-
sed "s/$find_this/$replace_with/" ${INIT_PACKAGE_NAME}/__init__.py > $TMPFILE && mv $TMPFILE ${INIT_PACKAGE_NAME}/__init__.py
94+
sed "s/$find_this/$replace_with/" ${INIT_PACKAGE_NAME}/__init__.py >$TMPFILE && mv $TMPFILE ${INIT_PACKAGE_NAME}/__init__.py
9495

9596
if [ -f docs/conf.py ]; then
9697
echo -e "${YELLOW}--->${COLOR_OFF} Updating docs"
9798
find_this="version = '${current_version}'"
9899
replace_with="version = '${next_version}'"
99-
sed "s/$find_this/$replace_with/" docs/conf.py > $TMPFILE && mv $TMPFILE docs/conf.py
100+
sed "s/$find_this/$replace_with/" docs/conf.py >$TMPFILE && mv $TMPFILE docs/conf.py
100101

101102
find_this="version = '${current_version}'"
102103
replace_with="release = '${next_version}'"
103-
sed "s/$find_this/$replace_with/" docs/conf.py > $TMPFILE && mv $TMPFILE docs/conf.py
104+
sed "s/$find_this/$replace_with/" docs/conf.py >$TMPFILE && mv $TMPFILE docs/conf.py
104105
fi
105106

106107
echo -e "${YELLOW}--->${COLOR_OFF} Updating CHANGES.rst for new release"
107108
version_header="$next_version ($(date +%F))"
108-
set +e; dashes=$(yes '-'|head -n ${#version_header}|tr -d '\n') ; set -e
109-
gitchangelog |sed "4s/.*/$version_header/"|sed "5s/.*/$dashes/" > $TMPFILE && mv $TMPFILE CHANGES.rst
109+
set +e
110+
dashes=$(yes '-' | head -n ${#version_header} | tr -d '\n')
111+
set -e
112+
gitchangelog | sed "4s/.*/$version_header/" | sed "5s/.*/$dashes/" >$TMPFILE && mv $TMPFILE CHANGES.rst
110113

111114
echo -e "${YELLOW}--->${COLOR_OFF} Adding changed files to git"
112115
git add CHANGES.rst README.rst ${INIT_PACKAGE_NAME}/__init__.py
@@ -124,7 +127,7 @@ git push -q origin master && git push -q --tags
124127
if [[ "$PUBLIC" == "true" ]]; then
125128
echo -e "${YELLOW}--->${COLOR_OFF} Creating python release"
126129
cp README.rst README
127-
python setup.py sdist bdist_wheel > /dev/null
130+
python setup.py sdist bdist_wheel >/dev/null
128131
twine upload dist/*
129132
rm README
130133
fi

0 commit comments

Comments
 (0)