summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-04 20:21:08 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-04-04 18:35:53 +0000
commit7717694f62978697f7886b7661363785f5d58efd (patch)
tree1cca8dbd7a9c0258f7b9b574895b5823e2e29b79
parent7589e1da8ca63576e651ea1f7da86ea65045ad2a (diff)
downloadvyos-1x-7717694f62978697f7886b7661363785f5d58efd.tar.gz
vyos-1x-7717694f62978697f7886b7661363785f5d58efd.zip
Makefile: improve "unused-imports" target
(cherry picked from commit faa153524f04ebe8ab5f12d7afe6df2a6eb3728a)
-rw-r--r--.github/workflows/unused-imports.yml39
-rw-r--r--Makefile4
2 files changed, 17 insertions, 26 deletions
diff --git a/.github/workflows/unused-imports.yml b/.github/workflows/unused-imports.yml
index 83098ddf6..e716a9c01 100644
--- a/.github/workflows/unused-imports.yml
+++ b/.github/workflows/unused-imports.yml
@@ -1,29 +1,20 @@
name: Check for unused imports using Pylint
-on:
- pull_request_target:
- types: [opened, reopened, ready_for_review, locked]
+on: push
+ # pull_request_target:
+ # types: [opened, reopened, ready_for_review, locked]
jobs:
- build:
+ Check-Unused-Imports:
runs-on: ubuntu-latest
- strategy:
- matrix:
- python-version: ["3.11"]
steps:
- - uses: actions/checkout@v3
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v3
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install pylint
- - name: Analysing the code with pylint
- run: |
- tmp=$(git ls-files *.py | xargs pylint | grep W0611 | wc -l)
- if [[ $tmp -gt 0 ]]; then
- echo "Found $tmp occurrence of unused Python import statements!"
- exit 1
- fi
- exit 0
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: 3.11
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pylint
+ - name: Analysing the code with pylint
+ run: make unused-imports
diff --git a/Makefile b/Makefile
index 0868025ae..432de7547 100644
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,8 @@ SHIM_DIR := src/shim
LIBS := -lzmq
CFLAGS :=
BUILD_ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH)
-
J2LINT := $(shell command -v j2lint 2> /dev/null)
+PYLINT_FILES := $(shell git ls-files *.py)
config_xml_src = $(wildcard interface-definitions/*.xml.in)
config_xml_obj = $(config_xml_src:.xml.in=.xml)
@@ -114,7 +114,7 @@ sonar:
.PHONY: unused-imports
unused-imports:
- git ls-files *.py | xargs pylint | grep W0611
+ @pylint --disable=all --enable=W0611 $(PYLINT_FILES)
deb:
dpkg-buildpackage -uc -us -tc -b