Skip to content

Introduced Linting #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
exclude = .git,__pycache__,venv
35 changes: 33 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,46 @@ on:
- '*'

jobs:
lint:
name: Python Linux (flake8)
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Run Lint
run: flake8 --verbose --color auto --count --statistics --format=json --output-file=flake8-report.json || echo "::set-output name=flake8_failed::true"
continue-on-error: true

- name: Upload Report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: flake8-report
path: flake8-report.json

build_and_test:
name: Build and Test
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
6 changes: 3 additions & 3 deletions pyconfigurationmanager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
]
__author__ = "coldsofttech"
__description__ = """
The pyconfigurationmanager package provides a set of utilities for managing configuration settings in
Python applications. It includes classes and functions for loading configuration data from files,
The pyconfigurationmanager package provides a set of utilities for managing configuration settings in
Python applications. It includes classes and functions for loading configuration data from files,
auditing configuration changes, and ensuring secure access to configuration files.
"""
__name__ = "pyconfigurationmanager"
__version__ = "0.1.0"
__version__ = "0.1.1"

from pyconfigurationmanager.__main__ import ConfigurationManager, ConfigurationManagerError
8 changes: 4 additions & 4 deletions tests/utilityclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def delete_config(file_name: str) -> None:
command = f'icacls "{file_name}" /inheritance:r /grant:r "%USERNAME%:F"'
try:
subprocess.run(command, shell=True, check=True)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
pass

try:
os.remove(file_name)
except (PermissionError, OSError, FileNotFoundError) as e:
except (PermissionError, OSError, FileNotFoundError):
pass

@staticmethod
Expand Down Expand Up @@ -78,10 +78,10 @@ def generate_config(file_name: str, limited_permissions: bool = True, invalid_js
try:
for command in commands:
subprocess.run(command, shell=True, check=True)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
pass
elif platform.system().lower() == 'linux':
try:
os.chmod(file_name, 0o400)
except (PermissionError, OSError) as e:
except (PermissionError, OSError):
pass