Skip to content

Commit 4b66aa0

Browse files
Merge pull request #3 from ranas-mukminov/copilot/fix-compiler-and-runtime-errors
Fix black formatting and shellcheck errors in Python CLI and install script
2 parents 5648627 + a9aeeba commit 4b66aa0

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ __pycache__/
33
*.pyc
44
.molecule/
55
.cache/
6+
*.egg-info/
7+
.ansible/

cli/linux_hardener/cli.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Console entry point for the linux-harden CLI."""
2+
23
from __future__ import annotations
34

45
from pathlib import Path
@@ -10,7 +11,9 @@
1011
from .config_schema import CLIConfig, SUPPORTED_PROFILES, load_config
1112
from .runner import build_command, run_playbook
1213

13-
app = typer.Typer(add_completion=False, help="Automation-friendly Linux hardening wrapper")
14+
app = typer.Typer(
15+
add_completion=False, help="Automation-friendly Linux hardening wrapper"
16+
)
1417

1518

1619
def _resolve_config(
@@ -46,7 +49,9 @@ def main(
4649
"--profile",
4750
help="Profile to apply (workstation/server/hardened)",
4851
show_default=False,
49-
autocompletion=lambda incomplete: [p for p in SUPPORTED_PROFILES if p.startswith(incomplete)],
52+
autocompletion=lambda incomplete: [
53+
p for p in SUPPORTED_PROFILES if p.startswith(incomplete)
54+
],
5055
),
5156
inventory: Optional[str] = typer.Option(
5257
None,
@@ -60,7 +65,9 @@ def main(
6065
"-l",
6166
help="Host pattern to limit execution to",
6267
),
63-
check: bool = typer.Option(False, "--check", help="Run Ansible in check (dry-run) mode"),
68+
check: bool = typer.Option(
69+
False, "--check", help="Run Ansible in check (dry-run) mode"
70+
),
6471
extra_vars: Optional[Path] = typer.Option(
6572
None,
6673
"--extra-vars",

cli/linux_hardener/config_schema.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Configuration loader and validation helpers for linux-harden."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass
@@ -39,7 +40,10 @@ class CLIConfig:
3940
extra_vars: Optional[str] = None
4041

4142
def merge(self, overrides: Dict[str, Any]) -> "CLIConfig":
42-
data = {**self.__dict__, **{k: v for k, v in overrides.items() if v is not None}}
43+
data = {
44+
**self.__dict__,
45+
**{k: v for k, v in overrides.items() if v is not None},
46+
}
4347
return CLIConfig(**data)
4448

4549

cli/linux_hardener/runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utilities to construct and run ansible-playbook commands."""
2+
23
from __future__ import annotations
34

45
import shlex

scripts/install.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
55
VENV_PATH="${ROOT_DIR}/.venv"
66

77
python3 -m venv "${VENV_PATH}"
8-
# shellcheck disable=SC1090
8+
# shellcheck disable=SC1091
99
source "${VENV_PATH}/bin/activate"
1010

1111
pip install --upgrade pip wheel
1212
pip install -e "${ROOT_DIR}/cli" \
13-
ansible>=8.7,<9.0 \
14-
molecule[docker]>=6.0 \
15-
ansible-lint>=24.2 \
13+
'ansible>=8.7,<9.0' \
14+
'molecule[docker]>=6.0' \
15+
'ansible-lint>=24.2' \
1616
yamllint \
1717
ruff \
1818
black \
1919
bandit \
20-
pytest pytest-mock \
21-
pip-audit
20+
'pytest pytest-mock' \
21+
pip-audit
2222

2323
ansible-galaxy collection install community.general ansible.posix
2424

0 commit comments

Comments
 (0)