Skip to content

Commit 8359295

Browse files
authored
Introduced Linting (#3)
1 parent e965163 commit 8359295

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude = .git,__pycache__,venv

.github/workflows/pipeline.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,46 @@ on:
66
- '*'
77

88
jobs:
9+
lint:
10+
name: Python Linux (flake8)
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install Dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install flake8
26+
27+
- name: Run Lint
28+
run: flake8 --verbose --color auto --count --statistics --format=json --output-file=flake8-report.json || echo "::set-output name=flake8_failed::true"
29+
continue-on-error: true
30+
31+
- name: Upload Report
32+
if: ${{ always() }}
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: flake8-report
36+
path: flake8-report.json
37+
938
build_and_test:
39+
name: Build and Test
1040
runs-on: ubuntu-latest
41+
needs: lint
1142

1243
steps:
1344
- name: Checkout Repository
14-
uses: actions/checkout@v2
45+
uses: actions/checkout@v4
1546

1647
- name: Setup Python
17-
uses: actions/setup-python@v2
48+
uses: actions/setup-python@v5
1849
with:
1950
python-version: '3.10'
2051

pyconfigurationmanager/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
]
2929
__author__ = "coldsofttech"
3030
__description__ = """
31-
The pyconfigurationmanager package provides a set of utilities for managing configuration settings in
32-
Python applications. It includes classes and functions for loading configuration data from files,
31+
The pyconfigurationmanager package provides a set of utilities for managing configuration settings in
32+
Python applications. It includes classes and functions for loading configuration data from files,
3333
auditing configuration changes, and ensuring secure access to configuration files.
3434
"""
3535
__name__ = "pyconfigurationmanager"
36-
__version__ = "0.1.0"
36+
__version__ = "0.1.1"
3737

3838
from pyconfigurationmanager.__main__ import ConfigurationManager, ConfigurationManagerError

tests/utilityclass.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ def delete_config(file_name: str) -> None:
4343
command = f'icacls "{file_name}" /inheritance:r /grant:r "%USERNAME%:F"'
4444
try:
4545
subprocess.run(command, shell=True, check=True)
46-
except subprocess.CalledProcessError as e:
46+
except subprocess.CalledProcessError:
4747
pass
4848

4949
try:
5050
os.remove(file_name)
51-
except (PermissionError, OSError, FileNotFoundError) as e:
51+
except (PermissionError, OSError, FileNotFoundError):
5252
pass
5353

5454
@staticmethod
@@ -78,10 +78,10 @@ def generate_config(file_name: str, limited_permissions: bool = True, invalid_js
7878
try:
7979
for command in commands:
8080
subprocess.run(command, shell=True, check=True)
81-
except subprocess.CalledProcessError as e:
81+
except subprocess.CalledProcessError:
8282
pass
8383
elif platform.system().lower() == 'linux':
8484
try:
8585
os.chmod(file_name, 0o400)
86-
except (PermissionError, OSError) as e:
86+
except (PermissionError, OSError):
8787
pass

0 commit comments

Comments
 (0)