From 637d6d733a96557c3c9aa345c23c9b233bb6710e Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sun, 31 Jan 2021 10:29:14 +0100 Subject: Add shellcheck and cppcheck linters Signed-off-by: Mario Trangoni --- .github/workflows/linters.yml | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/linters.yml (limited to '.github/workflows/linters.yml') diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 000000000..936db9c8b --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,47 @@ +name: linters + +on: + push: + branches: [ 3.6.x ] + pull_request: + branches: [ 3.6.x ] + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install linters on ubuntu + run: | + sudo apt-get update + sudo apt-get install shellcheck + + - name: run Shellcheck + run: | + find . -name "*.sh" | xargs shellcheck || true + + cppcheck: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install linters on ubuntu + run: | + sudo apt-get update + sudo apt-get install cppcheck + + - name: run cppcheck + run: | + # cppcheck + if ! [ -x "$(command -v cppcheck)" ]; then + echo 'Error: cppcheck is not installed.' >&2 + exit 1 + fi + CPPCHECK_OPTS='--error-exitcode=0 --force --quiet --suppressions-list=./static-analysis-suppressions' + # we exclude some external projects + CPPCHECK_EXCLUDES='-i ./nx-X11/extras/ -i nx-X11/programs/Xserver/GL/mesa* -i ./.pc -i ./nx-X11/.build-exports -i ./nx-X11/exports -i ./doc' + echo "$(cppcheck --version):"; + cppcheck $CPPCHECK_OPTS $CPPCHECK_EXCLUDES .; -- cgit v1.2.3 From 3da6e9c3a348cc3ffe20701e389fd2046d0d4e1d Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sun, 31 Jan 2021 11:07:07 +0100 Subject: Move PVS run to GitHub Actions Signed-off-by: Mario Trangoni --- .github/workflows/linters.yml | 62 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) (limited to '.github/workflows/linters.yml') diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 936db9c8b..183924dfd 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -8,14 +8,14 @@ on: jobs: shellcheck: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 - name: Install linters on ubuntu run: | - sudo apt-get update + sudo apt-get update -q -y sudo apt-get install shellcheck - name: run Shellcheck @@ -23,14 +23,14 @@ jobs: find . -name "*.sh" | xargs shellcheck || true cppcheck: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout repository uses: actions/checkout@v2 - name: Install linters on ubuntu run: | - sudo apt-get update + sudo apt-get update -q -y sudo apt-get install cppcheck - name: run cppcheck @@ -45,3 +45,57 @@ jobs: CPPCHECK_EXCLUDES='-i ./nx-X11/extras/ -i nx-X11/programs/Xserver/GL/mesa* -i ./.pc -i ./nx-X11/.build-exports -i ./nx-X11/exports -i ./doc' echo "$(cppcheck --version):"; cppcheck $CPPCHECK_OPTS $CPPCHECK_EXCLUDES .; + pvs: + environment: pvs + runs-on: ubuntu-20.04 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install linters on ubuntu + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update -qq -y + # compiler + sudo apt-get install -qq -y gcc g++ + # basic packages + sudo apt-get install -qq -y \ + autoconf libtool make pkg-config + # imake deps + sudo apt-get install -qq -y \ + libxkbfile-dev xfonts-utils xutils-dev + # X11 libraries deps + sudo apt-get install -qq -y \ + libpixman-1-dev libjpeg-dev libxcomposite-dev libxdamage-dev \ + libxml2-dev libxfont-dev libxinerama-dev libxpm-dev libxrandr-dev \ + libxtst-dev x11proto-fonts-dev + # soft requirements + sudo apt-get install -qq -y \ + quilt x11-xkb-utils + # PVS + sudo wget -q -O - https://files.viva64.com/etc/pubkey.txt | sudo apt-key add - + sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list + sudo apt-get update -qq + sudo apt-get install -qq pvs-studio + + - name: Run PVS-Studio Analyzer + shell: bash + env: + PVS_USERNAME: ${{ secrets.PVS_USERNAME }} + PVS_KEY: ${{ secrets.PVS_KEY }} + run: | + # check environment variables + if [[ -z "${PVS_USERNAME}" ]]; then + echo '"PVS_USERNAME" environment variable not set' + exit 0 + elif [[ -z "${PVS_KEY}" ]]; then + echo '"PVS_KEY" environment variable not set' + exit 0 + else + pvs-studio-analyzer credentials -o "PVS-Studio.lic" "${PVS_USERNAME}" "${PVS_KEY}" + pvs-studio-analyzer trace -- make + pvs-studio-analyzer analyze --quiet --lic-file "PVS-Studio.lic" --output-file "PVS-Studio-${CC}.log" + plog-converter -a "GA:1,2" -t tasklist -o "PVS-Studio-${CC}.tasks" "PVS-Studio-${CC}.log" + cat "PVS-Studio-${CC}.tasks" + fi -- cgit v1.2.3 From 3dfd7a711567f90878acb1a58ee5fe3228f102b9 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sat, 6 Feb 2021 18:09:21 +0100 Subject: linters: Enable shellcheck This will be green after #1001 get merged. Signed-off-by: Mario Trangoni --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/linters.yml') diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 183924dfd..c6a238fd2 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -20,7 +20,7 @@ jobs: - name: run Shellcheck run: | - find . -name "*.sh" | xargs shellcheck || true + find . -name "*.sh" | xargs shellcheck -e SC1004,SC2010,SC2035,SC2086 cppcheck: runs-on: ubuntu-20.04 -- cgit v1.2.3 From 077089c4e4f7fcdff55d316811482c920cb62c7f Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sun, 7 Feb 2021 11:20:20 +0100 Subject: Add linter references Signed-off-by: Mario Trangoni --- .github/workflows/linters.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to '.github/workflows/linters.yml') diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index c6a238fd2..6bad1fd15 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -7,6 +7,7 @@ on: branches: [ 3.6.x ] jobs: + # see https://github.com/koalaman/shellcheck shellcheck: runs-on: ubuntu-20.04 steps: @@ -22,6 +23,7 @@ jobs: run: | find . -name "*.sh" | xargs shellcheck -e SC1004,SC2010,SC2035,SC2086 + # see https://github.com/danmar/cppcheck cppcheck: runs-on: ubuntu-20.04 steps: @@ -45,6 +47,8 @@ jobs: CPPCHECK_EXCLUDES='-i ./nx-X11/extras/ -i nx-X11/programs/Xserver/GL/mesa* -i ./.pc -i ./nx-X11/.build-exports -i ./nx-X11/exports -i ./doc' echo "$(cppcheck --version):"; cppcheck $CPPCHECK_OPTS $CPPCHECK_EXCLUDES .; + + # see https://www.viva64.com/en/pvs-studio/ pvs: environment: pvs runs-on: ubuntu-20.04 -- cgit v1.2.3 From 69864ad11cf05198a673e4507d6006b21a243a31 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Sun, 7 Feb 2021 14:19:52 +0100 Subject: Add pylint to GitHub Actions Signed-off-by: Mario Trangoni --- .github/workflows/linters.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to '.github/workflows/linters.yml') diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 6bad1fd15..f8a670610 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -21,8 +21,29 @@ jobs: - name: run Shellcheck run: | + shellcheck --version find . -name "*.sh" | xargs shellcheck -e SC1004,SC2010,SC2035,SC2086 + # see https://pylint.org/ + pylint: + runs-on: ubuntu-20.04 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install linters on ubuntu + run: | + sudo apt-get update -q -y + sudo apt-get install pylint + # dependencies + sudo apt-get install --reinstall python-gi + sudo apt-get install python-dbus python-gobject + + - name: run Pylint + run: | + pylint --version + cd nxdialog/; find . -name "nxdialog" -type f | xargs pylint --exit-zero + # see https://github.com/danmar/cppcheck cppcheck: runs-on: ubuntu-20.04 -- cgit v1.2.3