diff options
| author | jvoisin | 2018-07-23 23:42:56 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-23 23:55:45 +0200 |
| commit | 7697f9c08514fdeb43fab738c98ee70b6a7f9a4e (patch) | |
| tree | 7b04e6a9716d49a751443e29938bca63c8cf5659 | |
| parent | e9200835590641c277784159f25ab4464c515a17 (diff) | |
Improve the linters' coverage
| -rw-r--r-- | .gitlab-ci.yml | 9 | ||||
| -rwxr-xr-x | mat2 | 4 | ||||
| -rw-r--r-- | nautilus/nautilus_mat2.py | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c14f4d1..209a829 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml | |||
| @@ -9,6 +9,8 @@ bandit: | |||
| 9 | script: # TODO: remove B405 and B314 | 9 | script: # TODO: remove B405 and B314 |
| 10 | - apt-get -qqy update | 10 | - apt-get -qqy update |
| 11 | - apt-get -qqy install --no-install-recommends python3-bandit | 11 | - apt-get -qqy install --no-install-recommends python3-bandit |
| 12 | - bandit ./mat2 --format txt | ||
| 13 | - bandit -r ./nautilus/ --format txt | ||
| 12 | - bandit -r ./libmat2 --format txt --skip B101,B404,B603,B405,B314 | 14 | - bandit -r ./libmat2 --format txt --skip B101,B404,B603,B405,B314 |
| 13 | 15 | ||
| 14 | pylint: | 16 | pylint: |
| @@ -16,14 +18,16 @@ pylint: | |||
| 16 | script: | 18 | script: |
| 17 | - apt-get -qqy update | 19 | - apt-get -qqy update |
| 18 | - apt-get -qqy install --no-install-recommends pylint3 python3-mutagen python3-gi-cairo gir1.2-poppler-0.18 gir1.2-gdkpixbuf-2.0 | 20 | - apt-get -qqy install --no-install-recommends pylint3 python3-mutagen python3-gi-cairo gir1.2-poppler-0.18 gir1.2-gdkpixbuf-2.0 |
| 19 | - pylint3 --extension-pkg-whitelist=cairo,gi ./libmat2 | 21 | - pylint3 --extension-pkg-whitelist=cairo,gi ./libmat2 ./mat2 |
| 22 | # Once nautilus-python is in Debian, decomment it form the line below | ||
| 23 | - pylint3 --extension-pkg-whitelist=Nautilus,GObject,Gtk,Gio,GLib,gi ./nautilus/nautilus_mat2.py | ||
| 20 | 24 | ||
| 21 | pyflakes: | 25 | pyflakes: |
| 22 | stage: linting | 26 | stage: linting |
| 23 | script: | 27 | script: |
| 24 | - apt-get -qqy update | 28 | - apt-get -qqy update |
| 25 | - apt-get -qqy install --no-install-recommends pyflakes3 | 29 | - apt-get -qqy install --no-install-recommends pyflakes3 |
| 26 | - pyflakes3 ./libmat2 ./mat2 ./tests/ | 30 | - pyflakes3 ./libmat2 ./mat2 ./tests/ ./nautilus |
| 27 | 31 | ||
| 28 | mypy: | 32 | mypy: |
| 29 | stage: linting | 33 | stage: linting |
| @@ -32,6 +36,7 @@ mypy: | |||
| 32 | - apt-get -qqy install --no-install-recommends python3-pip | 36 | - apt-get -qqy install --no-install-recommends python3-pip |
| 33 | - pip3 install mypy | 37 | - pip3 install mypy |
| 34 | - mypy mat2 libmat2/*.py --ignore-missing-imports | 38 | - mypy mat2 libmat2/*.py --ignore-missing-imports |
| 39 | - mypy --ignore-missing-imports ./nautilus/nautilus_mat2.py | ||
| 35 | 40 | ||
| 36 | tests:debian: | 41 | tests:debian: |
| 37 | stage: test | 42 | stage: test |
| @@ -16,7 +16,7 @@ except ValueError as e: | |||
| 16 | 16 | ||
| 17 | __version__ = '0.2.0' | 17 | __version__ = '0.2.0' |
| 18 | 18 | ||
| 19 | def __check_file(filename: str, mode: int = os.R_OK) -> bool: | 19 | def __check_file(filename: str, mode: int=os.R_OK) -> bool: |
| 20 | if not os.path.exists(filename): | 20 | if not os.path.exists(filename): |
| 21 | print("[-] %s is doesn't exist." % filename) | 21 | print("[-] %s is doesn't exist." % filename) |
| 22 | return False | 22 | return False |
| @@ -37,7 +37,7 @@ def create_arg_parser(): | |||
| 37 | parser.add_argument('-l', '--list', action='store_true', | 37 | parser.add_argument('-l', '--list', action='store_true', |
| 38 | help='list all supported fileformats') | 38 | help='list all supported fileformats') |
| 39 | parser.add_argument('-c', '--check-dependencies', action='store_true', | 39 | parser.add_argument('-c', '--check-dependencies', action='store_true', |
| 40 | help='check if MAT2 has all the dependencies it needs') | 40 | help='check if MAT2 has all the dependencies it needs') |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | info = parser.add_mutually_exclusive_group() | 43 | info = parser.add_mutually_exclusive_group() |
diff --git a/nautilus/nautilus_mat2.py b/nautilus/nautilus_mat2.py index 8828989..09c22e5 100644 --- a/nautilus/nautilus_mat2.py +++ b/nautilus/nautilus_mat2.py | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | 2 | ||
| 3 | # pylint: disable=unused-argument,len-as-condition,arguments-differ | 3 | # pylint: disable=unused-argument,arguments-differ,no-self-use,no-name-in-module,import-error |
| 4 | 4 | ||
| 5 | """ | 5 | """ |
| 6 | Because writing GUI is non-trivial (cf. https://0xacab.org/jvoisin/mat2/issues/3), | 6 | Because writing GUI is non-trivial (cf. https://0xacab.org/jvoisin/mat2/issues/3), |
