From 0572c2f494535d852804d4e36faac5489ba10808 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Thu, 8 Sep 2022 10:01:23 +0200 Subject: [PATCH 1/3] Update Makefile - Use python from venv --- Makefile | 9 +++++++++ makefile | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 Makefile delete mode 100644 makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4cb4ed6 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.PHONY: lint test coverage + +lint: + python -m pylint check_http_json.py +test: + python -m unittest discover +coverage: + python -m coverage run -m unittest discover + python -m coverage report -m --include check_http_json.py diff --git a/makefile b/makefile deleted file mode 100644 index 3f3e98b..0000000 --- a/makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: lint test coverage - -lint: - python3 -m pylint check_http_json.py -test: - python3 -m unittest discover -coverage: - python3 -m coverage run -m unittest discover - python3 -m coverage report -m --include check_http_json.py From ffd96dd59fc904bd6c720e321593640fdf3deedb Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Thu, 8 Sep 2022 10:04:20 +0200 Subject: [PATCH 2/3] Update GitHub Workflow --- .github/workflows/unittest.yml | 15 +++++++-------- requirements-dev.txt | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 requirements-dev.txt diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 015cf1a..b2f65eb 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -7,21 +7,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.8, 3,9] name: GitHub Action steps: - name: Checkout uses: actions/checkout@v2 + - name: Install dependencies + run: | + python -m pip install -r requirements-dev.txt - name: Lint run: | - pip3 install --upgrade pip wheel setuptools - pip3 install pylint - python3 -m pylint check_http_json.py + make lint - name: Unit Test run: | - python3 -m unittest discover + make test - name: Coverage run: | - pip3 install coverage - python3 -m coverage run -m unittest discover - python3 -m coverage report -m --include check_http_json.py + make coverage diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..e84cd4e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +coverage==6.4.4 +pylint==2.15.2 From c54a0040a02da69aa5bd60d5d77884d52184b9ac Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Thu, 8 Sep 2022 10:08:39 +0200 Subject: [PATCH 3/3] Update pylint config --- .pylintrc | 20 ++++++++++++++++++-- check_http_json.py | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index af49c4f..703973b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,5 +1,21 @@ # pylint config -[MESSAGES CONTROL] -disable=line-too-long, redefined-outer-name, too-many-arguments, too-many-instance-attributes, fixme, invalid-name, superfluous-parens, missing-function-docstring, missing-module-docstring, multiple-imports, no-else-return, too-many-return-statements, too-many-branches, too-many-statements [MASTER] ignore-patterns=^test.* + +[MESSAGES CONTROL] +disable=fixme, + consider-using-f-string, + invalid-name, + line-too-long, + missing-function-docstring, + missing-module-docstring, + multiple-imports, + no-else-return, + redefined-outer-name, + superfluous-parens, + too-many-locals, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-return-statements, + too-many-statements diff --git a/check_http_json.py b/check_http_json.py index 092871b..67defed 100755 --- a/check_http_json.py +++ b/check_http_json.py @@ -609,6 +609,7 @@ def main(cliargs): databytes = str(args.data).encode() response = urllib.request.urlopen(req, data=databytes, context=context) else: + # pylint: disable=consider-using-with response = urllib.request.urlopen(req, context=context) json_data = response.read()