diff --git a/README.md b/README.md index 74fee6ed..c018dc76 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Key Mapper - - + +![pylint](data/pylint.svg) ![coverage](data/coverage.svg) Tool to change the mapping of your input device buttons. diff --git a/badges.sh b/badges.sh new file mode 100755 index 00000000..65f97100 --- /dev/null +++ b/badges.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +coverage_badge() { + # https://github.com/dbrgn/coverage-badge + coverage run --branch --source=/usr/lib/python3.8/site-packages/keymapper tests/test.py + python3 -m coverage_badge > data/coverage.svg + echo "coverage badge created" +} + +pylint_badge() { + # https://github.com/jongracecox/anybadge + pylint_output=$(pylint keymapper --extension-pkg-whitelist=evdev) + rating=$(echo $pylint_output | grep -Po "rated at .+?/" | grep -Po "\d+.\d+") + rm data/pylint.svg + anybadge -l pylint -v $rating -f data/pylint.svg pylint + echo "pylint badge created" +} + +pylint_badge & +coverage_badge & + +# wait for all badges to be created +wait \ No newline at end of file diff --git a/coverage.sh b/coverage.sh deleted file mode 100755 index c150c5e7..00000000 --- a/coverage.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# https://github.com/dbrgn/coverage-badge -coverage run --branch --source=/usr/lib/python3.8/site-packages/keymapper tests/test.py -python3 -m coverage_badge > data/coverage.svg diff --git a/data/pylint.svg b/data/pylint.svg new file mode 100644 index 00000000..280836f4 --- /dev/null +++ b/data/pylint.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + pylint + pylint + + + 9.66 + 9.66 + + \ No newline at end of file diff --git a/tests/test.py b/tests/test.py index 94877413..052da715 100644 --- a/tests/test.py +++ b/tests/test.py @@ -215,7 +215,7 @@ patch_unsaved() patch_dbus() -if __name__ == "__main__": +def main(): update_verbosity(True) modules = sys.argv[1:] @@ -243,3 +243,7 @@ if __name__ == "__main__": unittest.TextTestResult.startTest = startTest testrunner = unittest.TextTestRunner(verbosity=2).run(testsuite) + + +if __name__ == "__main__": + main()