From a076bbb6472857164722b74d6f3aff0f21fbc6fd Mon Sep 17 00:00:00 2001 From: Pavel Dat Date: Mon, 11 Sep 2023 22:28:20 +0300 Subject: [PATCH] Add pylint check Fix pylint issues --- .github/workflows/deploy-job.yml | 7 ++++++- .pylintrc | 3 +++ py-requirements.txt | 10 +++++----- src/nmap_scanner/nmap_scanner.py | 10 +++++----- src/phone_info/phone_info.py | 9 ++++++--- 5 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 .pylintrc diff --git a/.github/workflows/deploy-job.yml b/.github/workflows/deploy-job.yml index 7ac8264..9d41788 100644 --- a/.github/workflows/deploy-job.yml +++ b/.github/workflows/deploy-job.yml @@ -42,10 +42,15 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | - sudo apt install pycodestyle + python -m pip install --upgrade pip + sudo apt install pycodestyle pylint + pip install -r py-requirements.txt - name: Analysing the code with pycodestyle run: | pycodestyle src/**/*.py + - name: Analysing the code with pylint + run: | + pylint src/**/*.py deploy: runs-on: ubuntu-latest needs: test diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..c0391da --- /dev/null +++ b/.pylintrc @@ -0,0 +1,3 @@ +[MESSAGES CONTROL] +disable = C0413, W1203, W0703, R1710, R0903, R1732, + R0201, W1508, R0801 \ No newline at end of file diff --git a/py-requirements.txt b/py-requirements.txt index 9aa7c17..5411b3c 100644 --- a/py-requirements.txt +++ b/py-requirements.txt @@ -1,8 +1,8 @@ pathlib -dnspython +dnspython >= 2.2.1 requests -python-nmap +python-nmap >= 0.7.1 build -folium -opencage -phonenumbers +folium >= 0.14.0 +opencage >= 2.1.0 +phonenumbers >= 8.13.2 diff --git a/src/nmap_scanner/nmap_scanner.py b/src/nmap_scanner/nmap_scanner.py index ac7014b..ab00dfb 100644 --- a/src/nmap_scanner/nmap_scanner.py +++ b/src/nmap_scanner/nmap_scanner.py @@ -8,8 +8,8 @@ """ import sys -import nmap import logging +import nmap sys.path.insert( 0, @@ -73,10 +73,10 @@ def nmap_scanner(target: str, arguments: str = '', except KeyError: logger.raise_fatal(ValueError(f'Cannot scan {proto}')) - for port in lports: - state = nm_scan[host][proto][port]["state"] - logger.debug(f'Port: {port} State: {state}') - ports_state[port] = state + for port in lports: + state = nm_scan[host][proto][port]["state"] + logger.debug(f'Port: {port} State: {state}') + ports_state[port] = state return ports_state except Exception as ex: diff --git a/src/phone_info/phone_info.py b/src/phone_info/phone_info.py index 0fad332..0015548 100644 --- a/src/phone_info/phone_info.py +++ b/src/phone_info/phone_info.py @@ -8,11 +8,11 @@ """ import sys -import folium import logging -import opencage -import phonenumbers from pathlib import Path + +import folium +import phonenumbers from phonenumbers import geocoder, carrier from opencage.geocoder import OpenCageGeocode @@ -47,6 +47,9 @@ def __init__(self, @property def number(self) -> str: + """ + Property number method. + """ return self.__number @number.setter