Skip to content

Commit a2ce412

Browse files
ci(editorconfig): add .editorconfig (reanahub#491)
1 parent 2e674c2 commit a2ce412

1 file changed

Lines changed: 48 additions & 48 deletions

File tree

run-tests.sh

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,81 +10,81 @@ set -o errexit
1010
set -o nounset
1111

1212
check_commitlint() {
13-
from=${2:-master}
14-
to=${3:-HEAD}
15-
pr=${4:-[0-9]+}
16-
npx commitlint --from="$from" --to="$to"
17-
found=0
18-
while IFS= read -r line; do
19-
commit_hash=$(echo "$line" | cut -d ' ' -f 1)
20-
commit_title=$(echo "$line" | cut -d ' ' -f 2-)
21-
commit_number_of_parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}')
22-
# (i) skip checking release commits generated by Release Please
23-
if [ "$commit_number_of_parents" -le 1 ] && echo "$commit_title" | grep -qE "^chore\(.*\): release"; then
24-
continue
25-
fi
26-
# (ii) check presence of PR number
27-
if ! echo "$commit_title" | grep -qE "\(#$pr\)$"; then
28-
echo "✖ Headline does not end by '(#$pr)' PR number: $commit_title"
29-
found=1
30-
fi
31-
# (iii) check absence of merge commits in feature branches
32-
if [ "$commit_number_of_parents" -gt 1 ]; then
33-
if echo "$commit_title" | grep -qE "^chore\(.*\): merge "; then
34-
break # skip checking maint-to-master merge commits
35-
else
36-
echo "✖ Merge commits are not allowed in feature branches: $commit_title"
37-
found=1
38-
fi
39-
fi
40-
done < <(git log "$from..$to" --format="%H %s")
41-
if [ $found -gt 0 ]; then
42-
exit 1
43-
fi
13+
from=${2:-master}
14+
to=${3:-HEAD}
15+
pr=${4:-[0-9]+}
16+
npx commitlint --from="$from" --to="$to"
17+
found=0
18+
while IFS= read -r line; do
19+
commit_hash=$(echo "$line" | cut -d ' ' -f 1)
20+
commit_title=$(echo "$line" | cut -d ' ' -f 2-)
21+
commit_number_of_parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}')
22+
# (i) skip checking release commits generated by Release Please
23+
if [ "$commit_number_of_parents" -le 1 ] && echo "$commit_title" | grep -qE "^chore\(.*\): release"; then
24+
continue
25+
fi
26+
# (ii) check presence of PR number
27+
if ! echo "$commit_title" | grep -qE "\(#$pr\)$"; then
28+
echo "✖ Headline does not end by '(#$pr)' PR number: $commit_title"
29+
found=1
30+
fi
31+
# (iii) check absence of merge commits in feature branches
32+
if [ "$commit_number_of_parents" -gt 1 ]; then
33+
if echo "$commit_title" | grep -qE "^chore\(.*\): merge "; then
34+
break # skip checking maint-to-master merge commits
35+
else
36+
echo "✖ Merge commits are not allowed in feature branches: $commit_title"
37+
found=1
38+
fi
39+
fi
40+
done < <(git log "$from..$to" --format="%H %s")
41+
if [ $found -gt 0 ]; then
42+
exit 1
43+
fi
4444
}
4545

4646
check_shellcheck() {
47-
find . -name "*.sh" -exec shellcheck {} \+
47+
find . -name "*.sh" -exec shellcheck {} \+
4848
}
4949

5050
check_pydocstyle() {
51-
pydocstyle reana_commons
51+
pydocstyle reana_commons
5252
}
5353

5454
check_black() {
55-
black --check .
55+
black --check .
5656
}
5757

5858
check_flake8() {
59-
flake8 .
59+
flake8 .
6060
}
6161

6262
check_manifest() {
63-
check-manifest
63+
check-manifest
6464
}
6565

6666
check_sphinx() {
67-
sphinx-build -qnNW docs docs/_build/html
67+
sphinx-build -qnNW docs docs/_build/html
6868
}
6969

7070
check_pytest() {
71-
pytest
71+
pytest
7272
}
7373

7474
check_all() {
75-
check_commitlint
76-
check_shellcheck
77-
check_pydocstyle
78-
check_black
79-
check_flake8
80-
check_manifest
81-
check_sphinx
82-
check_pytest
75+
check_commitlint
76+
check_shellcheck
77+
check_pydocstyle
78+
check_black
79+
check_flake8
80+
check_manifest
81+
check_sphinx
82+
check_pytest
8383
}
8484

8585
if [ $# -eq 0 ]; then
86-
check_all
87-
exit 0
86+
check_all
87+
exit 0
8888
fi
8989

9090
arg="$1"

0 commit comments

Comments
 (0)