Skip to content

Commit

Permalink
shell scripts: remove unnecessary realpath and quotes, update ruff co…
Browse files Browse the repository at this point in the history
…mmands
  • Loading branch information
ilius committed Nov 17, 2024
1 parent a06bde2 commit e36e575
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 34 deletions.
4 changes: 1 addition & 3 deletions run-with-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ function shouldBuild() {
return 1
}

myPath=$(realpath "$0")
myDir=$(dirname "$myPath")
cd "$myDir"
cd $(dirname "$0")

if [ -n "$1" ]; then
version="$1"
Expand Down
8 changes: 3 additions & 5 deletions scripts/check-missing-types
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
set -e

if [ -z "$1" ]; then
myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
cd $(dirname "$myDir1")
cd $(dirname "$0")/..
set .
fi

if [ -z "$NO_COLOR" ]; then
export CLICOLOR_FORCE=1
fi

ruff --fix "$@"
ruff --select ANN "$@" |
ruff check --fix "$@"
ruff check --select ANN "$@" |
grep -v 'Missing type annotation for `\*\*' |
grep -v _test.py |
grep -v _debug.py |
Expand Down
10 changes: 4 additions & 6 deletions scripts/check-style
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/bash

set -x
if [ -z "$1" ]; then
myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
cd $(dirname "$myDir1")
cd $(dirname "$0")/..
set .
fi

# ruff "$@" | grep -E --color=always '\:[0-9]+\:' | less -R
# ruff check "$@" | grep -E --color=always '\:[0-9]+\:' | less -R
# no 'grep -P' on *BSD / Mac

if [ -z "$NO_COLOR" ]; then
export CLICOLOR_FORCE=1
fi
ruff "$@" | less -R
ruff check "$@" | less -R
3 changes: 1 addition & 2 deletions scripts/gen.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash
set -e

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
myDir1=$(dirname "$0")

set -x

Expand Down
4 changes: 1 addition & 3 deletions scripts/get-unlisted-formats.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
set -e

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
rootDir=$(dirname "$myDir1")
rootDir=$(dirname $(dirname "$0"))

mkdir -p "$HOME/.cache/pyglossary/tmp"
cd "$HOME/.cache/pyglossary/tmp"
Expand Down
4 changes: 1 addition & 3 deletions scripts/test-cover-html-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ set -e
# l_name of plugin, for example "stardict" or "octopus_mdict"
pluginLname="$1"

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
rootDir=$(dirname "$myDir1")
rootDir=$(dirname $(dirname "$0"))

cd "$rootDir/tests"
coverage run -m unittest "g_${pluginLname}_test.py"
Expand Down
4 changes: 1 addition & 3 deletions scripts/test-cover-html.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
set -e

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
rootDir=$(dirname "$myDir1")
rootDir=$(dirname $(dirname "$0"))

cd "$rootDir/tests"
coverage run -m unittest ./*_test.py
Expand Down
4 changes: 1 addition & 3 deletions scripts/test-glossary.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
set -e

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
rootDir=$(dirname "$myDir1")
rootDir=$(dirname $(dirname "$0"))

echo "$rootDir/tests/glossary_test.py"
python3 "$rootDir/tests/glossary_test.py"
Expand Down
4 changes: 1 addition & 3 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
set -e

myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
rootDir=$(dirname "$myDir1")
rootDir=$(dirname $(dirname "$0"))

echo "$rootDir/tests"
cd "$rootDir/tests"
Expand Down
4 changes: 1 addition & 3 deletions scripts/version
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash
set -e

myPath=$(realpath "$0")
myDir=$(dirname "$myPath")
sourceDir=$(dirname "$myDir")
sourceDir=$(dirname $(dirname "$0"))
gitDir="$sourceDir/.git"

if [ -d "$gitDir" ]; then
Expand Down

0 comments on commit e36e575

Please sign in to comment.