Skip to content

Commit 01ba20e

Browse files
committed
chore: update .gitignore and pre-commit configuration; refactor CLI argument handling
- Added 'megalinter-reports/' to .gitignore to exclude MegaLinter report files. - Configured a new pre-push hook for MegaLinter using Docker to ensure code quality checks before pushing. - Refactored CLI command functions in cli.py to use a placeholder for unused arguments, improving code clarity. - Adjusted test discovery path in __main__.py for consistency. - Added pylint disable comments for import positioning in test files to address linting issues. These changes enhance the development workflow and maintain code quality standards.
1 parent e208150 commit 01ba20e

6 files changed

Lines changed: 16 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ chezmoi
88
*.swp
99
*.log
1010
.claude
11+
12+
megalinter-reports/

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ repos:
2424
- id: gitleaks
2525
args: [--verbose]
2626
stages: [pre-push]
27+
# MegaLinter via Docker (same as GitHub Actions), pre-push only
28+
- repo: local
29+
hooks:
30+
- id: megalinter
31+
name: MegaLinter
32+
entry: bash -c 'docker run --rm -v "${PWD}:/tmp/lint" -w /tmp/lint -e DEFAULT_WORKSPACE=/tmp/lint oxsecurity/megalinter:v7'
33+
language: system
34+
pass_filenames: false
35+
stages: [pre-push]

home/linux-kernel-tracker/kernel_tracker/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def cmd_log(args: argparse.Namespace, db_path: Path) -> int:
3838
return 0
3939

4040

41-
def cmd_current(args: argparse.Namespace, db_path: Path) -> int:
41+
def cmd_current(_args: argparse.Namespace, db_path: Path) -> int:
4242
conn = db.get_connection(db_path)
4343
try:
4444
last = db.get_last(conn)
@@ -50,7 +50,7 @@ def cmd_current(args: argparse.Namespace, db_path: Path) -> int:
5050
return 0
5151

5252

53-
def cmd_compare(args: argparse.Namespace, db_path: Path) -> int:
53+
def cmd_compare(_args: argparse.Namespace, db_path: Path) -> int:
5454
current = kernel.get_current_version()
5555
conn = db.get_connection(db_path)
5656
try:

home/linux-kernel-tracker/tests/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
99

1010
loader = unittest.TestLoader()
11-
suite = loader.discover(Path(__file__).resolve().parent, pattern="test_*.py")
11+
suite = loader.discover(str(Path(__file__).resolve().parent), pattern="test_*.py")
1212
runner = unittest.runner.TextTestRunner(verbosity=2)
1313
sys.exit(0 if runner.run(suite).wasSuccessful() else 1)

home/linux-kernel-tracker/tests/test_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
1010

11-
from kernel_tracker import db # noqa: E402
11+
from kernel_tracker import db # noqa: E402 # pylint: disable=wrong-import-position
1212

1313

1414
class TestGetDbPath(unittest.TestCase):

home/linux-kernel-tracker/tests/test_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
88

9-
from kernel_tracker import kernel # noqa: E402
9+
from kernel_tracker import kernel # noqa: E402 # pylint: disable=wrong-import-position
1010

1111

1212
class TestKernel(unittest.TestCase):

0 commit comments

Comments
 (0)