Skip to content

Commit 7f5559e

Browse files
Restructure, modernize project structure and CI workflows (#253)
* Add general and Python Makefile workflow standards Introduces general coding standards and a detailed Makefile-based workflow for Python projects using Poetry. Removes the old makefile-workflow rules in favor of more comprehensive and language-agnostic documentation. * Move test files to top-level tests directory Renamed all test files from ssllabsscan/tests/ to tests/ to simplify the project structure. No functional changes were made to the test code. * Add project governance and remove Jekyll config Added CODEOWNERS, CODE_OF_CONDUCT.md, CONTRIBUTING.md, and SECURITY.md to establish project governance, contribution guidelines, and security policies. Removed _config.yml, indicating the project no longer uses the Jekyll theme configuration. * Add GitHub issue templates and update CI workflows Introduces GitHub issue templates for bug reports and feature requests, and updates the config for issue templates. Refactors and renames the main CI workflow to 'ci.yml', adds concurrency controls, and improves linting and testing steps. Adds a Snyk security workflow, updates the secrets scan workflow, and improves the stale issues workflow. Cleans up .gitignore and .dockerignore, and simplifies YAML linting configuration. * Revamp Makefile, update README, and add dev tools Refactored the Makefile for improved clarity, modularity, and expanded development workflows, including new targets for linting, formatting, and pre-commit checks. Updated the README with clearer installation, usage, and development instructions, added badges, and improved project documentation. Updated LICENSE copyright years. Added Black and related dev dependencies to pyproject.toml and poetry.lock. Updated test files to align with new structure and workflows. * Refactor codebase and tests, update to v4.1.0 Bump version to 4.1.0 and update CHANGELOG with new features and improvements. Refactor code for style consistency, improve formatting, and enhance test coverage. Update Makefile to lint and format both source and test directories. Move and clean up test files, modernize code style, and improve docstrings and comments throughout the codebase. * Add tests for exception handling and retry logic Expanded test coverage in test_main.py and test_ssllabs_client.py to include exception handling in main process, argument parsing, main entry point, and SSLLabsClient retry logic for API rate limits and error statuses. Also added tests for CSV summary skipping, debug and status message printing, and error handling scenarios. * Update changelog with new unit tests and coverage Added details about 15 new unit tests that improve code coverage from 83% to 91%, covering exception handling, CLI parsing, API retry logic, error status handling, endpoint filtering, print message variants, and requests_get implementation. * Potential fix for code scanning alert no. 10: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Refactor regex assertion formatting in test Improves readability of the regex assertion in test_ssl_labs_client_print_msg_failed_and_skipped by splitting it across multiple lines. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 958ee03 commit 7f5559e

39 files changed

+2265
-1318
lines changed

.codecov.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ coverage:
22
precision: 2
33
round: down
44
range: 70...100
5-
65
status:
76
project: true
87
patch: false
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
description: General coding standards (language-agnostic)
3+
globs: ["**/*"]
4+
alwaysApply: true
5+
---
6+
7+
# General Coding Standards
8+
9+
## Documentation & Instructions
10+
11+
- **Be concise** - Instructions, rules, and documentation should be brief and actionable
12+
- **Focus on essentials** - Include only what's necessary, remove verbose explanations
13+
14+
## File Formatting
15+
16+
- **End files with newline** - POSIX standard, required for Git diffs
17+
- **Use LF (`\n`) line endings** - Not CRLF (`\r\n`), except `.bat`/`.cmd` files
18+
- **No trailing whitespace** - Remove spaces/tabs at end of lines
19+
- **Consistent indentation** - Spaces or tabs, never mixed
20+
21+
## File Naming
22+
23+
- **Lowercase with hyphens** - `my-file.txt` not `My-File.txt`
24+
- **Be descriptive** - `user-authentication.py` not `auth.py`
25+
- **Avoid special characters** - Use only `a-z`, `0-9`, `-`, `_`, `.`
26+
27+
**Exceptions:**
28+
- Python: `snake_case.py`
29+
- JavaScript/TypeScript: `PascalCase.tsx`
30+
31+
## Git
32+
33+
**Commits:**
34+
- Atomic (one change per commit)
35+
- Present tense messages ("Add feature" not "Added feature")
36+
- Include issue numbers (`Fixes #123`)
37+
38+
**Never commit:**
39+
- ❌ Build artifacts (`dist/`, `build/`)
40+
- ❌ Dependencies (`node_modules/`, `.venv/`)
41+
- ❌ IDE files (`.vscode/`, `.idea/`)
42+
- ❌ OS files (`.DS_Store`, `Thumbs.db`)
43+
- ❌ Secrets or credentials
44+
45+
## Security
46+
47+
- **Never commit secrets** - Use environment variables
48+
- **Pin dependency versions** - Use exact versions
49+
- **Use secret scanners** - gitleaks, truffleHog
50+
- **Security scanning** - Snyk, Dependabot
51+
52+
## Before Committing
53+
54+
- [ ] Tests pass
55+
- [ ] No linter errors
56+
- [ ] No trailing whitespace
57+
- [ ] Newline at end of files
58+
- [ ] No debug code
59+
- [ ] Documentation updated

.cursor/rules/makefile-python.mdc

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
description: Makefile-based development workflow for Python projects using Poetry
3+
globs: ["Makefile", "pyproject.toml", "**/*.py"]
4+
alwaysApply: true
5+
---
6+
7+
# Python Project Development Workflow
8+
9+
## Available Makefile Targets
10+
11+
### Setup
12+
- `make setup-init` - Complete first-time setup (configure venv, lock, install all deps)
13+
- `make setup-venv` - Configure Poetry to use .venv in project directory
14+
15+
### Installation
16+
- `make install` - Install main dependencies only
17+
- `make install-dev` - Install main + dev dependencies
18+
- `make install-test` - Install main + test dependencies
19+
- `make install-all` - Install all dependencies (main + dev + test)
20+
21+
### Dependency Management
22+
- `make lock` - Regenerate poetry.lock from pyproject.toml
23+
- `make update-deps` - Update dependencies to latest compatible versions
24+
25+
### Testing
26+
- `make test` - Run unit tests without coverage
27+
- `make test-with-coverage` - Run unit tests with coverage reporting
28+
29+
### Code Quality
30+
- `make lint-python` - Lint Python code with flake8
31+
- `make lint-yaml` - Lint YAML files with yamllint
32+
- `make format-python` - Format Python code with black
33+
- `make pre-commit` - Run all quality checks (format, lint, test)
34+
35+
### Build
36+
- `make build` - Build the Python package
37+
38+
### Cleanup
39+
- `make clean` - Clean test artifacts, build artifacts and temporary files
40+
- `make clean-all` - Clean everything including virtual environment
41+
42+
### Help
43+
- `make help` - Show all available targets
44+
45+
## Project Setup
46+
47+
**Quick Start:**
48+
```bash
49+
make setup-init # Complete first-time setup
50+
make test-with-coverage # Verify installation
51+
```
52+
53+
## Python Environment
54+
- **Poetry** - Dependency management
55+
- **Python 3.11+** - Minimum version (supports 3.11, 3.12, 3.13)
56+
- **`.venv/`** - Virtual environment (project-local)
57+
- **Dependencies** in `pyproject.toml`:
58+
- Main: requests
59+
- Test: pytest, pytest-cov, pytest-mock, pytest-gitignore, coverage, mock, flake8
60+
- Dev: setuptools, wheel, yamllint, black
61+
62+
## Development Workflow
63+
64+
**Daily development:**
65+
```bash
66+
# 1. Make code changes
67+
# 2. Run all quality checks before committing
68+
make pre-commit # Format, lint, and test everything
69+
# Or run individual checks:
70+
make format-python # Auto-format
71+
make lint-python # Lint Python
72+
make lint-yaml # Lint YAML
73+
make test-with-coverage # Test with coverage
74+
make clean # Remove artifacts
75+
```
76+
77+
## Project Structure
78+
- Main package: `ssllabsscan/`
79+
- Tests: `tests/`
80+
- CLI entry point: `ssllabs-scan` (defined in pyproject.toml)
81+
- Configuration: `pyproject.toml`
82+
83+
## CLI Tool Usage
84+
After installation with `poetry install` or `pip install .`:
85+
```bash
86+
ssllabs-scan # Main CLI tool
87+
ssllabs-scan --help # Show help
88+
```

.cursor/rules/makefile-workflow.mdc

Lines changed: 0 additions & 49 deletions
This file was deleted.

.dockerignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# CI/CD
7+
.github
8+
9+
# Python
10+
__pycache__
11+
*.py[cod]
12+
*$py.class
13+
*.so
14+
*.egg-info
15+
.eggs/
16+
*.egg
17+
18+
# Testing
19+
.pytest_cache/
20+
.coverage
21+
.coverage.*
22+
htmlcov/
23+
junit*.xml
24+
coverage*.xml
25+
tests/
26+
27+
# Development tools
28+
.venv/
29+
.env
30+
31+
# Documentation
32+
*.md
33+
docs/
34+
35+
# IDE
36+
.vscode/
37+
.idea/
38+
*.swp
39+
*.swo
40+
41+
# Build artifacts
42+
build/
43+
dist/
44+
45+
# Project files
46+
Makefile
47+
CHANGELOG.md
48+
CODEOWNERS
49+
LICENSE
50+
CODE_OF_CONDUCT.md
51+
CONTRIBUTING.md
52+
SECURITY.md
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Bug Report
2+
description: Report a bug or unexpected behavior
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to report a bug!
10+
11+
- type: textarea
12+
id: description
13+
attributes:
14+
label: Bug Description
15+
description: A clear and concise description of what the bug is
16+
placeholder: What happened?
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: reproduction
22+
attributes:
23+
label: Steps to Reproduce
24+
description: Steps to reproduce the behavior
25+
placeholder: |
26+
1. Go to '...'
27+
2. Run command '...'
28+
3. See error
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: expected
34+
attributes:
35+
label: Expected Behavior
36+
description: What you expected to happen
37+
placeholder: What should have happened?
38+
validations:
39+
required: true
40+
41+
- type: textarea
42+
id: actual
43+
attributes:
44+
label: Actual Behavior
45+
description: What actually happened
46+
placeholder: What actually happened?
47+
validations:
48+
required: true
49+
50+
- type: textarea
51+
id: environment
52+
attributes:
53+
label: Environment
54+
description: Please provide your environment details
55+
placeholder: |
56+
- OS: [e.g., Ubuntu 22.04, Windows 11, macOS 13]
57+
- Python version: [e.g., 3.11.5]
58+
- Project version: [e.g., 1.0.0]
59+
value: |
60+
- OS:
61+
- Python version:
62+
- Project version:
63+
validations:
64+
required: true
65+
66+
- type: textarea
67+
id: logs
68+
attributes:
69+
label: Relevant Logs
70+
description: Please paste any relevant log output
71+
render: shell
72+
73+
- type: textarea
74+
id: additional
75+
attributes:
76+
label: Additional Context
77+
description: Add any other context about the problem here

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Question or Discussion
4+
url: https://github.com/kyhau/ssllabs-scan/discussions
5+
about: Ask questions or start discussions about the project
6+
- name: Security Vulnerability
7+
url: https://github.com/kyhau/ssllabs-scan/security/advisories/new
8+
about: Report security vulnerabilities privately
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Feature Request
2+
description: Suggest a new feature or enhancement
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for suggesting a new feature!
10+
11+
- type: textarea
12+
id: problem
13+
attributes:
14+
label: Problem Statement
15+
description: Is your feature request related to a problem? Please describe.
16+
placeholder: I'm always frustrated when...
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: solution
22+
attributes:
23+
label: Proposed Solution
24+
description: Describe the solution you'd like
25+
placeholder: I would like to see...
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
id: alternatives
31+
attributes:
32+
label: Alternatives Considered
33+
description: Describe any alternative solutions or features you've considered
34+
placeholder: I also considered...
35+
36+
- type: textarea
37+
id: benefits
38+
attributes:
39+
label: Benefits
40+
description: What are the benefits of this feature?
41+
placeholder: This would help by...
42+
43+
- type: textarea
44+
id: additional
45+
attributes:
46+
label: Additional Context
47+
description: Add any other context, mockups, or examples about the feature request here

0 commit comments

Comments
 (0)