repoguard-tool 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- repoguard_tool-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- repoguard_tool-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- repoguard_tool-0.1.0/.github/pull_request_template.md +21 -0
- repoguard_tool-0.1.0/.github/workflows/ci.yml +42 -0
- repoguard_tool-0.1.0/.github/workflows/pypi-publish.yml +33 -0
- repoguard_tool-0.1.0/.github/workflows/repoguard.yml +29 -0
- repoguard_tool-0.1.0/.gitignore +50 -0
- repoguard_tool-0.1.0/CHANGELOG.md +43 -0
- repoguard_tool-0.1.0/CODE_OF_CONDUCT.md +55 -0
- repoguard_tool-0.1.0/CONTRIBUTING.md +55 -0
- repoguard_tool-0.1.0/LICENSE +21 -0
- repoguard_tool-0.1.0/PKG-INFO +204 -0
- repoguard_tool-0.1.0/README.md +169 -0
- repoguard_tool-0.1.0/SECURITY.md +38 -0
- repoguard_tool-0.1.0/action.yml +152 -0
- repoguard_tool-0.1.0/docs/analyzers.md +64 -0
- repoguard_tool-0.1.0/docs/architecture.md +53 -0
- repoguard_tool-0.1.0/docs/configuration.md +68 -0
- repoguard_tool-0.1.0/docs/github-actions.md +60 -0
- repoguard_tool-0.1.0/docs/installation.md +57 -0
- repoguard_tool-0.1.0/docs/plugins.md +62 -0
- repoguard_tool-0.1.0/docs/scoring.md +50 -0
- repoguard_tool-0.1.0/examples/custom_plugin/README.md +131 -0
- repoguard_tool-0.1.0/examples/custom_plugin/pyproject.toml +21 -0
- repoguard_tool-0.1.0/examples/custom_plugin/repoguard_docker_analyzer/__init__.py +5 -0
- repoguard_tool-0.1.0/examples/custom_plugin/repoguard_docker_analyzer/analyzer.py +98 -0
- repoguard_tool-0.1.0/pyproject.toml +87 -0
- repoguard_tool-0.1.0/repoguard/__init__.py +11 -0
- repoguard_tool-0.1.0/repoguard/analyzers/__init__.py +28 -0
- repoguard_tool-0.1.0/repoguard/analyzers/cicd.py +154 -0
- repoguard_tool-0.1.0/repoguard/analyzers/code_quality.py +198 -0
- repoguard_tool-0.1.0/repoguard/analyzers/dependencies.py +286 -0
- repoguard_tool-0.1.0/repoguard/analyzers/documentation.py +206 -0
- repoguard_tool-0.1.0/repoguard/analyzers/security.py +454 -0
- repoguard_tool-0.1.0/repoguard/analyzers/testing.py +226 -0
- repoguard_tool-0.1.0/repoguard/cli.py +312 -0
- repoguard_tool-0.1.0/repoguard/config.py +153 -0
- repoguard_tool-0.1.0/repoguard/core/__init__.py +1 -0
- repoguard_tool-0.1.0/repoguard/core/context.py +201 -0
- repoguard_tool-0.1.0/repoguard/core/findings.py +109 -0
- repoguard_tool-0.1.0/repoguard/core/registry.py +83 -0
- repoguard_tool-0.1.0/repoguard/core/scanner.py +207 -0
- repoguard_tool-0.1.0/repoguard/core/scoring.py +173 -0
- repoguard_tool-0.1.0/repoguard/plugins/__init__.py +15 -0
- repoguard_tool-0.1.0/repoguard/plugins/base.py +40 -0
- repoguard_tool-0.1.0/repoguard/plugins/discovery.py +103 -0
- repoguard_tool-0.1.0/repoguard/plugins/manager.py +32 -0
- repoguard_tool-0.1.0/repoguard/reporters/__init__.py +9 -0
- repoguard_tool-0.1.0/repoguard/reporters/json_reporter.py +30 -0
- repoguard_tool-0.1.0/repoguard/reporters/markdown.py +144 -0
- repoguard_tool-0.1.0/repoguard/reporters/terminal.py +134 -0
- repoguard_tool-0.1.0/repoguard/utils/__init__.py +1 -0
- repoguard_tool-0.1.0/repoguard/utils/filesystem.py +133 -0
- repoguard_tool-0.1.0/repoguard/utils/versioning.py +49 -0
- repoguard_tool-0.1.0/tests/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/analyzers/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/analyzers/test_cicd.py +88 -0
- repoguard_tool-0.1.0/tests/analyzers/test_code_quality.py +94 -0
- repoguard_tool-0.1.0/tests/analyzers/test_dependencies.py +139 -0
- repoguard_tool-0.1.0/tests/analyzers/test_documentation.py +86 -0
- repoguard_tool-0.1.0/tests/analyzers/test_security.py +290 -0
- repoguard_tool-0.1.0/tests/analyzers/test_testing.py +87 -0
- repoguard_tool-0.1.0/tests/conftest.py +53 -0
- repoguard_tool-0.1.0/tests/core/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/core/test_context.py +83 -0
- repoguard_tool-0.1.0/tests/core/test_findings.py +97 -0
- repoguard_tool-0.1.0/tests/core/test_registry.py +91 -0
- repoguard_tool-0.1.0/tests/core/test_scanner.py +116 -0
- repoguard_tool-0.1.0/tests/core/test_scoring.py +169 -0
- repoguard_tool-0.1.0/tests/integration/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/integration/test_github_action.py +44 -0
- repoguard_tool-0.1.0/tests/plugins/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/plugins/test_discovery.py +92 -0
- repoguard_tool-0.1.0/tests/plugins/test_example_plugin.py +68 -0
- repoguard_tool-0.1.0/tests/reporters/__init__.py +1 -0
- repoguard_tool-0.1.0/tests/reporters/test_json_reporter.py +61 -0
- repoguard_tool-0.1.0/tests/reporters/test_markdown_reporter.py +48 -0
- repoguard_tool-0.1.0/tests/reporters/test_terminal_reporter.py +54 -0
- repoguard_tool-0.1.0/tests/test_cli.py +105 -0
- repoguard_tool-0.1.0/tests/test_config.py +82 -0
- repoguard_tool-0.1.0/tests/test_filesystem.py +80 -0
- repoguard_tool-0.1.0/tests/test_versioning.py +46 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve RepoGuard
|
|
4
|
+
title: '[BUG] '
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Describe the Bug**
|
|
10
|
+
A clear and concise description of what the bug is.
|
|
11
|
+
|
|
12
|
+
**To Reproduce**
|
|
13
|
+
Steps to reproduce the behavior:
|
|
14
|
+
1. Command executed: `repoguard scan ...`
|
|
15
|
+
2. Configuration file used: (if any)
|
|
16
|
+
3. See error:
|
|
17
|
+
|
|
18
|
+
**Expected Behavior**
|
|
19
|
+
A clear and concise description of what you expected to happen.
|
|
20
|
+
|
|
21
|
+
**Environment:**
|
|
22
|
+
- RepoGuard Version: [e.g. 0.1.0]
|
|
23
|
+
- Python Version: [e.g. 3.11.8]
|
|
24
|
+
- OS: [e.g. macOS, Ubuntu 22.04]
|
|
25
|
+
|
|
26
|
+
**Additional Context**
|
|
27
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest an idea or analyzer for RepoGuard
|
|
4
|
+
title: '[FEATURE] '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Is your feature request related to a problem? Please describe.**
|
|
10
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
11
|
+
|
|
12
|
+
**Describe the Solution You'd Like**
|
|
13
|
+
A clear and concise description of what you want to happen.
|
|
14
|
+
|
|
15
|
+
**Describe Alternatives You've Considered**
|
|
16
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
17
|
+
|
|
18
|
+
**Additional Context**
|
|
19
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
Please include a summary of the change and which issue it fixes.
|
|
4
|
+
|
|
5
|
+
Fixes #(issue)
|
|
6
|
+
|
|
7
|
+
## Type of Change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
10
|
+
- [ ] New feature (non-breaking change which adds an analyzer or capability)
|
|
11
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
12
|
+
- [ ] Documentation update
|
|
13
|
+
|
|
14
|
+
## Checklist
|
|
15
|
+
|
|
16
|
+
- [ ] My code follows the style guidelines of this project (`ruff check .` passes)
|
|
17
|
+
- [ ] I have performed a self-review of my own code
|
|
18
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
19
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
|
20
|
+
- [ ] New and existing unit tests pass locally with my changes (`pytest`)
|
|
21
|
+
- [ ] Documentation has been updated accordingly
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Lint & Test
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout repository
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install -e ".[dev]"
|
|
33
|
+
pip install -e examples/custom_plugin
|
|
34
|
+
|
|
35
|
+
- name: Run Ruff Lint & Format Check
|
|
36
|
+
run: |
|
|
37
|
+
ruff check .
|
|
38
|
+
ruff format --check .
|
|
39
|
+
|
|
40
|
+
- name: Run Pytest Test Suite
|
|
41
|
+
run: |
|
|
42
|
+
pytest -v
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
name: Publish RepoGuard to PyPI
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
name: Build and publish package
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
|
|
26
|
+
- name: Install build tools
|
|
27
|
+
run: python -m pip install --upgrade build
|
|
28
|
+
|
|
29
|
+
- name: Build package
|
|
30
|
+
run: python -m build
|
|
31
|
+
|
|
32
|
+
- name: Publish to PyPI
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: RepoGuard Health Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
repoguard:
|
|
15
|
+
name: RepoGuard Scan
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout Code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Execute RepoGuard Health Scan
|
|
23
|
+
uses: ./
|
|
24
|
+
with:
|
|
25
|
+
min-score: "70"
|
|
26
|
+
fail-on: "critical"
|
|
27
|
+
no-network: "false"
|
|
28
|
+
output-json: "repoguard-report.json"
|
|
29
|
+
output-markdown: "repoguard-summary.md"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# Virtual environments
|
|
30
|
+
.venv/
|
|
31
|
+
venv/
|
|
32
|
+
ENV/
|
|
33
|
+
env/
|
|
34
|
+
|
|
35
|
+
# Testing & Linting
|
|
36
|
+
.pytest_cache/
|
|
37
|
+
.ruff_cache/
|
|
38
|
+
.coverage
|
|
39
|
+
htmlcov/
|
|
40
|
+
.mypy_cache/
|
|
41
|
+
|
|
42
|
+
# Scan report outputs
|
|
43
|
+
*.report.json
|
|
44
|
+
report.json
|
|
45
|
+
repoguard-report.json
|
|
46
|
+
repoguard-summary.md
|
|
47
|
+
|
|
48
|
+
# OS artifacts
|
|
49
|
+
.DS_Store
|
|
50
|
+
Thumbs.db
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to RepoGuard will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-11-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Core Scanning Engine**:
|
|
14
|
+
- `RepoScanner` with error-isolated analyzer execution.
|
|
15
|
+
- Deterministic finding deduplication via content-based SHA-256 fingerprinting.
|
|
16
|
+
- Safe repository context (`ScanContext`) with traversal protection and file size caps.
|
|
17
|
+
- **Built-in Analyzers**:
|
|
18
|
+
- `DocumentationAnalyzer`: README existence, installation/usage sections, LICENSE, CONTRIBUTING.
|
|
19
|
+
- `DependencyAnalyzer`: unpinned dependencies, OSV API CVE/GHSA scanning, registry version checks.
|
|
20
|
+
- `SecurityAnalyzer`: secret detection (AWS keys, GitHub tokens, Slack webhooks, private keys), dangerous calls (`shell=True`, `eval`), secret masking.
|
|
21
|
+
- `TestingAnalyzer`: test directory detection, framework identification, CI test step verification.
|
|
22
|
+
- `CodeQualityAnalyzer`: Python AST cyclomatic complexity, parameter counts, function length, wildcard imports.
|
|
23
|
+
- `CiCdAnalyzer`: GitHub workflow validation, permissions auditing (`write-all`), mutable branch pinning.
|
|
24
|
+
- **Health Scoring Engine**:
|
|
25
|
+
- Transparent 0-100 scoring with letter grades (`A` to `F`).
|
|
26
|
+
- Configurable category weights and severity deductions.
|
|
27
|
+
- Category breakdown and explicit reporting of unavailable checks.
|
|
28
|
+
- **Multi-Format Reporting**:
|
|
29
|
+
- Interactive Rich terminal report with styled tables and panels.
|
|
30
|
+
- Machine-readable JSON output conforming to documented schema.
|
|
31
|
+
- GitHub-Flavored Markdown report with Shields.io badges.
|
|
32
|
+
- **Extensible Plugin System**:
|
|
33
|
+
- `BaseAnalyzer` standard interface.
|
|
34
|
+
- Dynamic discovery via Python entry points (`repoguard.plugins`).
|
|
35
|
+
- Example Docker security plugin in `examples/custom_plugin/`.
|
|
36
|
+
- **CI/CD Integration**:
|
|
37
|
+
- Reusable composite GitHub Action (`action.yml`).
|
|
38
|
+
- Automated step summary, PR annotations, and report artifact uploads.
|
|
39
|
+
- **CLI Commands**:
|
|
40
|
+
- `repoguard scan [PATH]`
|
|
41
|
+
- `repoguard version`
|
|
42
|
+
- `repoguard config init`
|
|
43
|
+
- `repoguard plugins list` & `repoguard plugins info`
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
49
|
+
an individual is officially representing the community in public spaces.
|
|
50
|
+
|
|
51
|
+
## Enforcement
|
|
52
|
+
|
|
53
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
54
|
+
reported to the project team at security@repoguard.dev. All complaints will be
|
|
55
|
+
reviewed and investigated promptly and fairly.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Contributing to RepoGuard
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to RepoGuard!
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Code of Conduct
|
|
8
|
+
|
|
9
|
+
All contributors and participants agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Development Setup
|
|
14
|
+
|
|
15
|
+
1. Fork and clone the repository:
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/<your-username>/repoguard.git
|
|
18
|
+
cd repoguard
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Create and activate a virtual environment (Python 3.11+):
|
|
22
|
+
```bash
|
|
23
|
+
python -m venv .venv
|
|
24
|
+
source .venv/bin/activate
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. Install RepoGuard and development dependencies in editable mode:
|
|
28
|
+
```bash
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
pip install -e examples/custom_plugin
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Running Quality Checks
|
|
36
|
+
|
|
37
|
+
Before submitting a pull request, ensure tests and linting pass cleanly:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Run automated tests
|
|
41
|
+
pytest -v
|
|
42
|
+
|
|
43
|
+
# Run Ruff linter and formatter
|
|
44
|
+
ruff check .
|
|
45
|
+
ruff format --check .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Pull Request Guidelines
|
|
51
|
+
|
|
52
|
+
1. Create a descriptive feature branch (`git checkout -b feature/my-new-analyzer`).
|
|
53
|
+
2. Include comprehensive unit tests for any new features or bug fixes.
|
|
54
|
+
3. Keep commits atomic and use conventional commit messages (e.g., `feat:`, `fix:`, `docs:`).
|
|
55
|
+
4. Update relevant documentation in `docs/` or `README.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RepoGuard Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: repoguard-tool
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Analyze. Detect. Improve. Open-Source Repository Health Analyzer
|
|
5
|
+
Author: RepoGuard Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: code-health,developer-tooling,github-actions,repository-analyzer,security-scanner
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Topic :: Software Development :: Testing
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: gitpython>=3.1.40
|
|
25
|
+
Requires-Dist: pydantic>=2.7.0
|
|
26
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
27
|
+
Requires-Dist: requests>=2.31.0
|
|
28
|
+
Requires-Dist: rich>=13.7.0
|
|
29
|
+
Requires-Dist: typer>=0.12.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# 🛡️ RepoGuard
|
|
37
|
+
|
|
38
|
+
> **Analyze. Detect. Improve.**
|
|
39
|
+
|
|
40
|
+
RepoGuard is an extensible, open-source repository health analyzer built for software engineers, open-source maintainers, and CI/CD pipelines.
|
|
41
|
+
|
|
42
|
+
RepoGuard scans codebases to evaluate documentation completeness, dependency security and freshness, exposed secrets, code maintainability, test coverage indicators, and CI/CD workflow security — calculating a transparent, deterministic health score from 0 to 100 with actionable remediation guidance.
|
|
43
|
+
|
|
44
|
+
[](https://github.com/repoguard/repoguard/actions/workflows/ci.yml)
|
|
45
|
+
[](https://www.python.org/downloads/)
|
|
46
|
+
[](https://opensource.org/licenses/MIT)
|
|
47
|
+
[](https://github.com/astral-sh/ruff)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Key Features
|
|
52
|
+
|
|
53
|
+
- 🔍 **Comprehensive Static Analysis**: 6 independent built-in analyzers covering Documentation, Dependencies, Security, Testing, Code Quality, and CI/CD.
|
|
54
|
+
- 🔒 **Security Invariants**: Never executes repository code; masks all detected secrets; prevents path traversal; supports offline scanning (`--no-network`).
|
|
55
|
+
- 📊 **Transparent Health Scoring Engine**: 0–100 health score with letter grades (`A`–`F`), category breakdown, and zero double-counting.
|
|
56
|
+
- 🔌 **Extensible Plugin Architecture**: Build independent custom analyzers using Python entry points (`repoguard.plugins`). Plugin crashes are isolated without stopping scans.
|
|
57
|
+
- 🤖 **GitHub Actions Integration**: Native reusable GitHub Action (`action.yml`) with Step Summary tables, PR annotations, and report artifact uploads.
|
|
58
|
+
- 📄 **Multi-Format Reporting**: Interactive Rich terminal reports, machine-readable JSON schemas, and GitHub-Flavored Markdown.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Built-in Analyzers
|
|
63
|
+
|
|
64
|
+
| Category | Analyzer | What it Checks |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| **Documentation** | `documentation` | README presence, installation/usage instructions, LICENSE, CONTRIBUTING |
|
|
67
|
+
| **Dependencies** | `dependencies` | Unpinned versions, OSV API CVE/GHSA scanning, registry version checks |
|
|
68
|
+
| **Security** | `security` | AWS keys, GitHub tokens, Slack webhooks, private keys, `shell=True`, `eval()`, committed `.env` files |
|
|
69
|
+
| **Testing** | `testing` | Test directories, testing frameworks, CI automated test execution |
|
|
70
|
+
| **Code Quality** | `code_quality` | AST cyclomatic complexity, function length, parameter counts, wildcard imports |
|
|
71
|
+
| **CI/CD** | `cicd` | GitHub workflow presence, `permissions: write-all` auditing, mutable branch pinning (`@main`) |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
Requires **Python 3.11+**.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install repoguard-tool
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or using `pipx` for isolated CLI execution:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pipx install repoguard-tool
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Quick Start
|
|
92
|
+
|
|
93
|
+
### 1. Scan a Repository
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Interactive terminal scan
|
|
97
|
+
repoguard scan .
|
|
98
|
+
|
|
99
|
+
# Generate JSON report
|
|
100
|
+
repoguard scan . --format json
|
|
101
|
+
|
|
102
|
+
# Generate Markdown report
|
|
103
|
+
repoguard scan . --format markdown --output report.md
|
|
104
|
+
|
|
105
|
+
# Offline scan (no external network lookups)
|
|
106
|
+
repoguard scan . --no-network
|
|
107
|
+
|
|
108
|
+
# Enforce quality gates (exit with code 1 if thresholds exceeded)
|
|
109
|
+
repoguard scan . --min-score 75 --fail-on high
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. Inspect Installed Plugins
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
repoguard plugins list
|
|
116
|
+
repoguard plugins info docker
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. Initialize Configuration File
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
repoguard config init
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This generates a `.repoguard.yml` file with default scoring weights and thresholds.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Health Scoring Methodology
|
|
130
|
+
|
|
131
|
+
RepoGuard calculates a deterministic score from 0 to 100 based on configured category weights:
|
|
132
|
+
|
|
133
|
+
- **Security**: 25%
|
|
134
|
+
- **Code Quality**: 25%
|
|
135
|
+
- **Documentation**: 15%
|
|
136
|
+
- **Dependencies**: 15%
|
|
137
|
+
- **Testing**: 10%
|
|
138
|
+
- **CI/CD**: 10%
|
|
139
|
+
|
|
140
|
+
Each category begins at **100 points**. Penalties are deducted based on unique finding severities:
|
|
141
|
+
- **Critical**: -25 pts
|
|
142
|
+
- **High**: -15 pts
|
|
143
|
+
- **Medium**: -8 pts
|
|
144
|
+
- **Low**: -3 pts
|
|
145
|
+
- **Info**: 0 pts
|
|
146
|
+
|
|
147
|
+
Scores are clamped to `[0, 100]` and mapped to grades (`A`: >=90, `B`: 80–89, `C`: 70–79, `D`: 60–69, `F`: <60).
|
|
148
|
+
|
|
149
|
+
> **Disclaimer**: The RepoGuard Health Score is an automated project-maintenance indicator. It is **NOT** a guarantee or warranty of security.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## GitHub Actions CI/CD Integration
|
|
154
|
+
|
|
155
|
+
Add RepoGuard to your GitHub repository by creating `.github/workflows/repoguard.yml`:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
name: RepoGuard Health Scan
|
|
159
|
+
|
|
160
|
+
on:
|
|
161
|
+
push:
|
|
162
|
+
branches: [main]
|
|
163
|
+
pull_request:
|
|
164
|
+
branches: [main]
|
|
165
|
+
|
|
166
|
+
permissions:
|
|
167
|
+
contents: read
|
|
168
|
+
pull-requests: write
|
|
169
|
+
|
|
170
|
+
jobs:
|
|
171
|
+
scan:
|
|
172
|
+
runs-on: ubuntu-latest
|
|
173
|
+
steps:
|
|
174
|
+
- uses: actions/checkout@v4
|
|
175
|
+
- uses: repoguard/repoguard@v1
|
|
176
|
+
with:
|
|
177
|
+
min-score: "70"
|
|
178
|
+
fail-on: "high"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Documentation
|
|
184
|
+
|
|
185
|
+
- [Installation Guide](docs/installation.md)
|
|
186
|
+
- [Architecture & Design](docs/architecture.md)
|
|
187
|
+
- [Analyzers Reference](docs/analyzers.md)
|
|
188
|
+
- [Plugin Development Guide](docs/plugins.md)
|
|
189
|
+
- [GitHub Actions Integration](docs/github-actions.md)
|
|
190
|
+
- [Configuration Reference](docs/configuration.md)
|
|
191
|
+
- [Health Scoring Engine](docs/scoring.md)
|
|
192
|
+
- [Example Plugin](examples/custom_plugin/README.md)
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Contributions are warmly welcomed! Please read our [Contributing Guidelines](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
RepoGuard is licensed under the [MIT License](LICENSE).
|